From 4808ba2b2055a09008be17d3e9eeae2d592b7b18 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 5 Sep 2025 16:41:54 +0300 Subject: Update Smithay (last_acked refactor, Qt layer-shell popup grab fix, popup ordering fix) --- src/utils/mod.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/utils/mod.rs') diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 26bfe582..a96c1bfc 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -25,7 +25,8 @@ use smithay::utils::{Coordinate, Logical, Point, Rectangle, Size, Transform}; use smithay::wayland::compositor::{send_surface_state, with_states, SurfaceData}; use smithay::wayland::fractional_scale::with_fractional_scale; use smithay::wayland::shell::xdg::{ - ToplevelSurface, XdgToplevelSurfaceData, XdgToplevelSurfaceRoleAttributes, + ToplevelCachedState, ToplevelState, ToplevelSurface, XdgToplevelSurfaceData, + XdgToplevelSurfaceRoleAttributes, }; use wayland_backend::server::Credentials; @@ -279,6 +280,25 @@ pub fn with_toplevel_role( }) } +pub fn with_toplevel_role_and_current( + toplevel: &ToplevelSurface, + f: impl FnOnce(&mut XdgToplevelSurfaceRoleAttributes, Option<&ToplevelState>) -> T, +) -> T { + with_states(toplevel.wl_surface(), |states| { + let mut role = states + .data_map + .get::() + .unwrap() + .lock() + .unwrap(); + + let mut guard = states.cached_state.get::(); + let current = guard.current().last_acked.as_ref().map(|c| &c.state); + + f(&mut role, current) + }) +} + pub fn update_tiled_state( toplevel: &ToplevelSurface, prefer_no_csd: bool, -- cgit