From dac315b5898e1d4fb4e1250d46616f51cae02ad7 Mon Sep 17 00:00:00 2001 From: drendog Date: Mon, 24 Nov 2025 01:26:59 +0100 Subject: [PATCH] fix: popup surface commit when update size --- .../src/wayland/surfaces/popup_surface.rs | 6 +++-- crates/composition/src/slint_callbacks.rs | 25 +++++++++++++++---- crates/composition/src/system.rs | 16 ++++++++++++ 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/crates/adapters/src/wayland/surfaces/popup_surface.rs b/crates/adapters/src/wayland/surfaces/popup_surface.rs index 8619465..ee72abb 100644 --- a/crates/adapters/src/wayland/surfaces/popup_surface.rs +++ b/crates/adapters/src/wayland/surfaces/popup_surface.rs @@ -141,11 +141,13 @@ impl PopupSurface { pub fn update_viewport_size(&self, logical_width: i32, logical_height: i32) { if let Some(ref vp) = self.viewport { - info!( + log::debug!( "Updating popup viewport destination to logical size: {}x{}", - logical_width, logical_height + logical_width, + logical_height ); vp.set_destination(logical_width, logical_height); + self.surface.commit(); } } diff --git a/crates/composition/src/slint_callbacks.rs b/crates/composition/src/slint_callbacks.rs index a0d2d3d..3313951 100644 --- a/crates/composition/src/slint_callbacks.rs +++ b/crates/composition/src/slint_callbacks.rs @@ -236,11 +236,26 @@ impl SlintCallbackContract { popup_key ); - if let Some(popup_window) = popup_manager_for_resize - .upgrade() - .and_then(|mgr| mgr.get_popup_window(popup_key)) - { - popup_window.request_resize(width, height); + if let Some(popup_manager) = popup_manager_for_resize.upgrade() { + if let Some(popup_window) = popup_manager.get_popup_window(popup_key) { + popup_window.request_resize(width, height); + + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_wrap)] + let logical_width = width as i32; + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_wrap)] + let logical_height = height as i32; + + popup_manager.update_popup_viewport(popup_key, logical_width, logical_height); + log::debug!( + "Updated popup viewport to logical size: {}x{} (from direct resize to {}x{})", + logical_width, + logical_height, + width, + height + ); + } } Value::Void }) diff --git a/crates/composition/src/system.rs b/crates/composition/src/system.rs index 9e346b0..cca2934 100644 --- a/crates/composition/src/system.rs +++ b/crates/composition/src/system.rs @@ -355,6 +355,22 @@ impl ShellContext<'_> { } else if size_changed { if let Some(popup_window) = popup_manager.get_popup_window(handle.key()) { popup_window.request_resize(width, height); + + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_wrap)] + let logical_width = width as i32; + #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_wrap)] + let logical_height = height as i32; + + popup_manager.update_popup_viewport(handle.key(), logical_width, logical_height); + log::debug!( + "Updated popup viewport to logical size: {}x{} (from resize to {}x{})", + logical_width, + logical_height, + width, + height + ); } }