client: add support for the sticky attribute
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5449374e3d
commit
8543dfae5c
25
client.c
25
client.c
|
@ -131,7 +131,11 @@ client_maybevisible(client_t *c, int screen)
|
|||
{
|
||||
if(c->screen == screen)
|
||||
{
|
||||
if(c->issticky)
|
||||
return true;
|
||||
|
||||
tag_array_t *tags = &globalconf.screens[screen].tags;
|
||||
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
if(tags->tab[i]->selected && is_client_tagged(c, tags->tab[i]))
|
||||
return true;
|
||||
|
@ -629,6 +633,21 @@ client_setfloating(client_t *c, bool floating)
|
|||
}
|
||||
}
|
||||
|
||||
/** Set a client sticky, or not.
|
||||
* \param c The client.
|
||||
* \param s Set or not the client sticky.
|
||||
*/
|
||||
void
|
||||
client_setsticky(client_t *c, bool s)
|
||||
{
|
||||
if(c->issticky != s)
|
||||
{
|
||||
client_need_arrange(c);
|
||||
c->issticky = s;
|
||||
client_need_arrange(c);
|
||||
}
|
||||
}
|
||||
|
||||
/** Save client properties as an X property.
|
||||
* \param c The client.
|
||||
*/
|
||||
|
@ -1181,6 +1200,9 @@ luaA_client_newindex(lua_State *L)
|
|||
case A_TK_FLOATING:
|
||||
client_setfloating(*c, luaA_checkboolean(L, 3));
|
||||
break;
|
||||
case A_TK_STICKY:
|
||||
client_setsticky(*c, luaA_checkboolean(L, 3));
|
||||
break;
|
||||
case A_TK_HONORSIZEHINTS:
|
||||
(*c)->honorsizehints = luaA_checkboolean(L, 3);
|
||||
client_need_arrange(*c);
|
||||
|
@ -1352,6 +1374,9 @@ luaA_client_index(lua_State *L)
|
|||
case A_TK_FLOATING:
|
||||
lua_pushboolean(L, (*c)->isfloating);
|
||||
break;
|
||||
case A_TK_STICKY:
|
||||
lua_pushboolean(L, (*c)->issticky);
|
||||
break;
|
||||
case A_TK_HONORSIZEHINTS:
|
||||
lua_pushboolean(L, (*c)->honorsizehints);
|
||||
break;
|
||||
|
|
1
client.h
1
client.h
|
@ -51,6 +51,7 @@ bool client_updatetitle(client_t *);
|
|||
void client_saveprops(client_t *);
|
||||
void client_kill(client_t *);
|
||||
void client_setfloating(client_t *, bool);
|
||||
void client_setsticky(client_t *, bool);
|
||||
void client_setborder(client_t *, int);
|
||||
|
||||
int luaA_client_newindex(lua_State *);
|
||||
|
|
|
@ -52,6 +52,7 @@ selected
|
|||
shadow
|
||||
shadow_offset
|
||||
show_icons
|
||||
sticky
|
||||
text
|
||||
ticks_count
|
||||
ticks_gap
|
||||
|
|
13
ewmh.c
13
ewmh.c
|
@ -252,9 +252,10 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
{
|
||||
if(state == _NET_WM_STATE_STICKY)
|
||||
{
|
||||
tag_array_t *tags = &globalconf.screens[c->screen].tags;
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
tag_client(c, tags->tab[i]);
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
client_setsticky(c, false);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
client_setsticky(c, true);
|
||||
}
|
||||
else if(state == _NET_WM_STATE_SKIP_TASKBAR)
|
||||
{
|
||||
|
@ -432,8 +433,7 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
|
|||
tag_array_t *tags = &globalconf.screens[c->screen].tags;
|
||||
|
||||
if(ev->data.data32[0] == 0xffffffff)
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
tag_client(c, tags->tab[i]);
|
||||
c->issticky = true;
|
||||
else
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
if((int)ev->data.data32[0] == i)
|
||||
|
@ -482,8 +482,7 @@ ewmh_check_client_hints(client_t *c)
|
|||
|
||||
desktop = *(uint32_t *) data;
|
||||
if(desktop == -1)
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
tag_client(c, tags->tab[i]);
|
||||
c->issticky = true;
|
||||
else
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
if(desktop == i)
|
||||
|
|
Loading…
Reference in New Issue