[mutter/wip/wayland-display: 40/62] wayland: start XWayland in the background



commit 912d317dc2a3c0a2ce68740dcfe89fb0ae0399ea
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 89124ad..9119284 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1275,7 +1275,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);
 
@@ -1284,6 +1284,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
@@ -1394,7 +1398,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]