[mutter/wip/carlosg/xwayland-on-demand: 13/28] x11: Add meta_x11_get_display_name() function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 13/28] x11: Add meta_x11_get_display_name() function
- Date: Fri, 26 Jul 2019 12:32:01 +0000 (UTC)
commit 47c4867ade7980477bd9713f02061283aaba2dd7
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 24 19:51:00 2019 +0200
x11: Add meta_x11_get_display_name() function
Instead of poking the DISPLAY envvar at places.
src/core/meta-launch-context.c | 2 +-
src/x11/meta-x11-display-private.h | 2 ++
src/x11/meta-x11-display.c | 21 ++++++++++++++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/core/meta-launch-context.c b/src/core/meta-launch-context.c
index 984338c1b0..8cc052452f 100644
--- a/src/core/meta-launch-context.c
+++ b/src/core/meta-launch-context.c
@@ -114,7 +114,7 @@ meta_launch_context_constructed (GObject *object)
G_OBJECT_CLASS (meta_launch_context_parent_class)->constructed (object);
- x11_display = getenv ("DISPLAY");
+ x11_display = meta_x11_get_display_name ();
wayland_display = getenv ("WAYLAND_DISPLAY");
if (x11_display)
diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h
index 3f545ce283..1b38e3c30f 100644
--- a/src/x11/meta-x11-display-private.h
+++ b/src/x11/meta-x11-display-private.h
@@ -249,4 +249,6 @@ void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
Window xwindow,
guint32 timestamp);
+const gchar * meta_x11_get_display_name (void);
+
#endif /* META_X11_DISPLAY_PRIVATE_H */
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index e9428e54d6..def878d2c4 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -988,6 +988,25 @@ meta_set_gnome_wm_keybindings (const char *wm_keybindings)
gnome_wm_keybindings = wm_keybindings;
}
+const gchar *
+meta_x11_get_display_name (void)
+{
+#ifdef HAVE_WAYLAND
+ if (meta_is_wayland_compositor ())
+ {
+ MetaWaylandCompositor *compositor;
+
+ compositor = meta_wayland_compositor_get_default ();
+
+ return meta_wayland_get_xwayland_display_name (compositor);
+ }
+ else
+#endif
+ {
+ return g_getenv ("DISPLAY");
+ }
+}
+
gboolean
meta_x11_init_gdk_display (GError **error)
{
@@ -996,7 +1015,7 @@ meta_x11_init_gdk_display (GError **error)
const char *gdk_gl_env = NULL;
Display *xdisplay;
- xdisplay_name = g_getenv ("DISPLAY");
+ xdisplay_name = meta_x11_get_display_name ();
if (!xdisplay_name)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]