aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r--xwayland/xwm.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 478666eb..45c4b095 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -15,6 +15,7 @@ const char *atom_map[ATOM_LAST] = {
"WM_S0",
"_NET_SUPPORTED",
"_NET_WM_S0",
+ "_NET_WM_PID",
"_NET_WM_NAME",
"_NET_WM_STATE",
"WM_TAKE_FOCUS",
@@ -199,13 +200,22 @@ static void handle_surface_state(struct wlr_xwm *xwm,
static void read_surface_state(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
- if (reply->type != XCB_ATOM_ATOM) { // TODO: check that
- return;
- }
+ // reply->type == XCB_ATOM_ANY
handle_surface_state(xwm, surface, xcb_get_property_value(reply),
reply->value_len, NET_WM_STATE_ADD);
}
+static void read_surface_pid(struct wlr_xwm *xwm,
+ struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
+ if (reply->type != XCB_ATOM_CARDINAL) {
+ return;
+ }
+
+ pid_t *pid = (pid_t *)xcb_get_property_value(reply);
+ surface->pid = *pid;
+ wlr_log(L_DEBUG, "NET_WM_PID %d", surface->pid);
+}
+
static void read_surface_property(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *surface, xcb_atom_t property) {
xcb_get_property_cookie_t cookie = xcb_get_property(xwm->xcb_conn, 0,
@@ -223,6 +233,8 @@ static void read_surface_property(struct wlr_xwm *xwm,
read_surface_title(xwm, surface, reply);
} else if (property == XCB_ATOM_WM_TRANSIENT_FOR) {
read_surface_parent(xwm, surface, reply);
+ } else if (property == xwm->atoms[NET_WM_PID]) {
+ read_surface_pid(xwm, surface, reply);
} else if (property == xwm->atoms[NET_WM_STATE]) {
read_surface_state(xwm, surface, reply);
} else {
@@ -248,7 +260,7 @@ static void map_shell_surface(struct wlr_xwm *xwm,
xwm->atoms[NET_WM_STATE],
//xwm->atoms[NET_WM_WINDOW_TYPE],
xwm->atoms[NET_WM_NAME],
- //xwm->atoms[NET_WM_PID],
+ xwm->atoms[NET_WM_PID],
//xwm->atoms[MOTIF_WM_HINTS],
};
for (size_t i = 0; i < sizeof(props)/sizeof(xcb_atom_t); i++) {