1
0
Fork 0

window/wayland: Constrain sporadic client resizes immediately

When a client resizes on its own, make sure the new size is passed
through the window constraints machinery directly, to trigger any
potential window management rule that might apply.

Fix a couple of tests to make use of this behavior by introducing a new
'wait_size' command that waits until a window has been resized to a
expected size.

This replaces the fix introduced in 0e736af301 ("window: Ensure
constraints after a Wayland client resize").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3700>
This commit is contained in:
Jonas Ådahl 2024-04-14 22:11:14 +02:00 committed by Marge Bot
parent 6819296e81
commit 57e16cf010
5 changed files with 37 additions and 8 deletions

View file

@ -3997,9 +3997,6 @@ meta_window_move_resize_internal (MetaWindow *window,
meta_stack_update_window_tile_matches (window->display->stack,
workspace_manager->active_workspace);
if (flags & META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE)
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
/* This is a workaround for #1627. We still don't have any tests that can
* reproduce this issue reliably and this is not a proper fix! */
if (flags & META_MOVE_RESIZE_WAYLAND_FINISH_MOVE_RESIZE &&

View file

@ -19,7 +19,7 @@ move w/1 300 200
assert_position w/1 300 200
resize w/1 600 500
wait_reconfigure
wait_size w/1 600 500
assert_position w/1 200 100
destroy w/1
@ -38,7 +38,7 @@ move x/1 300 200
assert_position x/1 300 200
resize x/1 600 500
wait_reconfigure
wait_size x/1 600 500
assert_position x/1 200 100
destroy x/1

View file

@ -18,8 +18,7 @@ wait
assert_size x/1 500 400
resize x/1 300 200
wait_reconfigure
assert_size x/1 300 200
wait_size x/1 300 200
maximize x/1
wait_reconfigure
unmaximize x/1

View file

@ -840,6 +840,35 @@ test_case_do (TestCase *test,
if (!test_case_wait (test, error))
return FALSE;
}
else if (strcmp (argv[0], "wait_size") == 0)
{
MetaTestClient *client;
const char *window_id;
MetaWindow *window;
int width, height;
if (argc != 4)
BAD_COMMAND("usage: %s <client-id>/<window-id> <width> <height>", argv[0]);
if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
return FALSE;
window = meta_test_client_find_window (client, window_id, error);
width = atoi (argv[2]);
height = atoi (argv[3]);
while (TRUE)
{
MtkRectangle rect;
meta_window_get_frame_rect (window, &rect);
if (rect.width == width && rect.height == height)
break;
g_main_context_iteration (NULL, TRUE);
}
}
else if (strcmp (argv[0], "dispatch") == 0)
{
if (argc != 1)

View file

@ -1253,8 +1253,12 @@ meta_window_wayland_finish_move_resize (MetaWindow *window,
if (rect.width != window->rect.width || rect.height != window->rect.height)
{
flags |= META_MOVE_RESIZE_RESIZE_ACTION;
if (is_client_resize)
flags |= META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE;
{
flags |= META_MOVE_RESIZE_WAYLAND_CLIENT_RESIZE;
flags |= META_MOVE_RESIZE_CONSTRAIN;
}
}
g_clear_pointer (&wl_window->last_acked_configuration,