wayland not call check_get_displays_changed_msg (#8637)

* wayland not call check_get_displays_changed_msg

For wayland, call Display::all() in video service will cause block, I
don't know the reason.

Signed-off-by: 21pages <sunboeasy@gmail.com>

* Update display_service.rs

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
21pages 2024-07-09 18:01:30 +08:00 committed by GitHub
parent 0bb4d43e9e
commit f07936a911
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -59,6 +59,7 @@ impl Display {
})
}
// Call this function carefully for wayland, it may cause blocking
pub fn all() -> io::Result<Vec<Display>> {
Ok(if super::is_x11() {
x11::Display::all()?

View File

@ -184,6 +184,14 @@ fn check_get_displays_changed_msg() -> Option<Message> {
}
pub fn check_displays_changed() -> ResultType<()> {
#[cfg(target_os = "linux")]
{
// For wayland, call Display::all() in video service will cause block, reproduced by refresh, I don't know the reason.
// block, or even crash here, https://github.com/rustdesk/rustdesk/blob/0bb4d43e9ea9d9dfb9c46c8d27d1a97cd0ad6bea/libs/scrap/src/wayland/pipewire.rs#L235
if !is_x11() {
return Ok(());
}
}
check_update_displays(&try_get_displays()?);
Ok(())
}
@ -394,7 +402,8 @@ pub fn try_get_displays_(add_amyuni_headless: bool) -> ResultType<Vec<Display>>
let mut displays = Display::all()?;
// Do not add virtual display if the platform is not installed or the virtual display is not supported.
if !crate::platform::is_installed() || !virtual_display_manager::is_virtual_display_supported() {
if !crate::platform::is_installed() || !virtual_display_manager::is_virtual_display_supported()
{
return Ok(displays);
}