From ff4f8d2aa076044d1d79379974e8fd6b812cb2f0 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 1 Jan 2021 08:24:26 +0100 Subject: [PATCH] frames: Consider events on fullscreen windows to be on the client area Fullscreen X11 windows that attempt to change the resolution on Wayland use a surface viewport to achieve this without affecting the resolution of the display. This however also means that pointer events will be delivered in the display coordinates while the code handling the window frame is not aware of any such viewport scaling. So a right click outside of the area corresponding to the new resolution will not be considered to be on the client area. And since the only area that is ignored when determining whether to perform the right click action, such as opening the context menu, is the client area, this will result in the action being performed, despite happening on the (scaled) client area. While it would be possible to scale the event coordinates so that get_control() correctly determines the frame element the cursor is on, viewport scaling only affects fullscreen windows. Since fullscreen windows have no frame, we can always assume that if the window gets delivered an event for a fullscreen window, it is on the client area without doing any additional calculations. Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1592 Part-of: --- src/ui/frames.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/frames.c b/src/ui/frames.c index 542cc54e0..46e62682c 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -1740,6 +1740,9 @@ get_control (MetaUIFrame *frame, int root_x, int root_y) int x, y; int win_x, win_y; + if (meta_window_is_fullscreen (frame->meta_window)) + return META_FRAME_CONTROL_CLIENT_AREA; + gdk_window_get_position (frame->window, &win_x, &win_y); x = root_x - win_x; y = root_y - win_y;