diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 46421cbf41..659b9fa380 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -1555,7 +1555,6 @@ _gdk_x11_display_open (const gchar *display_name) gchar *argv[1]; XClassHint *class_hint; - gulong pid; gint ignore; gint maj, min; @@ -1726,11 +1725,15 @@ _gdk_x11_display_open (const gchar *display_name) if (gdk_sm_client_id) set_sm_client_id (display, gdk_sm_client_id); - pid = getpid (); - XChangeProperty (display_x11->xdisplay, - display_x11->leader_window, - gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"), - XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1); + if (!gdk_running_in_sandbox ()) + { + /* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */ + pid_t pid = getpid (); + XChangeProperty (display_x11->xdisplay, + display_x11->leader_window, + gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"), + XA_CARDINAL, 32, PropModeReplace, (guchar *) & pid, 1); + } /* We don't yet know a valid time. */ display_x11->user_time = 0; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index e484b58253..00a3a6d268 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -902,7 +902,6 @@ setup_toplevel_window (GdkWindow *window, XID xid = GDK_WINDOW_XID (window); GdkX11Screen *x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (parent)); XSizeHints size_hints; - long pid; Window leader_window; set_wm_protocols (window); @@ -933,12 +932,16 @@ setup_toplevel_window (GdkWindow *window, /* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME */ XSetWMProperties (xdisplay, xid, NULL, NULL, NULL, 0, NULL, NULL, NULL); - pid = getpid (); - XChangeProperty (xdisplay, xid, - gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_PID"), - XA_CARDINAL, 32, - PropModeReplace, - (guchar *)&pid, 1); + if (!gdk_running_in_sandbox ()) + { + /* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */ + pid_t pid = getpid (); + XChangeProperty (xdisplay, xid, + gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_PID"), + XA_CARDINAL, 32, + PropModeReplace, + (guchar *)&pid, 1); + } leader_window = GDK_X11_DISPLAY (x11_screen->display)->leader_window; if (!leader_window)