diff --git a/core/src/lib.rs b/core/src/lib.rs index e8b88539..74542b53 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -3041,6 +3041,20 @@ impl<'a> ApplicationHandler for Application<'a> { } else if wm.is_active_window(window_id) { log::info!("window_event: active window resized to {:?}", new_size); wm.resize_active_window(new_size); + let monitor_size = wm + .active_gfx_mut() + .and_then(|gfx| gfx.window().current_monitor()) + .map(|monitor| monitor.size()); + if monitor_size == Some(new_size) + && self.pending_overlay_repair.is_none() + && self.remote_control.as_ref().is_some_and(|remote_control| { + let overlay_window = + remote_control.cursor_controller.get_overlay_window(); + !overlay_window.matches_size(new_size) + }) + { + self.pending_overlay_repair = wm.active_monitor_id(); + } } } } diff --git a/core/src/overlay_window.rs b/core/src/overlay_window.rs index 935c9809..82219fc6 100644 --- a/core/src/overlay_window.rs +++ b/core/src/overlay_window.rs @@ -8,7 +8,7 @@ use core::fmt; use std::sync::{Arc, Mutex}; -use winit::dpi::PhysicalPosition; +use winit::dpi::{PhysicalPosition, PhysicalSize}; use crate::utils::geometry::{Extent, Frame, Position}; @@ -103,6 +103,10 @@ impl OverlayWindow { } } + pub fn matches_size(&self, size: PhysicalSize) -> bool { + self.extent.width == size.width as f64 && self.extent.height == size.height as f64 + } + pub fn source_to_global(&self, position: Position) -> Option { self.source_to_global_with_frame(position, self.capture_frame()) }