[mutter] wayland: Add API to override display name
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Add API to override display name
- Date: Wed, 25 Jan 2017 08:33:04 +0000 (UTC)
commit 239671f88207ea86b03049b4a60b4976d914b6ee
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Dec 5 21:23:46 2016 +0800
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
src/wayland/meta-wayland.c | 27 ++++++++++++++++++++++++---
src/wayland/meta-wayland.h | 2 ++
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index e153b24..03cccdb 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -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)
@@ -308,6 +309,12 @@ meta_wayland_pre_clutter_init (void)
}
void
+meta_wayland_override_display_name (char *display_name)
+{
+ _display_name_override = g_strdup (display_name);
+}
+
+void
meta_wayland_init (void)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
@@ -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));
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index 7db5ca1..af8b086 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]