client: split out of setfloating layer handling
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
775e634e13
commit
086bada825
34
client.c
34
client.c
|
@ -92,7 +92,8 @@ client_loadprops(client_t * c, screen_t *screen)
|
|||
else
|
||||
untag_client(c, tags->tab[i]);
|
||||
|
||||
client_setfloating(c, prop[tags->len] == '1', prop[tags->len + 1] - '0');
|
||||
client_setlayer(c, prop[tags->len + 1] - '0');
|
||||
client_setfloating(c, prop[tags->len] == '1');
|
||||
p_delete(&prop);
|
||||
return true;
|
||||
}
|
||||
|
@ -409,7 +410,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
|||
|
||||
/* should be floating if transsient or fixed */
|
||||
if(rettrans || c->isfixed)
|
||||
client_setfloating(c, true, c->layer != LAYER_TILE ? c->layer : LAYER_FLOAT);
|
||||
client_setfloating(c, true);
|
||||
|
||||
xcb_change_window_attributes(globalconf.connection, w, XCB_CW_EVENT_MASK, select_input_val);
|
||||
|
||||
|
@ -581,34 +582,43 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
return resized;
|
||||
}
|
||||
|
||||
/* Set the client layer.
|
||||
* \param c The client.
|
||||
* \param layer The layer.
|
||||
*/
|
||||
void
|
||||
client_setlayer(client_t *c, layer_t layer)
|
||||
{
|
||||
c->layer = layer;
|
||||
client_raise(c);
|
||||
}
|
||||
|
||||
/** Set a clinet floating.
|
||||
* \param c The client.
|
||||
* \param floating Set floating, or not.
|
||||
* \param layer Layer to put the floating window onto.
|
||||
*/
|
||||
void
|
||||
client_setfloating(client_t *c, bool floating, layer_t layer)
|
||||
client_setfloating(client_t *c, bool floating)
|
||||
{
|
||||
if(c->isfloating != floating)
|
||||
{
|
||||
if((c->isfloating = floating))
|
||||
{
|
||||
client_setlayer(c, MAX(c->layer, LAYER_FLOAT));
|
||||
client_resize(c, c->f_geometry, false);
|
||||
}
|
||||
else if(c->ismax)
|
||||
{
|
||||
c->ismax = false;
|
||||
client_setlayer(c, c->oldlayer);
|
||||
client_resize(c, c->m_geometry, false);
|
||||
}
|
||||
else
|
||||
client_setlayer(c, c->oldlayer);
|
||||
if(client_isvisible(c, c->screen))
|
||||
globalconf.screens[c->screen].need_arrange = true;
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
if(floating)
|
||||
{
|
||||
c->oldlayer = c->layer;
|
||||
c->layer = layer;
|
||||
}
|
||||
else
|
||||
c->layer = c->oldlayer;
|
||||
client_raise(c);
|
||||
client_saveprops(c);
|
||||
}
|
||||
}
|
||||
|
@ -1200,7 +1210,7 @@ luaA_client_floating_set(lua_State *L)
|
|||
{
|
||||
client_t **c = luaA_checkudata(L, 1, "client");
|
||||
bool f = luaA_checkboolean(L, 2);
|
||||
client_setfloating(*c, f, (*c)->layer == LAYER_FLOAT ? LAYER_TILE : LAYER_FLOAT);
|
||||
client_setfloating(*c, f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
3
client.h
3
client.h
|
@ -29,6 +29,7 @@
|
|||
bool client_isvisible(client_t *, int);
|
||||
client_t * client_getbywin(xcb_window_t);
|
||||
bool client_focus(client_t *, int);
|
||||
void client_setlayer(client_t *, layer_t);
|
||||
void client_raise(client_t *);
|
||||
void client_ban(client_t *);
|
||||
void client_unban(client_t *);
|
||||
|
@ -41,7 +42,7 @@ xcb_size_hints_t *client_updatesizehints(client_t *);
|
|||
void client_updatetitle(client_t *);
|
||||
void client_saveprops(client_t *);
|
||||
void client_kill(client_t *);
|
||||
void client_setfloating(client_t *, bool, layer_t);
|
||||
void client_setfloating(client_t *, bool);
|
||||
char * client_markup_parse(client_t *, const char *, ssize_t);
|
||||
void client_setborder(client_t *, int);
|
||||
|
||||
|
|
29
ewmh.c
29
ewmh.c
|
@ -389,8 +389,9 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
xcb_map_window(globalconf.connection, c->titlebar->sw->window);
|
||||
c->noborder = false;
|
||||
c->ismax = false;
|
||||
client_setlayer(c, c->oldlayer);
|
||||
client_setborder(c, c->oldborder);
|
||||
client_setfloating(c, c->wasfloating, c->oldlayer);
|
||||
client_setfloating(c, c->wasfloating);
|
||||
}
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
{
|
||||
|
@ -408,7 +409,9 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
c->oldborder = c->border;
|
||||
client_setborder(c, 0);
|
||||
c->noborder = true;
|
||||
client_setfloating(c, true, LAYER_FULLSCREEN);
|
||||
c->oldlayer = c->layer;
|
||||
client_setlayer(c, LAYER_FULLSCREEN);
|
||||
client_setfloating(c, true);
|
||||
}
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
client_resize(c, geometry, false);
|
||||
|
@ -416,31 +419,31 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
|
|||
else if(state == net_wm_state_above)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
c->layer = c->oldlayer;
|
||||
client_setlayer(c, c->oldlayer);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
{
|
||||
c->oldlayer = c->layer;
|
||||
c->layer = LAYER_ABOVE;
|
||||
client_setlayer(c, LAYER_ABOVE);
|
||||
}
|
||||
}
|
||||
else if(state == net_wm_state_below)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
c->layer = c->oldlayer;
|
||||
client_setlayer(c, c->oldlayer);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
{
|
||||
c->oldlayer = c->layer;
|
||||
c->layer = LAYER_BELOW;
|
||||
client_setlayer(c, LAYER_BELOW);
|
||||
}
|
||||
}
|
||||
else if(state == net_wm_state_modal)
|
||||
{
|
||||
if(set == _NET_WM_STATE_REMOVE)
|
||||
c->layer = c->oldlayer;
|
||||
client_setlayer(c, c->oldlayer);
|
||||
else if(set == _NET_WM_STATE_ADD)
|
||||
{
|
||||
c->oldlayer = c->layer;
|
||||
c->layer = LAYER_MODAL;
|
||||
client_setlayer(c, LAYER_MODAL);
|
||||
}
|
||||
}
|
||||
else if(state == net_wm_state_hidden)
|
||||
|
@ -485,17 +488,21 @@ ewmh_process_window_type_atom(client_t *c, xcb_atom_t state)
|
|||
}
|
||||
client_setborder(c, 0);
|
||||
c->noborder = true;
|
||||
client_setfloating(c, true, LAYER_ABOVE);
|
||||
client_setlayer(c, LAYER_ABOVE);
|
||||
client_setfloating(c, true);
|
||||
}
|
||||
else if(state == net_wm_window_type_dialog)
|
||||
client_setfloating(c, true, LAYER_MODAL);
|
||||
{
|
||||
client_setlayer(c, LAYER_MODAL);
|
||||
client_setfloating(c, true);
|
||||
}
|
||||
else if(state == net_wm_window_type_desktop)
|
||||
{
|
||||
tag_array_t *tags = &globalconf.screens[c->screen].tags;
|
||||
c->noborder = true;
|
||||
c->isfixed = true;
|
||||
c->skip = true;
|
||||
c->layer = LAYER_DESKTOP;
|
||||
client_setlayer(c, LAYER_DESKTOP);
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
tag_client(c, tags->tab[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue