restore custom resolution for each display

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-06-05 18:01:43 +08:00
parent b07ac438f5
commit e670989e0f
7 changed files with 132 additions and 36 deletions

View File

@@ -1793,6 +1793,14 @@ impl Connection {
Some(message::Union::Misc(misc)) => match misc.union {
Some(misc::Union::SwitchDisplay(s)) => {
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()
});
}
}
Some(misc::Union::ChatMessage(c)) => {
self.send_to_cm(ipc::Data::ChatMessage { text: c.text });
@@ -2159,10 +2167,14 @@ impl Connection {
}
}
}
// Custom resolution here is only valid in the process of establishing a connection.
// After the connection is established, the resolution is changed by another message.
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if let Some(custom_resolution) = o.custom_resolution.as_ref() {
if custom_resolution.width > 0 && custom_resolution.height > 0 {
self.change_resolution(&custom_resolution);
if Self::alive_conns().len() > 0 {
if custom_resolution.width > 0 && custom_resolution.height > 0 {
self.change_resolution(&custom_resolution);
}
}
}
if self.keyboard {