mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland/window: Correct detection whether to send configure
When deciding if `configure` event should be sent, `meta_window_wayland_move_resize_internal` compares requested window size with `window->rect` size. However, `window->rect` is only updated when `commit` is received. So the following sequence produces incorrect result: 1. a window initially has size `size1` 2. `move_resize_internal` is called with `size2`. `configure` is sent 3. `move_resize_internal` is called with `size1` to restore original size, but `commit` for `size2` haven't arrived yet. So `window->rect` still has size `size1`, and thus new `configure` is not sent 4. `commit` for `size2` arrives, window changes size to `size2` Expected window size in the end: `size1` Actual: `size2` To fix the issue, take size from pending `configure` events into account. Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1627 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1755>
This commit is contained in:
parent
56fc09151d
commit
236e9ec68f
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "wayland/meta-wayland-window-configuration.h"
|
#include "wayland/meta-wayland-window-configuration.h"
|
||||||
|
|
||||||
|
#include "wayland/meta-window-wayland.h"
|
||||||
|
|
||||||
static uint32_t global_serial_counter = 0;
|
static uint32_t global_serial_counter = 0;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -51,6 +53,13 @@ meta_wayland_window_configuration_new (MetaWindow *window,
|
|||||||
MetaGravity gravity)
|
MetaGravity gravity)
|
||||||
{
|
{
|
||||||
MetaWaylandWindowConfiguration *configuration;
|
MetaWaylandWindowConfiguration *configuration;
|
||||||
|
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
|
||||||
|
int pending_width;
|
||||||
|
int pending_height;
|
||||||
|
|
||||||
|
meta_window_wayland_get_pending_size (wl_window,
|
||||||
|
&pending_width,
|
||||||
|
&pending_height);
|
||||||
|
|
||||||
configuration = g_new0 (MetaWaylandWindowConfiguration, 1);
|
configuration = g_new0 (MetaWaylandWindowConfiguration, 1);
|
||||||
*configuration = (MetaWaylandWindowConfiguration) {
|
*configuration = (MetaWaylandWindowConfiguration) {
|
||||||
@ -72,8 +81,8 @@ meta_wayland_window_configuration_new (MetaWindow *window,
|
|||||||
|
|
||||||
if (flags & META_MOVE_RESIZE_RESIZE_ACTION ||
|
if (flags & META_MOVE_RESIZE_RESIZE_ACTION ||
|
||||||
is_window_size_fixed (window) ||
|
is_window_size_fixed (window) ||
|
||||||
window->rect.width != width ||
|
pending_width != width ||
|
||||||
window->rect.height != height)
|
pending_height != height)
|
||||||
{
|
{
|
||||||
configuration->has_size = TRUE;
|
configuration->has_size = TRUE;
|
||||||
configuration->width = width;
|
configuration->width = width;
|
||||||
|
@ -301,6 +301,12 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int pending_width;
|
||||||
|
int pending_height;
|
||||||
|
meta_window_wayland_get_pending_size (wl_window,
|
||||||
|
&pending_width,
|
||||||
|
&pending_height);
|
||||||
|
|
||||||
if (window->placement.rule)
|
if (window->placement.rule)
|
||||||
{
|
{
|
||||||
switch (window->placement.state)
|
switch (window->placement.state)
|
||||||
@ -315,8 +321,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
|||||||
if (flags & META_MOVE_RESIZE_PLACEMENT_CHANGED ||
|
if (flags & META_MOVE_RESIZE_PLACEMENT_CHANGED ||
|
||||||
rel_x != wl_window->last_sent_rel_x ||
|
rel_x != wl_window->last_sent_rel_x ||
|
||||||
rel_y != wl_window->last_sent_rel_y ||
|
rel_y != wl_window->last_sent_rel_y ||
|
||||||
constrained_rect.width != window->rect.width ||
|
constrained_rect.width != pending_width ||
|
||||||
constrained_rect.height != window->rect.height)
|
constrained_rect.height != pending_height)
|
||||||
{
|
{
|
||||||
MetaWaylandWindowConfiguration *configuration;
|
MetaWaylandWindowConfiguration *configuration;
|
||||||
|
|
||||||
@ -349,8 +355,8 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (constrained_rect.width != window->rect.width ||
|
else if (constrained_rect.width != pending_width ||
|
||||||
constrained_rect.height != window->rect.height ||
|
constrained_rect.height != pending_height ||
|
||||||
flags & META_MOVE_RESIZE_STATE_CHANGED)
|
flags & META_MOVE_RESIZE_STATE_CHANGED)
|
||||||
{
|
{
|
||||||
MetaWaylandWindowConfiguration *configuration;
|
MetaWaylandWindowConfiguration *configuration;
|
||||||
@ -1204,3 +1210,27 @@ meta_window_wayland_get_max_size (MetaWindow *window,
|
|||||||
scale = 1.0 / (float) meta_window_wayland_get_geometry_scale (window);
|
scale = 1.0 / (float) meta_window_wayland_get_geometry_scale (window);
|
||||||
scale_size (width, height, scale);
|
scale_size (width, height, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_window_wayland_get_pending_size (MetaWindowWayland *wl_window,
|
||||||
|
int *width,
|
||||||
|
int *height)
|
||||||
|
{
|
||||||
|
MetaWindow *window = META_WINDOW (wl_window);
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = wl_window->pending_configurations; l; l = l->next)
|
||||||
|
{
|
||||||
|
MetaWaylandWindowConfiguration *configuration = l->data;
|
||||||
|
|
||||||
|
if (configuration->has_size)
|
||||||
|
{
|
||||||
|
*width = configuration->width;
|
||||||
|
*height = configuration->height;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*width = window->rect.width;
|
||||||
|
*height = window->rect.height;
|
||||||
|
}
|
||||||
|
@ -77,4 +77,8 @@ void meta_window_wayland_get_max_size (MetaWindow *window,
|
|||||||
int *width,
|
int *width,
|
||||||
int *height);
|
int *height);
|
||||||
|
|
||||||
|
void meta_window_wayland_get_pending_size (MetaWindowWayland *wl_window,
|
||||||
|
int *width,
|
||||||
|
int *height);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user