fix, linux as controlled side, change resolution
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
d7f16a5c0a
commit
8b455d586b
@ -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 displays = check_displays_new()?;
|
||||||
let (current, displays) = get_displays_2(&displays);
|
let (current, displays) = get_displays_2(&displays);
|
||||||
let mut pi = PeerInfo {
|
let mut pi = PeerInfo {
|
||||||
@ -585,11 +585,8 @@ fn run(sp: GenericService) -> ResultType<()> {
|
|||||||
bail!("SWITCH");
|
bail!("SWITCH");
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(msg_out) = check_displays_changed() {
|
if let Some(msg_out) = check_get_displays_changed_msg() {
|
||||||
sp.send(msg_out);
|
sp.send(msg_out);
|
||||||
}
|
|
||||||
|
|
||||||
if c.ndisplay != get_display_num() {
|
|
||||||
log::info!("Displays changed");
|
log::info!("Displays changed");
|
||||||
*SWITCH.lock().unwrap() = true;
|
*SWITCH.lock().unwrap() = true;
|
||||||
bail!("SWITCH");
|
bail!("SWITCH");
|
||||||
@ -845,21 +842,6 @@ pub fn handle_one_frame_encoded(
|
|||||||
Ok(send_conn_ids)
|
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>) {
|
pub(super) fn get_displays_2(all: &Vec<Display>) -> (usize, Vec<DisplayInfo>) {
|
||||||
let mut displays = Vec::new();
|
let mut displays = Vec::new();
|
||||||
let mut primary = 0;
|
let mut primary = 0;
|
||||||
|
@ -230,19 +230,6 @@ pub(super) fn get_primary() -> ResultType<usize> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn get_display_num() -> ResultType<usize> {
|
|
||||||
let addr = *CAP_DISPLAY_INFO.read().unwrap();
|
|
||||||
if addr != 0 {
|
|
||||||
let cap_display_info: *const CapDisplayInfo = addr as _;
|
|
||||||
unsafe {
|
|
||||||
let cap_display_info = &*cap_display_info;
|
|
||||||
Ok(cap_display_info.num)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bail!("Failed to get capturer display info");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(super) fn release_resource() {
|
pub(super) fn release_resource() {
|
||||||
if scrap::is_x11() {
|
if scrap::is_x11() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user