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.
This commit is contained in:
Jasper St. Pierre 2014-04-02 10:25:56 -04:00
parent 4f609dbf5e
commit 43730f1660

View File

@ -26,9 +26,11 @@
#include "meta-xwayland-private.h" #include "meta-xwayland-private.h"
#include <glib.h> #include <glib.h>
#include <glib-unix.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <signal.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -37,9 +39,6 @@
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"
#include "xserver-server-protocol.h" #include "xserver-server-protocol.h"
static void
xserver_finished_init (MetaXWaylandManager *manager);
static void static void
associate_window_with_surface (MetaWindow *window, associate_window_with_surface (MetaWindow *window,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
@ -106,8 +105,6 @@ bind_xserver (struct wl_client *client,
* then going to immediately try and connect to those as the window * then going to immediately try and connect to those as the window
* manager. */ * manager. */
wl_client_flush (client); wl_client_flush (client);
xserver_finished_init (manager);
} }
static char * static char *
@ -346,6 +343,16 @@ xserver_finished_init (MetaXWaylandManager *manager)
g_clear_pointer (&manager->init_loop, g_main_loop_unref); 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 gboolean
meta_xwayland_start (MetaXWaylandManager *manager, meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *wl_display) struct wl_display *wl_display)
@ -390,6 +397,10 @@ meta_xwayland_start (MetaXWaylandManager *manager,
dup2 (dev_null, STDERR_FILENO); 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, if (execl (XWAYLAND_PATH, XWAYLAND_PATH,
manager->display_name, manager->display_name,
"-wayland", "-wayland",
@ -407,6 +418,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
} }
g_child_watch_add (manager->pid, xserver_died, NULL); 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]); manager->client = wl_client_create (wl_display, sp[0]);
/* We need to run a mainloop until we know xwayland has a binding /* We need to run a mainloop until we know xwayland has a binding