diff options
author | emersion <contact@emersion.fr> | 2017-09-29 23:03:01 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-09-29 23:03:01 +0200 |
commit | 5002d968f303f6e678cbe87cc034b14d8f8b3ce8 (patch) | |
tree | 049a2f4ff12e6e7e37efa49a0db2bba0ba1b2dd5 /xwayland | |
parent | b78ae541583533dbcfbca2035c09dcd1e6c1b1bd (diff) |
xwayland: add window_type support
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 35 | ||||
-rw-r--r-- | xwayland/xwm.h | 1 |
2 files changed, 32 insertions, 4 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 45c4b095..a84b19a5 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -18,6 +18,7 @@ const char *atom_map[ATOM_LAST] = { "_NET_WM_PID", "_NET_WM_NAME", "_NET_WM_STATE", + "_NET_WM_WINDOW_TYPE", "WM_TAKE_FOCUS", }; @@ -68,6 +69,8 @@ static struct wlr_xwayland_surface *wlr_xwayland_surface_create( wl_signal_init(&surface->events.set_title); wl_signal_init(&surface->events.set_parent); wl_signal_init(&surface->events.set_state); + wl_signal_init(&surface->events.set_pid); + wl_signal_init(&surface->events.set_window_type); return surface; } @@ -78,6 +81,7 @@ static void wlr_xwayland_surface_destroy(struct wlr_xwayland_surface *surface) { free(surface->state->items[i]); } list_free(surface->state); + free(surface->window_type); free(surface); } @@ -211,9 +215,32 @@ static void read_surface_pid(struct wlr_xwm *xwm, return; } - pid_t *pid = (pid_t *)xcb_get_property_value(reply); + pid_t *pid = xcb_get_property_value(reply); surface->pid = *pid; wlr_log(L_DEBUG, "NET_WM_PID %d", surface->pid); + wl_signal_emit(&surface->events.set_pid, surface); +} + +static void read_surface_window_type(struct wlr_xwm *xwm, + struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) { + if (reply->type != XCB_ATOM_ATOM) { + return; + } + + xcb_atom_t *atoms = xcb_get_property_value(reply); + size_t atoms_len = reply->value_len; + size_t atoms_size = sizeof(xcb_atom_t) * atoms_len; + + free(surface->window_type); + surface->window_type = malloc(atoms_size); + if (surface->window_type == NULL) { + return; + } + memcpy(surface->window_type, atoms, atoms_size); + surface->window_type_len = atoms_len; + + wlr_log(L_DEBUG, "NET_WM_WINDOW_TYPE (%zu)", atoms_len); + wl_signal_emit(&surface->events.set_window_type, surface); } static void read_surface_property(struct wlr_xwm *xwm, @@ -235,6 +262,8 @@ static void read_surface_property(struct wlr_xwm *xwm, 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_WINDOW_TYPE]) { + read_surface_window_type(xwm, surface, reply); } else if (property == xwm->atoms[NET_WM_STATE]) { read_surface_state(xwm, surface, reply); } else { @@ -256,12 +285,10 @@ static void map_shell_surface(struct wlr_xwm *xwm, XCB_ATOM_WM_NAME, XCB_ATOM_WM_TRANSIENT_FOR, //xwm->atoms[WM_PROTOCOLS], - //xwm->atoms[WM_NORMAL_HINTS], xwm->atoms[NET_WM_STATE], - //xwm->atoms[NET_WM_WINDOW_TYPE], + xwm->atoms[NET_WM_WINDOW_TYPE], xwm->atoms[NET_WM_NAME], xwm->atoms[NET_WM_PID], - //xwm->atoms[MOTIF_WM_HINTS], }; for (size_t i = 0; i < sizeof(props)/sizeof(xcb_atom_t); i++) { read_surface_property(xwm, xwayland_surface, props[i]); diff --git a/xwayland/xwm.h b/xwayland/xwm.h index b7644107..0d753832 100644 --- a/xwayland/xwm.h +++ b/xwayland/xwm.h @@ -55,6 +55,7 @@ enum atom_name { NET_WM_PID, NET_WM_NAME, NET_WM_STATE, + NET_WM_WINDOW_TYPE, WM_TAKE_FOCUS, ATOM_LAST, }; |