Add client freeze extension to _NET_WM_STATE Atom, allowing flag to

persist. As usual with new Atoms, requires X restart.
This commit is contained in:
okan 2015-08-21 16:30:02 +00:00
parent 05478f061e
commit 1d31f9000c
4 changed files with 14 additions and 2 deletions

View File

@ -364,7 +364,8 @@ enum {
_NET_WM_DESKTOP,
_NET_CLOSE_WINDOW,
_NET_WM_STATE,
#define _NET_WM_STATES_NITEMS 6
#define _NET_WM_STATES_NITEMS 7
_CWM_WM_STATE_FREEZE,
_NET_WM_STATE_STICKY,
_NET_WM_STATE_MAXIMIZED_VERT,
_NET_WM_STATE_MAXIMIZED_HORZ,

View File

@ -237,6 +237,8 @@ client_toggle_freeze(struct client_ctx *cc)
cc->flags &= ~CLIENT_FREEZE;
else
cc->flags |= CLIENT_FREEZE;
xu_ewmh_set_net_wm_state(cc);
}
void

1
conf.c
View File

@ -680,6 +680,7 @@ static char *ewmhints[] = {
"_NET_WM_DESKTOP",
"_NET_CLOSE_WINDOW",
"_NET_WM_STATE",
"_CWM_WM_STATE_FREEZE",
"_NET_WM_STATE_STICKY",
"_NET_WM_STATE_MAXIMIZED_VERT",
"_NET_WM_STATE_MAXIMIZED_HORZ",

10
xutil.c
View File

@ -374,6 +374,9 @@ xu_ewmh_handle_net_wm_state_msg(struct client_ctx *cc, int action,
int property;
void (*toggle)(struct client_ctx *);
} handlers[] = {
{ _CWM_WM_STATE_FREEZE,
CLIENT_FREEZE,
client_toggle_freeze },
{ _NET_WM_STATE_STICKY,
CLIENT_STICKY,
client_toggle_sticky },
@ -421,6 +424,8 @@ xu_ewmh_restore_net_wm_state(struct client_ctx *cc)
atoms = xu_ewmh_get_net_wm_state(cc, &n);
for (i = 0; i < n; i++) {
if (atoms[i] == ewmh[_CWM_WM_STATE_FREEZE])
client_toggle_freeze(cc);
if (atoms[i] == ewmh[_NET_WM_STATE_STICKY])
client_toggle_sticky(cc);
if (atoms[i] == ewmh[_NET_WM_STATE_MAXIMIZED_HORZ])
@ -446,7 +451,8 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
oatoms = xu_ewmh_get_net_wm_state(cc, &n);
atoms = xreallocarray(NULL, (n + _NET_WM_STATES_NITEMS), sizeof(Atom));
for (i = j = 0; i < n; i++) {
if (oatoms[i] != ewmh[_NET_WM_STATE_STICKY] &&
if (oatoms[i] != ewmh[_CWM_WM_STATE_FREEZE] &&
oatoms[i] != ewmh[_NET_WM_STATE_STICKY] &&
oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] &&
oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_VERT] &&
oatoms[i] != ewmh[_NET_WM_STATE_HIDDEN] &&
@ -455,6 +461,8 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
atoms[j++] = oatoms[i];
}
free(oatoms);
if (cc->flags & CLIENT_FREEZE)
atoms[j++] = ewmh[_CWM_WM_STATE_FREEZE];
if (cc->flags & CLIENT_STICKY)
atoms[j++] = ewmh[_NET_WM_STATE_STICKY];
if (cc->flags & CLIENT_HIDDEN)