debug restore resolution

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-06-05 20:21:21 +08:00
parent 3c2bf2c154
commit 6959f044f0
5 changed files with 39 additions and 31 deletions

View File

@@ -1795,14 +1795,11 @@ impl Connection {
video_service::switch_display(s.display).await;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if s.width != 0 && s.height != 0 {
self.change_resolution(
&Resolution {
width: s.width,
height: s.height,
..Default::default()
},
false,
);
self.change_resolution(&Resolution {
width: s.width,
height: s.height,
..Default::default()
});
}
}
Some(misc::Union::ChatMessage(c)) => {
@@ -1905,7 +1902,7 @@ impl Connection {
}
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(misc::Union::ChangeResolution(r)) => self.change_resolution(&r, false),
Some(misc::Union::ChangeResolution(r)) => self.change_resolution(&r),
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
Some(misc::Union::PluginRequest(p)) => {
@@ -1948,13 +1945,9 @@ impl Connection {
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn change_resolution(&mut self, r: &Resolution, first_display: bool) {
fn change_resolution(&mut self, r: &Resolution) {
if self.keyboard {
if let Ok((_, current, display)) = video_service::get_current_display() {
if first_display && current != 0 {
return;
}
let name = display.name();
if let Ok(name) = video_service::get_current_display_name() {
#[cfg(all(windows, feature = "virtual_display_driver"))]
if let Some(_ok) =
crate::virtual_display_manager::change_resolution_if_is_virtual_display(
@@ -2180,7 +2173,7 @@ impl Connection {
if let Some(custom_resolution) = o.custom_resolution.as_ref() {
if Self::alive_conns().len() > 0 {
if custom_resolution.width > 0 && custom_resolution.height > 0 {
self.change_resolution(&custom_resolution, true);
self.change_resolution(&custom_resolution);
}
}
}