From 0424b4ae42d7a5853a932057f8152c467525da42 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Fri, 27 Feb 2026 19:03:59 -0700 Subject: [PATCH] fix: pop up size not configuring correctly --- .../platform_specific/wayland/sctk_event.rs | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/winit/src/platform_specific/wayland/sctk_event.rs b/winit/src/platform_specific/wayland/sctk_event.rs index 1e621451..3399ea4d 100755 --- a/winit/src/platform_specific/wayland/sctk_event.rs +++ b/winit/src/platform_specific/wayland/sctk_event.rs @@ -1080,10 +1080,6 @@ impl SctkEvent { let _ = user_interfaces.insert(surface_id, ui); } PopupEventVariant::Configure(configure, surface, first) => { - let size = Size::new( - configure.width as f32, - configure.height as f32, - ); if let Some((id, w)) = surface_ids.get(&surface.id()).and_then(|id| { window_manager @@ -1101,14 +1097,22 @@ impl SctkEvent { .expect("Send control message"); proxy.wake_up(); } - - let scale = w.state.scale_factor(); - let p_w = (configure.width.max(1) as f64 * scale) - .ceil() - as u32; - let p_h = (configure.height.max(1) as f64 * scale) - .ceil() - as u32; + let physical = w.raw.surface_size(); + let (p_w, p_h) = if physical.width > 0 + && physical.height > 0 + { + (physical.width, physical.height) + } else { + // Fallback if backend has not reported an updated + // surface size yet for this configure. + let scale = w.state.scale_factor(); + ( + (configure.width.max(1) as f64 * scale) + .ceil() as u32, + (configure.height.max(1) as f64 * scale) + .ceil() as u32, + ) + }; w.state.update( program, @@ -1117,6 +1121,7 @@ impl SctkEvent { PhysicalSize::new(p_w, p_h), ), ); + let size = w.state.logical_size(); if first { events.push(( Some(id),