mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
tests/wayland-client-utils: Add way to create display from fd
Allows for more complex connection management. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
This commit is contained in:
parent
337ade622c
commit
5d888f2df6
@ -219,17 +219,19 @@ static const struct wl_registry_listener registry_listener = {
|
||||
};
|
||||
|
||||
WaylandDisplay *
|
||||
wayland_display_new (WaylandDisplayCapabilities capabilities)
|
||||
wayland_display_new_full (WaylandDisplayCapabilities capabilities,
|
||||
struct wl_display *wayland_display)
|
||||
{
|
||||
WaylandDisplay *display;
|
||||
|
||||
g_assert_nonnull (wayland_display);
|
||||
|
||||
display = g_object_new (wayland_display_get_type (), NULL);
|
||||
|
||||
display->capabilities = capabilities;
|
||||
display->properties = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, g_free);
|
||||
display->display = wl_display_connect (NULL);
|
||||
g_assert_nonnull (display->display);
|
||||
display->display = wayland_display;
|
||||
|
||||
display->registry = wl_display_get_registry (display->display);
|
||||
wl_registry_add_listener (display->registry, ®istry_listener, display);
|
||||
@ -250,6 +252,13 @@ wayland_display_new (WaylandDisplayCapabilities capabilities)
|
||||
return display;
|
||||
}
|
||||
|
||||
WaylandDisplay *
|
||||
wayland_display_new (WaylandDisplayCapabilities capabilities)
|
||||
{
|
||||
return wayland_display_new_full (capabilities,
|
||||
wl_display_connect (NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
wayland_display_finalize (GObject *object)
|
||||
{
|
||||
|
@ -60,6 +60,9 @@ int create_anonymous_file (off_t size);
|
||||
|
||||
WaylandDisplay * wayland_display_new (WaylandDisplayCapabilities capabilities);
|
||||
|
||||
WaylandDisplay * wayland_display_new_full (WaylandDisplayCapabilities capabilities,
|
||||
struct wl_display *wayland_display);
|
||||
|
||||
WaylandSurface * wayland_surface_new (WaylandDisplay *display,
|
||||
const char *title,
|
||||
int default_width,
|
||||
|
Loading…
Reference in New Issue
Block a user