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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1661>
This commit is contained in:
Sebastian Keller 2021-01-01 08:24:26 +01:00 committed by Marge Bot
parent 81f3694804
commit ff4f8d2aa0

View File

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