mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
wayland: Add API to override display name
Add API that the tests can use in order to override the Wayland display name. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
12150c1ca7
commit
239671f882
@ -43,6 +43,7 @@
|
||||
#include "meta-wayland-xdg-foreign.h"
|
||||
|
||||
static MetaWaylandCompositor _meta_wayland_compositor;
|
||||
static char *_display_name_override;
|
||||
|
||||
MetaWaylandCompositor *
|
||||
meta_wayland_compositor_get_default (void)
|
||||
@ -307,6 +308,12 @@ meta_wayland_pre_clutter_init (void)
|
||||
clutter_wayland_set_compositor_display (compositor->wayland_display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_override_display_name (char *display_name)
|
||||
{
|
||||
_display_name_override = g_strdup (display_name);
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_init (void)
|
||||
{
|
||||
@ -345,9 +352,23 @@ meta_wayland_init (void)
|
||||
if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
|
||||
g_error ("Failed to start X Wayland");
|
||||
|
||||
compositor->display_name = wl_display_add_socket_auto (compositor->wayland_display);
|
||||
if (compositor->display_name == NULL)
|
||||
g_error ("Failed to create socket");
|
||||
if (_display_name_override)
|
||||
{
|
||||
compositor->display_name = _display_name_override;
|
||||
|
||||
if (wl_display_add_socket (compositor->wayland_display,
|
||||
_display_name_override) != 0)
|
||||
g_error ("Failed to create_socket");
|
||||
|
||||
g_clear_pointer (&_display_name_override, g_free);
|
||||
}
|
||||
else
|
||||
{
|
||||
compositor->display_name =
|
||||
wl_display_add_socket_auto (compositor->wayland_display);
|
||||
if (compositor->display_name == NULL)
|
||||
g_error ("Failed to create socket");
|
||||
}
|
||||
|
||||
set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
|
||||
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <meta/types.h>
|
||||
#include "meta-wayland-types.h"
|
||||
|
||||
void meta_wayland_override_display_name (char *display_name);
|
||||
|
||||
void meta_wayland_pre_clutter_init (void);
|
||||
void meta_wayland_init (void);
|
||||
void meta_wayland_finalize (void);
|
||||
|
Loading…
Reference in New Issue
Block a user