diff --git a/winit/src/platform_specific/wayland/event_loop/state.rs b/winit/src/platform_specific/wayland/event_loop/state.rs index f75512a7..688a021d 100644 --- a/winit/src/platform_specific/wayland/event_loop/state.rs +++ b/winit/src/platform_specific/wayland/event_loop/state.rs @@ -273,6 +273,11 @@ pub struct SctkPopup { impl SctkPopup { pub(crate) fn set_size(&mut self, w: u32, h: u32, token: u32) { + let guard = self.common.lock().unwrap(); + if guard.size.width == w && guard.size.height == h { + return; + } + drop(guard); // update geometry self.popup .xdg_surface() @@ -285,6 +290,9 @@ impl SctkPopup { pub(crate) fn update_viewport(&mut self, w: u32, h: u32) { let common = self.common.lock().unwrap(); + if common.size.width == w && common.size.height == h { + return; + } if let Some(viewport) = common.wp_viewport.as_ref() { // Set inner size without the borders. viewport.set_destination(w as i32, h as i32); diff --git a/winit/src/platform_specific/wayland/winit_window.rs b/winit/src/platform_specific/wayland/winit_window.rs index c9d2f9cb..67386108 100644 --- a/winit/src/platform_specific/wayland/winit_window.rs +++ b/winit/src/platform_specific/wayland/winit_window.rs @@ -110,6 +110,12 @@ impl winit::window::Window for SctkWinitWindow { if logical_size.width == 0 || logical_size.height == 0 { return None; } + if guard.size.width == logical_size.width + && guard.size.height == logical_size.height + { + return None; + } + guard.size = logical_size; guard.requested_size.0 = Some(guard.size.width); guard.requested_size.1 = Some(guard.size.height); @@ -147,6 +153,12 @@ impl winit::window::Window for SctkWinitWindow { if logical_size.height > 0 { guard.size.height = logical_size.height; } + if guard.size.width == logical_size.width + && guard.size.height == logical_size.height + { + return None; + } + layer_surface.set_size(logical_size.width, logical_size.height); if let Some(viewport) = guard.wp_viewport.as_ref() { // Set inner size without the borders. @@ -158,6 +170,11 @@ impl winit::window::Window for SctkWinitWindow { } CommonSurface::Lock(_) => {} CommonSurface::Subsurface { .. } => { + if guard.size.width == logical_size.width + && guard.size.height == logical_size.height + { + return None; + } guard.requested_size = ( (logical_size.width > 0).then_some(logical_size.width), (logical_size.height > 0).then_some(logical_size.height),