[mutter/wip/wayland-display: 31/55] wayland: start XWayland in the background



commit f3c094376ebe45c0e1a9b079f57072ef2a03a6b2
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Jul 23 15:38:33 2013 +0200

    wayland: start XWayland in the background
    
    When debugging it's useful to send Ctrl+C to mutter, but we
    don't want xwayland getting that.

 src/wayland/meta-wayland.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 556eb68..3c35e8b 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1290,7 +1290,7 @@ bind_to_unix_socket (int display)
 }
 
 static void
-uncloexec (gpointer user_data)
+uncloexec_and_setpgid (gpointer user_data)
 {
   int fd = GPOINTER_TO_INT (user_data);
 
@@ -1299,6 +1299,10 @@ uncloexec (gpointer user_data)
   int flags = fcntl (fd, F_GETFD);
   if (flags != -1)
     fcntl (fd, F_SETFD, flags & ~FD_CLOEXEC);
+
+  /* Put this process in a background process group, so that Ctrl-C
+     goes to mutter only */
+  setpgid (0, 0);
 }
 
 static void
@@ -1406,7 +1410,7 @@ start_xwayland (MetaWaylandCompositor *compositor)
                     G_SPAWN_DO_NOT_REAP_CHILD |
                     G_SPAWN_STDOUT_TO_DEV_NULL |
                     G_SPAWN_STDERR_TO_DEV_NULL,
-                    uncloexec,
+                    uncloexec_and_setpgid,
                     GINT_TO_POINTER (sp[1]),
                     &pid,
                     &error))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]