mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
tests: Add 'accept_focus' command to runner and client
Under the hood, calls gtk_window_set_accept_focus in the client
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
(cherry picked from commit e1f839f48f
)
This commit is contained in:
parent
68691cb1b9
commit
93f268a4a8
@ -161,6 +161,24 @@ process_line (const char *line)
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window),
|
||||
GTK_WINDOW (parent_window));
|
||||
}
|
||||
else if (strcmp (argv[0], "accept_focus") == 0)
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
g_print ("usage: %s <window-id> [true|false]", argv[0]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
GtkWidget *window = lookup_window (argv[1]);
|
||||
if (!window)
|
||||
{
|
||||
g_print ("unknown window %s", argv[1]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
gboolean enabled = g_ascii_strcasecmp (argv[2], "true") == 0;
|
||||
gtk_window_set_accept_focus (GTK_WINDOW (window), enabled);
|
||||
}
|
||||
else if (strcmp (argv[0], "show") == 0)
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -406,6 +406,25 @@ test_case_do (TestCase *test,
|
||||
NULL))
|
||||
return FALSE;
|
||||
}
|
||||
else if (strcmp (argv[0], "accept_focus") == 0)
|
||||
{
|
||||
if (argc != 3 ||
|
||||
(g_ascii_strcasecmp (argv[2], "true") != 0 &&
|
||||
g_ascii_strcasecmp (argv[2], "false") != 0))
|
||||
BAD_COMMAND("usage: %s <client-id>/<window-id> [true|false]",
|
||||
argv[0]);
|
||||
|
||||
TestClient *client;
|
||||
const char *window_id;
|
||||
if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
|
||||
return FALSE;
|
||||
|
||||
if (!test_client_do (client, error,
|
||||
argv[0], window_id,
|
||||
argv[2],
|
||||
NULL))
|
||||
return FALSE;
|
||||
}
|
||||
else if (strcmp (argv[0], "show") == 0 ||
|
||||
strcmp (argv[0], "hide") == 0 ||
|
||||
strcmp (argv[0], "activate") == 0 ||
|
||||
|
Loading…
Reference in New Issue
Block a user