mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-08 13:31:03 +03:00
fix stale primary display selection (#15460)
* fix stale primary display selection Signed-off-by: 21pages <sunboeasy@gmail.com> * fix stale display selection during login and switching - resolve the primary display from the refreshed login snapshot - defer display enumeration until authentication succeeds - read Wayland displays and primary index from the same cache snapshot - reject stale monitor and camera indices during display switching Signed-off-by: 21pages <sunboeasy@gmail.com> * fix inconsistent display snapshots during login - return displays from the same enumeration used to select the primary - avoid re-reading the shared display cache after updating it - use the same converted snapshot during Wayland initialization Signed-off-by: 21pages <sunboeasy@gmail.com> * avoid cloning unchanged display snapshots Signed-off-by: 21pages <sunboeasy@gmail.com> * fix invalid display subset handling Signed-off-by: 21pages <sunboeasy@gmail.com> * minimize code churn in switch_display_to Signed-off-by: 21pages <sunboeasy@gmail.com> --------- Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -357,15 +357,13 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn try_add_primay_video_service(&mut self) {
|
||||
let primary_video_service_name = video_service::get_service_name(
|
||||
VideoSource::Monitor,
|
||||
*display_service::PRIMARY_DISPLAY_IDX,
|
||||
);
|
||||
if !self.contains(&primary_video_service_name) {
|
||||
pub fn try_add_monitor_service(&mut self, display_idx: usize) {
|
||||
let monitor_service_name =
|
||||
video_service::get_service_name(VideoSource::Monitor, display_idx);
|
||||
if !self.contains(&monitor_service_name) {
|
||||
self.add_service(Box::new(video_service::new(
|
||||
VideoSource::Monitor,
|
||||
*display_service::PRIMARY_DISPLAY_IDX,
|
||||
display_idx,
|
||||
)));
|
||||
}
|
||||
}
|
||||
@@ -381,14 +379,17 @@ impl Server {
|
||||
self.connections.insert(conn.id(), conn);
|
||||
}
|
||||
|
||||
pub fn add_connection(&mut self, conn: ConnInner, noperms: &Vec<&'static str>) {
|
||||
let primary_video_service_name = video_service::get_service_name(
|
||||
VideoSource::Monitor,
|
||||
*display_service::PRIMARY_DISPLAY_IDX,
|
||||
);
|
||||
pub fn add_monitor_connection(
|
||||
&mut self,
|
||||
conn: ConnInner,
|
||||
noperms: &Vec<&'static str>,
|
||||
display_idx: usize,
|
||||
) {
|
||||
let monitor_service_name =
|
||||
video_service::get_service_name(VideoSource::Monitor, display_idx);
|
||||
for s in self.services.values() {
|
||||
let name = s.name();
|
||||
if Self::is_video_service_name(&name) && name != primary_video_service_name {
|
||||
if Self::is_video_service_name(&name) && name != monitor_service_name {
|
||||
continue;
|
||||
}
|
||||
if !noperms.contains(&(&name as _)) {
|
||||
@@ -783,8 +784,7 @@ async fn sync_and_watch_config_dir(sync_done_tx: Option<tokio::sync::oneshot::Se
|
||||
loop {
|
||||
sleep(CONFIG_SYNC_INTERVAL_SECS).await;
|
||||
let cfg = (Config::get(), Config2::get());
|
||||
let should_sync =
|
||||
cfg != cfg0 || (is_root_config_empty && !cfg.0.is_empty());
|
||||
let should_sync = cfg != cfg0 || (is_root_config_empty && !cfg.0.is_empty());
|
||||
if should_sync {
|
||||
if is_root_config_empty {
|
||||
log::info!("root config is empty, sync our config to root");
|
||||
|
||||
Reference in New Issue
Block a user