tests/wayland: Move out window finder helper to helper file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
This commit is contained in:
parent
91c40a47b3
commit
9856dac593
3 changed files with 25 additions and 14 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "core/display-private.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
|
||||
struct _MetaWaylandTestClient
|
||||
|
@ -114,3 +115,23 @@ meta_wayland_test_client_finish (MetaWaylandTestClient *wayland_test_client)
|
|||
g_object_unref (wayland_test_client->subprocess);
|
||||
g_free (wayland_test_client);
|
||||
}
|
||||
|
||||
MetaWindow *
|
||||
meta_find_client_window (MetaContext *context,
|
||||
const char *title)
|
||||
{
|
||||
MetaDisplay *display = meta_context_get_display (context);
|
||||
g_autoptr (GSList) windows = NULL;
|
||||
GSList *l;
|
||||
|
||||
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
||||
for (l = windows; l; l = l->next)
|
||||
{
|
||||
MetaWindow *window = l->data;
|
||||
|
||||
if (g_strcmp0 (meta_window_get_title (window), title) == 0)
|
||||
return window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -27,4 +27,7 @@ MetaWaylandTestClient * meta_wayland_test_client_new (MetaContext *context,
|
|||
|
||||
void meta_wayland_test_client_finish (MetaWaylandTestClient *wayland_test_client);
|
||||
|
||||
MetaWindow * meta_find_client_window (MetaContext *context,
|
||||
const char *title);
|
||||
|
||||
#endif /* META_WAYLAND_TEST_UTILS_H */
|
||||
|
|
|
@ -44,20 +44,7 @@ static ClutterVirtualInputDevice *virtual_pointer;
|
|||
static MetaWindow *
|
||||
find_client_window (const char *title)
|
||||
{
|
||||
MetaDisplay *display = meta_context_get_display (test_context);
|
||||
g_autoptr (GSList) windows = NULL;
|
||||
GSList *l;
|
||||
|
||||
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
||||
for (l = windows; l; l = l->next)
|
||||
{
|
||||
MetaWindow *window = l->data;
|
||||
|
||||
if (g_strcmp0 (meta_window_get_title (window), title) == 0)
|
||||
return window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return meta_find_client_window (test_context, title);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue