[mutter/wip/wayland-work: 7/22] Set DISPLAY and WAYLAND_DISPLAY for dbus activated services and for autostarted apps
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 7/22] Set DISPLAY and WAYLAND_DISPLAY for dbus activated services and for autostarted apps
- Date: Mon, 9 Sep 2013 13:41:11 +0000 (UTC)
commit 68ba49c614149888c3447e3d7d32e1e3e5d6d2f7
Author: Giovanni Campagna <gcampagn redhat com>
Date: Tue Aug 20 18:03:26 2013 +0200
Set DISPLAY and WAYLAND_DISPLAY for dbus activated services and for autostarted apps
Call the appropriate method on gnome-session so that autostarted
and bus activated apps see the X server and wayland socket.
https://bugzilla.gnome.org/show_bug.cgi?id=706421
src/wayland/meta-wayland.c | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 5c416ae..75b9122 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -800,6 +800,35 @@ on_monitors_changed (MetaMonitorManager *monitors,
compositor->outputs = meta_wayland_compositor_update_outputs (compositor, monitors);
}
+static void
+set_gnome_env (const char *name,
+ const char *value)
+{
+ GDBusConnection *session_bus;
+ GError *error;
+
+ setenv (name, value, TRUE);
+
+ session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ g_assert (session_bus);
+
+ error = NULL;
+ g_dbus_connection_call_sync (session_bus,
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager",
+ "org.gnome.SessionManager",
+ "Setenv",
+ g_variant_new ("(ss)", name, value),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+ if (error)
+ {
+ meta_warning ("Failed to set environment variable %s for gnome-session: %s\n", name, error->message);
+ g_clear_error (&error);
+ }
+}
+
void
meta_wayland_init (void)
{
@@ -809,6 +838,7 @@ meta_wayland_init (void)
ClutterBackend *backend;
CoglContext *cogl_context;
CoglRenderer *cogl_renderer;
+ char *display_name;
memset (compositor, 0, sizeof (MetaWaylandCompositor));
@@ -926,7 +956,11 @@ meta_wayland_init (void)
if (!meta_xwayland_start (compositor))
g_error ("Failed to start X Wayland");
- putenv (g_strdup_printf ("DISPLAY=:%d", compositor->xwayland_display_index));
+ display_name = g_strdup_printf (":%d", compositor->xwayland_display_index);
+ set_gnome_env ("DISPLAY", display_name);
+ g_free (display_name);
+
+ set_gnome_env ("WAYLAND_DISPLAY", "wayland-0");
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]