Fix: wayland repeated share screen prompts (#6628)
* fix wayland repeated screen share prompts Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> * fix is_x11 import Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> * fix supported resolutions import Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> * fix supported resolutions import Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com> --------- Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
parent
50b81c2356
commit
4062d1920c
@ -12,6 +12,8 @@ use crate::platform::linux_desktop_manager;
|
||||
use crate::platform::WallPaperRemover;
|
||||
#[cfg(windows)]
|
||||
use crate::portable_service::client as portable_client;
|
||||
#[cfg(target_os = "linux")]
|
||||
use crate::platform::linux::is_x11;
|
||||
use crate::{
|
||||
client::{
|
||||
new_voice_call_request, new_voice_call_response, start_audio_thread, MediaData, MediaSender,
|
||||
@ -1170,21 +1172,7 @@ impl Connection {
|
||||
..Default::default()
|
||||
})
|
||||
.into();
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
pi.resolutions = Some(SupportedResolutions {
|
||||
resolutions: display_service::try_get_displays()
|
||||
.map(|displays| {
|
||||
displays
|
||||
.get(self.display_idx)
|
||||
.map(|d| crate::platform::resolutions(&d.name()))
|
||||
.unwrap_or(vec![])
|
||||
})
|
||||
.unwrap_or(vec![]),
|
||||
..Default::default()
|
||||
})
|
||||
.into();
|
||||
}
|
||||
pi.resolutions = Self::get_supported_resolutions(self.display_idx).into();
|
||||
|
||||
let mut sub_service = false;
|
||||
if self.file_transfer.is_some() {
|
||||
@ -1248,6 +1236,31 @@ impl Connection {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_supported_resolutions(display_idx: usize) -> Option<SupportedResolutions> {
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
return None;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if !is_x11() {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
Some(SupportedResolutions {
|
||||
resolutions: display_service::try_get_displays()
|
||||
.map(|displays| {
|
||||
displays
|
||||
.get(display_idx)
|
||||
.map(|d| crate::platform::resolutions(&d.name()))
|
||||
.unwrap_or(vec![])
|
||||
})
|
||||
.unwrap_or(vec![]),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn on_remote_authorized(&self) {
|
||||
self.update_codec_on_login();
|
||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||
|
@ -178,7 +178,17 @@ fn displays_to_msg(displays: Vec<DisplayInfo>) -> Message {
|
||||
}
|
||||
|
||||
fn check_get_displays_changed_msg() -> Option<Message> {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if !is_x11() {
|
||||
return get_displays_msg();
|
||||
}
|
||||
}
|
||||
check_update_displays(&try_get_displays().ok()?);
|
||||
get_displays_msg()
|
||||
}
|
||||
|
||||
fn get_displays_msg() -> Option<Message> {
|
||||
let displays = SYNC_DISPLAYS.lock().unwrap().get_update_sync_displays()?;
|
||||
Some(displays_to_msg(displays))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user