mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Implement EWMH _NET_WM_STATE_HIDDEN.
This commit is contained in:
parent
74f4a1bad9
commit
a61812d52d
4
calmwm.h
4
calmwm.h
@ -344,10 +344,11 @@ enum {
|
|||||||
_NET_WM_DESKTOP,
|
_NET_WM_DESKTOP,
|
||||||
_NET_CLOSE_WINDOW,
|
_NET_CLOSE_WINDOW,
|
||||||
_NET_WM_STATE,
|
_NET_WM_STATE,
|
||||||
#define _NET_WM_STATES_NITEMS 5
|
#define _NET_WM_STATES_NITEMS 6
|
||||||
_NET_WM_STATE_STICKY,
|
_NET_WM_STATE_STICKY,
|
||||||
_NET_WM_STATE_MAXIMIZED_VERT,
|
_NET_WM_STATE_MAXIMIZED_VERT,
|
||||||
_NET_WM_STATE_MAXIMIZED_HORZ,
|
_NET_WM_STATE_MAXIMIZED_HORZ,
|
||||||
|
_NET_WM_STATE_HIDDEN,
|
||||||
_NET_WM_STATE_FULLSCREEN,
|
_NET_WM_STATE_FULLSCREEN,
|
||||||
_NET_WM_STATE_DEMANDS_ATTENTION,
|
_NET_WM_STATE_DEMANDS_ATTENTION,
|
||||||
EWMH_NITEMS
|
EWMH_NITEMS
|
||||||
@ -374,6 +375,7 @@ void client_freeze(struct client_ctx *);
|
|||||||
void client_fullscreen(struct client_ctx *);
|
void client_fullscreen(struct client_ctx *);
|
||||||
long client_get_wm_state(struct client_ctx *);
|
long client_get_wm_state(struct client_ctx *);
|
||||||
void client_getsizehints(struct client_ctx *);
|
void client_getsizehints(struct client_ctx *);
|
||||||
|
void client_hidden(struct client_ctx *);
|
||||||
void client_hide(struct client_ctx *);
|
void client_hide(struct client_ctx *);
|
||||||
void client_hmaximize(struct client_ctx *);
|
void client_hmaximize(struct client_ctx *);
|
||||||
void client_htile(struct client_ctx *);
|
void client_htile(struct client_ctx *);
|
||||||
|
15
client.c
15
client.c
@ -239,6 +239,17 @@ client_freeze(struct client_ctx *cc)
|
|||||||
cc->flags |= CLIENT_FREEZE;
|
cc->flags |= CLIENT_FREEZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
client_hidden(struct client_ctx *cc)
|
||||||
|
{
|
||||||
|
if (cc->flags & CLIENT_HIDDEN)
|
||||||
|
cc->flags &= ~CLIENT_HIDDEN;
|
||||||
|
else
|
||||||
|
cc->flags |= CLIENT_HIDDEN;
|
||||||
|
|
||||||
|
xu_ewmh_set_net_wm_state(cc);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
client_sticky(struct client_ctx *cc)
|
client_sticky(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
@ -486,7 +497,7 @@ client_hide(struct client_ctx *cc)
|
|||||||
XUnmapWindow(X_Dpy, cc->win);
|
XUnmapWindow(X_Dpy, cc->win);
|
||||||
|
|
||||||
cc->flags &= ~CLIENT_ACTIVE;
|
cc->flags &= ~CLIENT_ACTIVE;
|
||||||
cc->flags |= CLIENT_HIDDEN;
|
client_hidden(cc);
|
||||||
client_set_wm_state(cc, IconicState);
|
client_set_wm_state(cc, IconicState);
|
||||||
|
|
||||||
if (cc == client_current())
|
if (cc == client_current())
|
||||||
@ -501,7 +512,7 @@ client_unhide(struct client_ctx *cc)
|
|||||||
|
|
||||||
XMapRaised(X_Dpy, cc->win);
|
XMapRaised(X_Dpy, cc->win);
|
||||||
|
|
||||||
cc->flags &= ~CLIENT_HIDDEN;
|
client_hidden(cc);
|
||||||
client_set_wm_state(cc, NormalState);
|
client_set_wm_state(cc, NormalState);
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
}
|
}
|
||||||
|
1
conf.c
1
conf.c
@ -675,6 +675,7 @@ static char *ewmhints[] = {
|
|||||||
"_NET_WM_STATE_STICKY",
|
"_NET_WM_STATE_STICKY",
|
||||||
"_NET_WM_STATE_MAXIMIZED_VERT",
|
"_NET_WM_STATE_MAXIMIZED_VERT",
|
||||||
"_NET_WM_STATE_MAXIMIZED_HORZ",
|
"_NET_WM_STATE_MAXIMIZED_HORZ",
|
||||||
|
"_NET_WM_STATE_HIDDEN",
|
||||||
"_NET_WM_STATE_FULLSCREEN",
|
"_NET_WM_STATE_FULLSCREEN",
|
||||||
"_NET_WM_STATE_DEMANDS_ATTENTION",
|
"_NET_WM_STATE_DEMANDS_ATTENTION",
|
||||||
};
|
};
|
||||||
|
12
xutil.c
12
xutil.c
@ -379,6 +379,9 @@ xu_ewmh_handle_net_wm_state_msg(struct client_ctx *cc, int action,
|
|||||||
{ _NET_WM_STATE_MAXIMIZED_HORZ,
|
{ _NET_WM_STATE_MAXIMIZED_HORZ,
|
||||||
CLIENT_HMAXIMIZED,
|
CLIENT_HMAXIMIZED,
|
||||||
client_hmaximize },
|
client_hmaximize },
|
||||||
|
{ _NET_WM_STATE_HIDDEN,
|
||||||
|
CLIENT_HIDDEN,
|
||||||
|
client_hidden },
|
||||||
{ _NET_WM_STATE_FULLSCREEN,
|
{ _NET_WM_STATE_FULLSCREEN,
|
||||||
CLIENT_FULLSCREEN,
|
CLIENT_FULLSCREEN,
|
||||||
client_fullscreen },
|
client_fullscreen },
|
||||||
@ -420,6 +423,8 @@ xu_ewmh_restore_net_wm_state(struct client_ctx *cc)
|
|||||||
client_hmaximize(cc);
|
client_hmaximize(cc);
|
||||||
if (atoms[i] == ewmh[_NET_WM_STATE_MAXIMIZED_VERT])
|
if (atoms[i] == ewmh[_NET_WM_STATE_MAXIMIZED_VERT])
|
||||||
client_vmaximize(cc);
|
client_vmaximize(cc);
|
||||||
|
if (atoms[i] == ewmh[_NET_WM_STATE_HIDDEN])
|
||||||
|
client_hidden(cc);
|
||||||
if (atoms[i] == ewmh[_NET_WM_STATE_FULLSCREEN])
|
if (atoms[i] == ewmh[_NET_WM_STATE_FULLSCREEN])
|
||||||
client_fullscreen(cc);
|
client_fullscreen(cc);
|
||||||
if (atoms[i] == ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
|
if (atoms[i] == ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
|
||||||
@ -437,16 +442,19 @@ xu_ewmh_set_net_wm_state(struct client_ctx *cc)
|
|||||||
oatoms = xu_ewmh_get_net_wm_state(cc, &n);
|
oatoms = xu_ewmh_get_net_wm_state(cc, &n);
|
||||||
atoms = xcalloc((n + _NET_WM_STATES_NITEMS), sizeof(Atom));
|
atoms = xcalloc((n + _NET_WM_STATES_NITEMS), sizeof(Atom));
|
||||||
for (i = j = 0; i < n; i++) {
|
for (i = j = 0; i < n; i++) {
|
||||||
if (oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] &&
|
if (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_MAXIMIZED_VERT] &&
|
||||||
|
oatoms[i] != ewmh[_NET_WM_STATE_HIDDEN] &&
|
||||||
oatoms[i] != ewmh[_NET_WM_STATE_FULLSCREEN] &&
|
oatoms[i] != ewmh[_NET_WM_STATE_FULLSCREEN] &&
|
||||||
oatoms[i] != ewmh[_NET_WM_STATE_STICKY] &&
|
|
||||||
oatoms[i] != ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
|
oatoms[i] != ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
|
||||||
atoms[j++] = oatoms[i];
|
atoms[j++] = oatoms[i];
|
||||||
}
|
}
|
||||||
free(oatoms);
|
free(oatoms);
|
||||||
if (cc->flags & CLIENT_STICKY)
|
if (cc->flags & CLIENT_STICKY)
|
||||||
atoms[j++] = ewmh[_NET_WM_STATE_STICKY];
|
atoms[j++] = ewmh[_NET_WM_STATE_STICKY];
|
||||||
|
if (cc->flags & CLIENT_HIDDEN)
|
||||||
|
atoms[j++] = ewmh[_NET_WM_STATE_HIDDEN];
|
||||||
if (cc->flags & CLIENT_FULLSCREEN)
|
if (cc->flags & CLIENT_FULLSCREEN)
|
||||||
atoms[j++] = ewmh[_NET_WM_STATE_FULLSCREEN];
|
atoms[j++] = ewmh[_NET_WM_STATE_FULLSCREEN];
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user