[mutter/wayland] xwayland: Switch to SIGUSR1 to know when the X server has finished init
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] xwayland: Switch to SIGUSR1 to know when the X server has finished init
- Date: Fri, 4 Apr 2014 04:10:32 +0000 (UTC)
commit 43730f166066f23cad315c0357dabf8100dc3d36
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Apr 2 10:25:56 2014 -0400
xwayland: Switch to SIGUSR1 to know when the X server has finished init
This is effectively the same, but since we lose the xserver.xml protocol
in the new XWayland DDX, we have to use SIGUSR1 anyway, so might as well
switch over now.
src/wayland/meta-xwayland.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 8527519..ec9f342 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -26,9 +26,11 @@
#include "meta-xwayland-private.h"
#include <glib.h>
+#include <glib-unix.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <signal.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
@@ -38,9 +40,6 @@
#include "xserver-server-protocol.h"
static void
-xserver_finished_init (MetaXWaylandManager *manager);
-
-static void
associate_window_with_surface (MetaWindow *window,
MetaWaylandSurface *surface)
{
@@ -106,8 +105,6 @@ bind_xserver (struct wl_client *client,
* then going to immediately try and connect to those as the window
* manager. */
wl_client_flush (client);
-
- xserver_finished_init (manager);
}
static char *
@@ -346,6 +343,16 @@ xserver_finished_init (MetaXWaylandManager *manager)
g_clear_pointer (&manager->init_loop, g_main_loop_unref);
}
+static gboolean
+got_sigusr1 (gpointer user_data)
+{
+ MetaXWaylandManager *manager = user_data;
+
+ xserver_finished_init (manager);
+
+ return G_SOURCE_REMOVE;
+}
+
gboolean
meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *wl_display)
@@ -390,6 +397,10 @@ meta_xwayland_start (MetaXWaylandManager *manager,
dup2 (dev_null, STDERR_FILENO);
}
+ /* We have to ignore SIGUSR1 in the child to make sure
+ * that the server will send it to mutter-wayland. */
+ signal(SIGUSR1, SIG_IGN);
+
if (execl (XWAYLAND_PATH, XWAYLAND_PATH,
manager->display_name,
"-wayland",
@@ -407,6 +418,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
}
g_child_watch_add (manager->pid, xserver_died, NULL);
+ g_unix_signal_add (SIGUSR1, got_sigusr1, manager);
manager->client = wl_client_create (wl_display, sp[0]);
/* We need to run a mainloop until we know xwayland has a binding
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]