blob: 02be936d1c4d9c94124d3498975c356d92d3e234 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
Author: Sebastian Keller <skeller@gnome.org>
Source: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2720
Editor: Mingi Sung <FiestaLake@protonmail.com>
Commit: b5d720d37774fff4addd64c2fc5a1667cdd77699
Last Updated: 11/27/22 (Mutter 43.1+r2+g6a962803e-2)
---
The bottom and right frame extents were never calculated and thus always
remained 0. This did not lead to any obvious problems until commit 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: gnome-shell#6050
---
diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index b31d11d46082a5a13cc67125b7711dd6d0511c68..3886ae9e2d3d915d680ff2148d4d46e76f999baa 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 = 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;
|