fix: popup surface commit when update size

This commit is contained in:
drendog 2025-11-24 01:26:59 +01:00
parent adc9344b85
commit dac315b589
Signed by: dwenya
GPG key ID: 8DD77074645332D0
3 changed files with 40 additions and 7 deletions

View file

@ -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();
}
}

View file

@ -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))
{
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
})

View file

@ -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
);
}
}