[mutter/wip/wayland-work: 18/44] MetaWayland: install an X io error handler
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 18/44] MetaWayland: install an X io error handler
- Date: Tue, 27 Aug 2013 08:17:35 +0000 (UTC)
commit 62c8599260669646e32578390fee89560d78c097
Author: Giovanni Campagna <gcampagn redhat com>
Date: Mon Aug 12 15:31:18 2013 +0200
MetaWayland: install an X io error handler
This way can detect X disconnections correctly, crash with a core
dump and reset the tty.
src/core/display.c | 5 +++++
src/wayland/meta-xwayland-private.h | 3 +++
src/wayland/meta-xwayland.c | 20 ++++++++++++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index c0d42d8..d62e429 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -75,6 +75,8 @@
#include <string.h>
#include <unistd.h>
+#include "meta-xwayland-private.h"
+
#define GRAB_OP_IS_WINDOW_SWITCH(g) \
(g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || \
g == META_GRAB_OP_KEYBOARD_TABBING_DOCK || \
@@ -516,6 +518,9 @@ meta_display_open (void)
return FALSE;
}
+ if (meta_is_wayland_compositor ())
+ meta_xwayland_complete_init ();
+
if (meta_is_syncing ())
XSynchronize (xdisplay, True);
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
index 0d6716b..d115510 100644
--- a/src/wayland/meta-xwayland-private.h
+++ b/src/wayland/meta-xwayland-private.h
@@ -28,6 +28,9 @@ gboolean
meta_xwayland_start (MetaWaylandCompositor *compositor);
void
+meta_xwayland_complete_init (void);
+
+void
meta_xwayland_stop (MetaWaylandCompositor *compositor);
#endif /* META_XWAYLAND_PRIVATE_H */
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index d78b199..3b3c699 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -301,6 +301,14 @@ xserver_died (GPid pid,
}
}
+static int
+x_io_error (Display *display)
+{
+ g_error ("Connection to xwayland lost");
+
+ return 0;
+}
+
gboolean
meta_xwayland_start (MetaWaylandCompositor *compositor)
{
@@ -425,6 +433,18 @@ meta_xwayland_start (MetaWaylandCompositor *compositor)
return TRUE;
}
+/* To be called right after connecting */
+void
+meta_xwayland_complete_init (void)
+{
+ /* We install an X IO error handler in addition to the child watch,
+ because after Xlib connects our child watch may not be called soon
+ enough, and therefore we won't crash when X exits (and most important
+ we won't reset the tty).
+ */
+ XSetIOErrorHandler (x_io_error);
+}
+
void
meta_xwayland_stop (MetaWaylandCompositor *compositor)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]