diff options
author | emersion <contact@emersion.fr> | 2017-09-29 22:43:14 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-09-29 22:43:14 +0200 |
commit | b78ae541583533dbcfbca2035c09dcd1e6c1b1bd (patch) | |
tree | 7a559d813019dd2386c191bf837e738264097f1d /xwayland | |
parent | 97346e7a1be87f1b98683e6f42f25a91b4813994 (diff) |
xwayland: add pid support
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 20 | ||||
-rw-r--r-- | xwayland/xwm.h | 1 |
2 files changed, 17 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++) { diff --git a/xwayland/xwm.h b/xwayland/xwm.h index 8d6b6202..b7644107 100644 --- a/xwayland/xwm.h +++ b/xwayland/xwm.h @@ -52,6 +52,7 @@ enum atom_name { WM_S0, NET_SUPPORTED, NET_WM_S0, + NET_WM_PID, NET_WM_NAME, NET_WM_STATE, WM_TAKE_FOCUS, |