From 7f99f13c09a90c10bc3d281e3a47bc01ca3fb523 Mon Sep 17 00:00:00 2001 From: drendog Date: Thu, 27 Nov 2025 19:19:01 +0100 Subject: [PATCH] fix: remove popup recreation workaround --- README.md | 4 +-- crates/composition/src/system.rs | 44 +++----------------------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 6b591c3..b696bc2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Please note that this library is currently in early development and is not yet r - **Wayland**: Comprehensive layer shell protocol support using `smithay-client-toolkit` - Output management and configuration - Surface lifecycle management - - Basic xdg popup support (currently with double creation workaround, due dependencies limitations) + - Basic xdg popup support - Event handling system - **UI Integration**: Slint integration layer with custom rendering backend - **Documentation**: Work in progress @@ -25,7 +25,7 @@ Please note that this library is currently in early development and is not yet r - EGL context creation and management - Wayland layer shell surface creation -- XDG popup support (with some limitations, new window and resizing needed to work with current workaround) +- XDG popup support (with some limitations: resizing needed) - Basic rendering with femtovg - Output detection and management - Event handling framework diff --git a/crates/composition/src/system.rs b/crates/composition/src/system.rs index c93b9df..6d2b64c 100644 --- a/crates/composition/src/system.rs +++ b/crates/composition/src/system.rs @@ -384,13 +384,7 @@ impl ShellContext<'_> { Ok(()) } - pub fn resize_popup( - &mut self, - handle: PopupHandle, - width: f32, - height: f32, - resize_control: Option, - ) -> Result<()> { + pub fn resize_popup(&mut self, handle: PopupHandle, width: f32, height: f32) -> Result<()> { let active_window = self.active_or_primary_output().ok_or_else(|| { Error::Domain(DomainError::Configuration { message: "No active or primary output available".to_string(), @@ -415,34 +409,7 @@ impl ShellContext<'_> { let size_changed = current_size.is_none_or(|(w, h)| (w - width).abs() > 0.01 || (h - height).abs() > 0.01); - let needs_repositioning = request.mode.center_x() || request.mode.center_y(); - - if needs_repositioning && size_changed { - log::info!( - "Popup needs repositioning due to mode {:?} and size change - recreating with new size {}x{}", - request.mode, - width, - height - ); - - self.close_popup(handle)?; - - let mut builder = PopupRequest::builder(request.component) - .at(request.at) - .size(PopupSize::fixed(width, height)) - .mode(request.mode); - - if let Some(close_cb) = &request.close_callback { - builder = builder.close_on(close_cb.clone()); - } - if let Some(resize_cb) = &request.resize_callback { - builder = builder.resize_on(resize_cb.clone()); - } - - let new_request = builder.build(); - - self.show_popup(&new_request, resize_control)?; - } else if size_changed { + if size_changed { if let Some(popup_window) = popup_manager.get_popup_window(handle.key()) { popup_window.request_resize(width, height); @@ -709,12 +676,7 @@ impl App { width, height, } => { - if let Err(e) = shell_context.resize_popup( - handle, - width, - height, - Some(control.clone()), - ) { + if let Err(e) = shell_context.resize_popup(handle, width, height) { log::error!("Failed to resize popup: {}", e); } }