1
0
Fork 0

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>
This commit is contained in:
Sebastian Keller 2022-11-26 09:46:45 +01:00
parent 4e3450ea4e
commit f0fd013262

View file

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