<div dir="ltr">In the case of X clients, using XKillClient instead of killing the PID would be much nicer.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 10, 2015 at 3:27 AM, Giulio Camuffo <span dir="ltr"><<a href="mailto:giuliocamuffo@gmail.com" target="_blank">giuliocamuffo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">All the surfaces from all the X clients share the same wl_client so<br>
<span class="">wl_client_get_credentials can't be used to get the pid of the X<br>
clients.<br>
The shell may need to know the pid to be able to associate a surface<br>
with e.g. a DBus service.<br>
---<br>
 src/compositor.h          |  1 +<br>
</span> xwayland/window-manager.c | 21 +++++++++++++--------<br>
 2 files changed, 14 insertions(+), 8 deletions(-)<br>
<span class=""><br>
diff --git a/src/compositor.h b/src/compositor.h<br>
index 900d2a5..3b1e490 100644<br>
--- a/src/compositor.h<br>
+++ b/src/compositor.h<br>
@@ -121,6 +121,7 @@ struct weston_shell_interface {<br>
        void (*set_window_geometry)(struct shell_surface *shsurf,<br>
                                    int32_t x, int32_t y,<br>
                                    int32_t width, int32_t height);<br>
+       void (*set_pid)(struct shell_surface *shsurf, pid_t pid);<br></span></blockquote><div><br></div><div>I don't see anywhere you fill this in?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
 };<br>
<br>
 struct weston_animation {<br>
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c<br>
</span>index f362eac..b819b04 100644<br>
<span class="">--- a/xwayland/window-manager.c<br>
+++ b/xwayland/window-manager.c<br>
@@ -401,6 +401,7 @@ weston_wm_window_read_properties(struct weston_wm_window *window)<br>
        uint32_t *xid;<br>
        xcb_atom_t *atom;<br>
        uint32_t i;<br>
+       char name[1024];<br>
<br>
        if (!window->properties_dirty)<br>
                return;<br>
</span>@@ -487,10 +488,19 @@ weston_wm_window_read_properties(struct weston_wm_window *window)<br>
                free(reply);<br>
        }<br>
<br>
+       gethostname(name, 1024);<br>
+       /* this is only one heuristic to guess the PID of a client is valid,<br>
+        * assuming it's compliant with icccm and ewmh. Non-compliants and<br>
+        * remote applications of course fail. */<br>
<span class="">+       if (strcmp(window->machine, name))<br>
+               window->pid = 0;<br>
+<br>
        if (window->shsurf && window->name)<br>
                shell_interface->set_title(window->shsurf, window->name);<br>
        if (window->frame && window->name)<br>
                frame_set_title(window->frame, window->name);<br>
</span>+       if (window->shsurf && window->pid > 0)<br>
<span class="">+               shell_interface->set_pid(window->shsurf, window->pid);<br>
 }<br>
<br>
 static void<br>
</span>@@ -651,17 +661,10 @@ weston_wm_kill_client(struct wl_listener *listener, void *data)<br>
 {<br>
        struct weston_surface *surface = data;<br>
        struct weston_wm_window *window = get_wm_window(surface);<br>
-       char name[1024];<br>
-<br>
        if (!window)<br>
                return;<br>
<br>
-       gethostname(name, 1024);<br>
-<br>
-       /* this is only one heuristic to guess the PID of a client is valid,<br>
-        * assuming it's compliant with icccm and ewmh. Non-compliants and<br>
-        * remote applications of course fail. */<br>
-       if (!strcmp(window->machine, name) && window->pid != 0)<br>
+       if (!window->pid > 0)<br></blockquote><div><br></div><div>This looks very wrong.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                kill(window->pid, SIGKILL);<br>
 }<br>
<br>
@@ -2350,6 +2353,8 @@ xserver_map_shell_surface(struct weston_wm_window *window,<br>
<div class="HOEnZb"><div class="h5"><br>
        if (window->name)<br>
                shell_interface->set_title(window->shsurf, window->name);<br>
+       if (window->pid > 0)<br>
+               shell_interface->set_pid(window->shsurf, window->pid);<br>
<br>
        if (window->fullscreen) {<br>
                window->saved_width = window->width;<br>
--<br>
2.2.1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">  Jasper<br></div>
</div></div>