diff options
author | okan | 2013-05-21 00:29:20 +0000 |
---|---|---|
committer | okan | 2013-05-21 00:29:20 +0000 |
commit | 976a0161becef40cda31090ffd17a12442905b0c (patch) | |
tree | 4147904636ec18f7e13e8408b7c9546c952f2043 /xutil.c | |
parent | 11ee162b7549c7340e9e3514589488aa6abb24cc (diff) | |
download | cwm-976a0161becef40cda31090ffd17a12442905b0c.tar.gz |
handle _NET_WM_STATE ClientMessage; from Alexander Polakov.
Diffstat (limited to 'xutil.c')
-rw-r--r-- | xutil.c | 39 |
1 files changed, 38 insertions, 1 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xutil.c,v 1.65 2013/05/20 21:13:58 okan Exp $ + * $OpenBSD: xutil.c,v 1.66 2013/05/21 00:29:20 okan Exp $ */ #include <sys/param.h> @@ -440,6 +440,43 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n) } void +xu_ewmh_handle_net_wm_state_msg(struct client_ctx *cc, int action, + Atom first, Atom second) +{ + int i; + static struct handlers { + int atom; + int property; + void (*toggle)(struct client_ctx *); + } handlers[] = { + { _NET_WM_STATE_MAXIMIZED_VERT, + CLIENT_VMAXIMIZED, + client_vmaximize }, + { _NET_WM_STATE_MAXIMIZED_HORZ, + CLIENT_HMAXIMIZED, + client_hmaximize }, + }; + + for (i = 0; i < nitems(handlers); i++) { + if (first != ewmh[handlers[i].atom].atom && + second != ewmh[handlers[i].atom].atom) + continue; + switch (action) { + case _NET_WM_STATE_ADD: + if ((cc->flags & handlers[i].property) == 0) + handlers[i].toggle(cc); + break; + case _NET_WM_STATE_REMOVE: + if (cc->flags & handlers[i].property) + handlers[i].toggle(cc); + break; + case _NET_WM_STATE_TOGGLE: + handlers[i].toggle(cc); + } + } +} + +void xu_ewmh_restore_net_wm_state(struct client_ctx *cc) { Atom *atoms; |