All the surfaces from X all the clients share the same wl_client so
wl_client_get_credentials can't be used to get the pid of the X
clients.
The shell may need to know the pid to be able to associate a surface
with e.g. a DBus service.
---
 src/compositor.h          | 1 +
 xwayland/window-manager.c | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/compositor.h b/src/compositor.h
index 900d2a5..3b1e490 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -121,6 +121,7 @@ struct weston_shell_interface {
        void (*set_window_geometry)(struct shell_surface *shsurf,
                                    int32_t x, int32_t y,
                                    int32_t width, int32_t height);
+       void (*set_pid)(struct shell_surface *shsurf, pid_t pid);
 };
 
 struct weston_animation {
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index f362eac..c42fc83 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -401,6 +401,7 @@ weston_wm_window_read_properties(struct weston_wm_window 
*window)
        uint32_t *xid;
        xcb_atom_t *atom;
        uint32_t i;
+       char name[1024];
 
        if (!window->properties_dirty)
                return;
@@ -487,10 +488,16 @@ weston_wm_window_read_properties(struct weston_wm_window 
*window)
                free(reply);
        }
 
+       gethostname(name, 1024);
+       if (strcmp(window->machine, name))
+               window->pid = 0;
+
        if (window->shsurf && window->name)
                shell_interface->set_title(window->shsurf, window->name);
        if (window->frame && window->name)
                frame_set_title(window->frame, window->name);
+       if (window->pid > 0)
+               shell_interface->set_pid(window->shsurf, window->pid);
 }
 
 static void
@@ -2350,6 +2357,8 @@ xserver_map_shell_surface(struct weston_wm_window *window,
 
        if (window->name)
                shell_interface->set_title(window->shsurf, window->name);
+       if (window->pid > 0)
+               shell_interface->set_pid(window->shsurf, window->pid);
 
        if (window->fullscreen) {
                window->saved_width = window->width;
-- 
2.2.1

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to