mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
handle _NET_WM_STATE ClientMessage; from Alexander Polakov.
This commit is contained in:
37
xutil.c
37
xutil.c
@ -439,6 +439,43 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n)
|
||||
return (state);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user