From 02a6290067b1d8d87106ce909ee00a30022775f7 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 8 Dec 2023 16:21:16 +0000 Subject: [PATCH] xdg-shell: Fix menu offset --- src/wayland/handlers/xdg_shell/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wayland/handlers/xdg_shell/mod.rs b/src/wayland/handlers/xdg_shell/mod.rs index cb891476..e4b43c2b 100644 --- a/src/wayland/handlers/xdg_shell/mod.rs +++ b/src/wayland/handlers/xdg_shell/mod.rs @@ -19,9 +19,11 @@ use smithay::{ }, utils::{Logical, Point, Serial}, wayland::{ + compositor::with_states, seat::WaylandFocus, shell::xdg::{ - PopupSurface, PositionerState, ToplevelSurface, XdgShellHandler, XdgShellState, + PopupSurface, PositionerState, SurfaceCachedState, ToplevelSurface, XdgShellHandler, + XdgShellState, }, }, }; @@ -365,9 +367,14 @@ impl XdgShellHandler for State { surface: ToplevelSurface, seat: WlSeat, serial: Serial, - location: Point, + mut location: Point, ) { let seat = Seat::from_resource(&seat).unwrap(); + location -= with_states(surface.wl_surface(), |states| { + states.cached_state.current::().geometry + }) + .unwrap_or_default() + .loc; Shell::menu_request(self, surface.wl_surface(), &seat, serial, location) } }