fix, linux as controlled side, change resolution

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-03-23 21:17:02 +08:00
parent d7f16a5c0a
commit 8b455d586b
2 changed files with 2 additions and 33 deletions

View File

@@ -431,7 +431,7 @@ fn check_displays_new() -> Option<Vec<Display>> {
}
}
fn check_displays_changed() -> Option<Message> {
fn check_get_displays_changed_msg() -> Option<Message> {
let displays = check_displays_new()?;
let (current, displays) = get_displays_2(&displays);
let mut pi = PeerInfo {
@@ -585,11 +585,8 @@ fn run(sp: GenericService) -> ResultType<()> {
bail!("SWITCH");
}
if let Some(msg_out) = check_displays_changed() {
if let Some(msg_out) = check_get_displays_changed_msg() {
sp.send(msg_out);
}
if c.ndisplay != get_display_num() {
log::info!("Displays changed");
*SWITCH.lock().unwrap() = true;
bail!("SWITCH");
@@ -845,21 +842,6 @@ pub fn handle_one_frame_encoded(
Ok(send_conn_ids)
}
fn get_display_num() -> usize {
#[cfg(target_os = "linux")]
{
if !scrap::is_x11() {
return if let Ok(n) = super::wayland::get_display_num() {
n
} else {
0
};
}
}
LAST_SYNC_DISPLAYS.read().unwrap().len()
}
pub(super) fn get_displays_2(all: &Vec<Display>) -> (usize, Vec<DisplayInfo>) {
let mut displays = Vec::new();
let mut primary = 0;