fix: pop up size not configuring correctly

This commit is contained in:
Hojjat 2026-02-27 19:03:59 -07:00 • committed by Ashley Wulber
parent 4259b64bfc
commit 0424b4ae42

View file

@ -1080,10 +1080,6 @@ impl SctkEvent {
let _ = user_interfaces.insert(surface_id, ui); let _ = user_interfaces.insert(surface_id, ui);
} }
PopupEventVariant::Configure(configure, surface, first) => { PopupEventVariant::Configure(configure, surface, first) => {
let size = Size::new(
configure.width as f32,
configure.height as f32,
);
if let Some((id, w)) = if let Some((id, w)) =
surface_ids.get(&surface.id()).and_then(|id| { surface_ids.get(&surface.id()).and_then(|id| {
window_manager window_manager
@ -1101,14 +1097,22 @@ impl SctkEvent {
.expect("Send control message"); .expect("Send control message");
proxy.wake_up(); proxy.wake_up();
} }
let physical = w.raw.surface_size();
let scale = w.state.scale_factor(); let (p_w, p_h) = if physical.width > 0
let p_w = (configure.width.max(1) as f64 * scale) && physical.height > 0
.ceil() {
as u32; (physical.width, physical.height)
let p_h = (configure.height.max(1) as f64 * scale) } else {
.ceil() // Fallback if backend has not reported an updated
as u32; // 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( w.state.update(
program, program,
@ -1117,6 +1121,7 @@ impl SctkEvent {
PhysicalSize::new(p_w, p_h), PhysicalSize::new(p_w, p_h),
), ),
); );
let size = w.state.logical_size();
if first { if first {
events.push(( events.push((
Some(id), Some(id),