summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Keller <skeller@gnome.org>2022-11-26 09:46:45 +0100
committerRobert Mader <robert.mader@posteo.de>2022-12-03 09:37:38 +0000
commitff15d05f8be58825cdb7aee044d43e69625579e0 (patch)
tree68f20cf286581ee150991c462d1a310846453e53
parent052e47eae584a1c7ae3aa12f1bd1ac9552ced661 (diff)
downloadmutter-ff15d05f8be58825cdb7aee044d43e69625579e0.tar.gz
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2720> (cherry picked from commit f0fd013262a7cd3606936de08d61b383dba50ffe)
-rw-r--r--src/wayland/meta-window-wayland.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index d8ece0bd7..a4c84e3e7 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -590,6 +590,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);
@@ -982,6 +986,7 @@ meta_window_wayland_finish_move_resize (MetaWindow *window,
{
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
MetaDisplay *display = window->display;
+ MetaWaylandSurface *surface = window->surface;
int dx, dy;
int geometry_scale;
MetaGravity gravity;
@@ -1008,8 +1013,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;