tests/test-client: Make 'resize' client command include the titlebar

To get some kind of consistency between what 'resize' means for the
compositor and the client, make the size correspond to the "frame rect"
of the window, i.e. the window geometry in the Wayland case, and the
window size including the titlebar in the X11 case.

This is so that the window size later can be reliably compared both in
the compositor and in the client using the same expected dimensions.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171
This commit is contained in:
Jonas Ådahl 2020-04-02 16:03:47 +02:00 committed by Georges Basile Stavracas Neto
parent 0f2a33cc9c
commit 2ee3d5392b

View File

@ -242,6 +242,18 @@ handle_take_focus (GtkWidget *window,
}
}
static int
calculate_titlebar_height (GtkWindow *window)
{
GtkWidget *titlebar;
titlebar = gtk_window_get_titlebar (window);
if (!titlebar)
return 0;
return gtk_widget_get_allocated_height (titlebar);
}
static void
process_line (const char *line)
{
@ -565,7 +577,10 @@ process_line (const char *line)
int width = atoi (argv[2]);
int height = atoi (argv[3]);
gtk_window_resize (GTK_WINDOW (window), width, height);
int titlebar_height = calculate_titlebar_height (GTK_WINDOW (window));
gtk_window_resize (GTK_WINDOW (window),
width,
height - titlebar_height);
}
else if (strcmp (argv[0], "raise") == 0)
{