From 5e162850e9f03ea145026a478283548dfee5ced4 Mon Sep 17 00:00:00 2001 From: drendog Date: Sun, 2 Nov 2025 08:02:44 +0100 Subject: [PATCH] fix: output size on popup size fallback --- adapters/src/wayland/shell_adapter.rs | 14 +++++++------- adapters/src/wayland/surfaces/popup_manager.rs | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/adapters/src/wayland/shell_adapter.rs b/adapters/src/wayland/shell_adapter.rs index c5856c5..bd8f239 100644 --- a/adapters/src/wayland/shell_adapter.rs +++ b/adapters/src/wayland/shell_adapter.rs @@ -175,21 +175,21 @@ impl WaylandWindowingSystem { let layer_surface = state.layer_surface(); let queue_handle = event_queue.handle(); let serial_holder = Rc::clone(shared_serial); - let output_size = *state.output_size(); - - #[allow(clippy::cast_precision_loss)] - let default_width = output_size.width as f32; - #[allow(clippy::cast_precision_loss)] - let default_height = output_size.height as f32; platform.set_popup_creator(move || { info!("Popup creator called! Creating popup window..."); let serial = serial_holder.get(); + let output_size = popup_manager_clone.output_size(); + #[allow(clippy::cast_precision_loss)] + let default_width = output_size.width as f32; + #[allow(clippy::cast_precision_loss)] + let default_height = output_size.height as f32; + let (reference_x, reference_y, width, height, positioning_mode) = get_popup_config() .unwrap_or_else(|| { - log::warn!("No popup config provided, using output size as defaults"); + log::warn!("No popup config provided, using output size ({default_width}x{default_height}) as defaults"); ( 0.0, 0.0, diff --git a/adapters/src/wayland/surfaces/popup_manager.rs b/adapters/src/wayland/surfaces/popup_manager.rs index c554240..dbf76b1 100644 --- a/adapters/src/wayland/surfaces/popup_manager.rs +++ b/adapters/src/wayland/surfaces/popup_manager.rs @@ -93,6 +93,10 @@ impl PopupManager { *self.current_output_size.borrow_mut() = output_size; } + pub fn output_size(&self) -> PhysicalSize { + *self.current_output_size.borrow() + } + pub fn create_popup( self: &Rc, queue_handle: &QueueHandle,