ewmh: update window hints
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e18e83d291
commit
8a7e522ba1
33
client.c
33
client.c
|
@ -223,7 +223,7 @@ client_focus(client_t *c)
|
||||||
|
|
||||||
/* stop hiding c */
|
/* stop hiding c */
|
||||||
c->ishidden = false;
|
c->ishidden = false;
|
||||||
c->isminimized = false;
|
client_setminimized(c, false);
|
||||||
|
|
||||||
/* unban the client before focusing or it will fail */
|
/* unban the client before focusing or it will fail */
|
||||||
client_unban(c);
|
client_unban(c);
|
||||||
|
@ -413,7 +413,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
screen_client_moveto(c, screen, false, true);
|
screen_client_moveto(c, screen, false, true);
|
||||||
|
|
||||||
/* Then check clients hints */
|
/* Then check clients hints */
|
||||||
ewmh_check_client_hints(c);
|
ewmh_client_check_hints(c);
|
||||||
|
|
||||||
/* Check if client has been tagged by loading props, or maybe with its
|
/* Check if client has been tagged by loading props, or maybe with its
|
||||||
* hints.
|
* hints.
|
||||||
|
@ -622,6 +622,22 @@ client_setfloating(client_t *c, bool floating)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set a client minimized, or not.
|
||||||
|
* \param c The client.
|
||||||
|
* \param s Set or not the client minimized.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
client_setminimized(client_t *c, bool s)
|
||||||
|
{
|
||||||
|
if(c->isminimized != s)
|
||||||
|
{
|
||||||
|
client_need_arrange(c);
|
||||||
|
c->isminimized = s;
|
||||||
|
client_need_arrange(c);
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Set a client sticky, or not.
|
/** Set a client sticky, or not.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \param s Set or not the client sticky.
|
* \param s Set or not the client sticky.
|
||||||
|
@ -634,6 +650,7 @@ client_setsticky(client_t *c, bool s)
|
||||||
client_need_arrange(c);
|
client_need_arrange(c);
|
||||||
c->issticky = s;
|
c->issticky = s;
|
||||||
client_need_arrange(c);
|
client_need_arrange(c);
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,6 +695,7 @@ client_setfullscreen(client_t *c, bool s)
|
||||||
XCB_PROP_MODE_REPLACE,
|
XCB_PROP_MODE_REPLACE,
|
||||||
c->win, _AWESOME_FULLSCREEN, CARDINAL, 8, 1,
|
c->win, _AWESOME_FULLSCREEN, CARDINAL, 8, 1,
|
||||||
&c->isfullscreen);
|
&c->isfullscreen);
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,6 +710,7 @@ client_setabove(client_t *c, bool s)
|
||||||
{
|
{
|
||||||
c->isabove = s;
|
c->isabove = s;
|
||||||
client_stack();
|
client_stack();
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,6 +725,7 @@ client_setbelow(client_t *c, bool s)
|
||||||
{
|
{
|
||||||
c->isbelow = s;
|
c->isbelow = s;
|
||||||
client_stack();
|
client_stack();
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,6 +740,7 @@ client_setmodal(client_t *c, bool s)
|
||||||
{
|
{
|
||||||
c->ismodal = s;
|
c->ismodal = s;
|
||||||
client_stack();
|
client_stack();
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,13 +1205,7 @@ luaA_client_newindex(lua_State *L)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case A_TK_MINIMIZE:
|
case A_TK_MINIMIZE:
|
||||||
b = luaA_checkboolean(L, 3);
|
client_setminimized(*c, luaA_checkboolean(L, 3));
|
||||||
if(b != (*c)->isminimized)
|
|
||||||
{
|
|
||||||
client_need_arrange(*c);
|
|
||||||
(*c)->isminimized = b;
|
|
||||||
client_need_arrange(*c);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case A_TK_FULLSCREEN:
|
case A_TK_FULLSCREEN:
|
||||||
client_setfullscreen(*c, luaA_checkboolean(L, 3));
|
client_setfullscreen(*c, luaA_checkboolean(L, 3));
|
||||||
|
|
1
client.h
1
client.h
|
@ -52,6 +52,7 @@ void client_setbelow(client_t *, bool);
|
||||||
void client_setmodal(client_t *, bool);
|
void client_setmodal(client_t *, bool);
|
||||||
void client_setontop(client_t *, bool);
|
void client_setontop(client_t *, bool);
|
||||||
void client_setfullscreen(client_t *, bool);
|
void client_setfullscreen(client_t *, bool);
|
||||||
|
void client_setminimized(client_t *, bool);
|
||||||
void client_setborder(client_t *, int);
|
void client_setborder(client_t *, int);
|
||||||
|
|
||||||
int luaA_client_newindex(lua_State *);
|
int luaA_client_newindex(lua_State *);
|
||||||
|
|
9
event.c
9
event.c
|
@ -582,9 +582,7 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
|
||||||
/* Check that it may be visible, but not asked to be hidden */
|
/* Check that it may be visible, but not asked to be hidden */
|
||||||
if(client_maybevisible(c, c->screen) && !c->ishidden)
|
if(client_maybevisible(c, c->screen) && !c->ishidden)
|
||||||
{
|
{
|
||||||
c->isminimized = false;
|
client_setminimized(c, false);
|
||||||
globalconf.screens[c->screen].need_arrange = true;
|
|
||||||
xcb_map_window(globalconf.connection, ev->window);
|
|
||||||
/* it will be raised, so just update ourself */
|
/* it will be raised, so just update ourself */
|
||||||
client_raise(c);
|
client_raise(c);
|
||||||
}
|
}
|
||||||
|
@ -708,10 +706,7 @@ event_handle_clientmessage(void *data __attribute__ ((unused)),
|
||||||
if((c = client_getbywin(ev->window))
|
if((c = client_getbywin(ev->window))
|
||||||
&& ev->format == 32
|
&& ev->format == 32
|
||||||
&& ev->data.data32[0] == XCB_WM_STATE_ICONIC)
|
&& ev->data.data32[0] == XCB_WM_STATE_ICONIC)
|
||||||
{
|
client_setminimized(c, true);
|
||||||
client_need_arrange(c);
|
|
||||||
c->isminimized = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(ev->type == _XEMBED)
|
else if(ev->type == _XEMBED)
|
||||||
return xembed_process_client_message(ev);
|
return xembed_process_client_message(ev);
|
||||||
|
|
60
ewmh.c
60
ewmh.c
|
@ -261,11 +261,20 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
||||||
else if(state == _NET_WM_STATE_SKIP_TASKBAR)
|
else if(state == _NET_WM_STATE_SKIP_TASKBAR)
|
||||||
{
|
{
|
||||||
if(set == _NET_WM_STATE_REMOVE)
|
if(set == _NET_WM_STATE_REMOVE)
|
||||||
|
{
|
||||||
c->skiptb = false;
|
c->skiptb = false;
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
|
}
|
||||||
else if(set == _NET_WM_STATE_ADD)
|
else if(set == _NET_WM_STATE_ADD)
|
||||||
|
{
|
||||||
c->skiptb = true;
|
c->skiptb = true;
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
|
}
|
||||||
else if(set == _NET_WM_STATE_TOGGLE)
|
else if(set == _NET_WM_STATE_TOGGLE)
|
||||||
|
{
|
||||||
c->skiptb = !c->skiptb;
|
c->skiptb = !c->skiptb;
|
||||||
|
ewmh_client_update_hints(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(state == _NET_WM_STATE_FULLSCREEN)
|
else if(state == _NET_WM_STATE_FULLSCREEN)
|
||||||
{
|
{
|
||||||
|
@ -306,23 +315,11 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
||||||
else if(state == _NET_WM_STATE_HIDDEN)
|
else if(state == _NET_WM_STATE_HIDDEN)
|
||||||
{
|
{
|
||||||
if(set == _NET_WM_STATE_REMOVE)
|
if(set == _NET_WM_STATE_REMOVE)
|
||||||
{
|
client_setminimized(c, false);
|
||||||
client_need_arrange(c);
|
|
||||||
c->isminimized = false;
|
|
||||||
client_need_arrange(c);
|
|
||||||
}
|
|
||||||
else if(set == _NET_WM_STATE_ADD)
|
else if(set == _NET_WM_STATE_ADD)
|
||||||
{
|
client_setminimized(c, true);
|
||||||
client_need_arrange(c);
|
|
||||||
c->isminimized = true;
|
|
||||||
client_need_arrange(c);
|
|
||||||
}
|
|
||||||
else if(set == _NET_WM_STATE_TOGGLE)
|
else if(set == _NET_WM_STATE_TOGGLE)
|
||||||
{
|
client_setminimized(c, !c->isminimized);
|
||||||
client_need_arrange(c);
|
|
||||||
c->isminimized = !c->isminimized;
|
|
||||||
client_need_arrange(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
|
else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
|
||||||
{
|
{
|
||||||
|
@ -389,8 +386,38 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Update client EWMH hints.
|
||||||
|
* \param c The client.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ewmh_check_client_hints(client_t *c)
|
ewmh_client_update_hints(client_t *c)
|
||||||
|
{
|
||||||
|
xcb_atom_t state[8]; /* number of defined state atoms */
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
if(c->ismodal)
|
||||||
|
state[i++] = _NET_WM_STATE_MODAL;
|
||||||
|
if(c->isfullscreen)
|
||||||
|
state[i++] = _NET_WM_STATE_FULLSCREEN;
|
||||||
|
if(c->issticky)
|
||||||
|
state[i++] = _NET_WM_STATE_STICKY;
|
||||||
|
if(c->skiptb)
|
||||||
|
state[i++] = _NET_WM_STATE_SKIP_TASKBAR;
|
||||||
|
if(c->isabove)
|
||||||
|
state[i++] = _NET_WM_STATE_ABOVE;
|
||||||
|
if(c->isbelow)
|
||||||
|
state[i++] = _NET_WM_STATE_BELOW;
|
||||||
|
if(c->isminimized)
|
||||||
|
state[i++] = _NET_WM_STATE_HIDDEN;
|
||||||
|
if(c->isurgent)
|
||||||
|
state[i++] = _NET_WM_STATE_DEMANDS_ATTENTION;
|
||||||
|
|
||||||
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
|
c->win, _NET_WM_STATE, ATOM, 32, i, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ewmh_client_check_hints(client_t *c)
|
||||||
{
|
{
|
||||||
xcb_atom_t *state;
|
xcb_atom_t *state;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
@ -515,7 +542,6 @@ ewmh_client_strut_update(client_t *c, xcb_get_property_reply_t *strut_r)
|
||||||
p_delete(&mstrut_r);
|
p_delete(&mstrut_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Send request to get NET_WM_ICON (EWMH)
|
/** Send request to get NET_WM_ICON (EWMH)
|
||||||
* \param w The window.
|
* \param w The window.
|
||||||
* \return The cookie associated with the request.
|
* \return The cookie associated with the request.
|
||||||
|
|
3
ewmh.h
3
ewmh.h
|
@ -32,7 +32,8 @@ void ewmh_update_net_desktop_names(int);
|
||||||
void ewmh_update_net_active_window(int);
|
void ewmh_update_net_active_window(int);
|
||||||
int ewmh_process_client_message(xcb_client_message_event_t *);
|
int ewmh_process_client_message(xcb_client_message_event_t *);
|
||||||
void ewmh_update_net_client_list_stacking(int);
|
void ewmh_update_net_client_list_stacking(int);
|
||||||
void ewmh_check_client_hints(client_t *);
|
void ewmh_client_check_hints(client_t *);
|
||||||
|
void ewmh_client_update_hints(client_t *);
|
||||||
void ewmh_update_workarea(int);
|
void ewmh_update_workarea(int);
|
||||||
void ewmh_client_strut_update(client_t *, xcb_get_property_reply_t *);
|
void ewmh_client_strut_update(client_t *, xcb_get_property_reply_t *);
|
||||||
xcb_get_property_cookie_t ewmh_window_icon_get_unchecked(xcb_window_t);
|
xcb_get_property_cookie_t ewmh_window_icon_get_unchecked(xcb_window_t);
|
||||||
|
|
Loading…
Reference in New Issue