From f0fd013262a7cd3606936de08d61b383dba50ffe Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Sat, 26 Nov 2022 09:46:45 +0100 Subject: [PATCH] window/wayland: Calculate bottom and right frame extents The bottom and right frame extents were never calculated and thus always remained 0. This did not lead to any obvious problems until 6cbc5180 which started relying on those to calculate the buffer rect. This resulted for example in window screenshots being cut off at the bottom right corner of the window rather than the buffer. Fixes: 6cbc5180 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6050 Part-of: --- src/wayland/meta-window-wayland.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c index b31d11d46..3886ae9e2 100644 --- a/src/wayland/meta-window-wayland.c +++ b/src/wayland/meta-window-wayland.c @@ -626,6 +626,10 @@ meta_window_wayland_main_monitor_changed (MetaWindow *window, (int)(scale_factor * window->custom_frame_extents.left); window->custom_frame_extents.top = (int)(scale_factor * window->custom_frame_extents.top); + window->custom_frame_extents.right = + (int)(scale_factor * window->custom_frame_extents.right); + window->custom_frame_extents.bottom = + (int)(scale_factor * window->custom_frame_extents.bottom); /* Buffer rect. */ scale_rect_size (&window->buffer_rect, scale_factor); @@ -1093,6 +1097,7 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, { MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window); MetaDisplay *display = window->display; + MetaWaylandSurface *surface = wl_window->surface; int dx, dy; int geometry_scale; MetaGravity gravity; @@ -1126,8 +1131,21 @@ meta_window_wayland_finish_move_resize (MetaWindow *window, dy = pending->dy * geometry_scale; /* XXX: Find a better place to store the window geometry offsets. */ - window->custom_frame_extents.left = new_geom.x; - window->custom_frame_extents.top = new_geom.y; + if (meta_wayland_surface_get_buffer (surface)) + { + window->custom_frame_extents.left = new_geom.x; + window->custom_frame_extents.top = new_geom.y; + window->custom_frame_extents.right = + meta_wayland_surface_get_width (surface) * geometry_scale - + new_geom.x - new_geom.width; + window->custom_frame_extents.bottom = + meta_wayland_surface_get_height (surface) * geometry_scale - + new_geom.y - new_geom.height; + } + else + { + window->custom_frame_extents = (GtkBorder) { 0 }; + } flags = META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE;