use client_setfloating() to change floating attribute

This commit is contained in:
Julien Danjou 2008-01-17 10:40:39 +01:00
parent 5570612dec
commit 7f4dc5a871
3 changed files with 20 additions and 17 deletions

View File

@ -72,7 +72,7 @@ client_loadprops(Client * c, int screen)
untag_client(c, tag);
if(i <= ntags && prop[i])
c->isfloating = prop[i] == '1';
client_setfloating(c, prop[i] == '1');
}
p_delete(&prop);
@ -282,11 +282,10 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
case Auto:
break;
case Float:
c->isfloating = True;
client_resize(c, c->f_geometry, False);
client_setfloating(c, True);
break;
case Tile:
c->isfloating = False;
client_setfloating(c, False);
break;
}
}
@ -303,7 +302,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
/* should be floating if transsient or fixed */
if(!c->isfloating)
c->isfloating = rettrans || c->isfixed;
client_setfloating(c, rettrans || c->isfixed);
}
XSelectInput(globalconf.display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
@ -443,6 +442,14 @@ client_resize(Client *c, Area geometry, Bool sizehints)
return False;
}
void
client_setfloating(Client *c, Bool floating)
{
if(c->isfloating != floating)
if((c->isfloating = floating))
client_resize(c, c->f_geometry, False);
}
/** Save client properties as an X property
* \param c client
*/
@ -766,7 +773,6 @@ uicb_client_moveresize(int screen, char *arg)
}
}
void
client_kill(Client *c)
{
@ -809,14 +815,14 @@ client_maximize(Client *c, Area geometry)
c->wasfloating = c->isfloating;
c->m_geometry = c->geometry;
if(get_current_layout(c->screen)->arrange != layout_floating)
c->isfloating = True;
client_setfloating(c, True);
client_resize(c, geometry, False);
restack(c->screen);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
}
else if(c->wasfloating)
{
c->isfloating = True;
client_setfloating(c, True);
client_resize(c, c->m_geometry, False);
restack(c->screen);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
@ -829,7 +835,7 @@ client_maximize(Client *c, Area geometry)
}
else
{
c->isfloating = False;
client_setfloating(c, False);
arrange(c->screen);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
}

View File

@ -39,6 +39,7 @@ void client_updatesizehints(Client *);
void client_updatetitle(Client *);
void client_saveprops(Client *);
void client_kill(Client *);
void client_setfloating(Client *, Bool);
Uicb uicb_client_kill;
Uicb uicb_client_moveresize;

12
ewmh.c
View File

@ -259,7 +259,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
geometry = c->m_geometry;
c->border = c->oldborder;
c->ismax = False;
c->isfloating = c->wasfloating;
client_setfloating(c, c->wasfloating);
}
else if(set == _NET_WM_STATE_ADD)
{
@ -270,7 +270,7 @@ ewmh_process_state_atom(Client *c, Atom state, int set)
c->oldborder = c->border;
c->border = 0;
c->ismax = True;
c->isfloating = True;
client_setfloating(c, True);
}
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
client_resize(c, geometry, False);
@ -292,14 +292,10 @@ ewmh_process_window_type_atom(Client *c, Atom state)
c->border = 0;
c->skip = True;
c->isfixed = True;
c->isfloating = True;
client_resize(c, c->f_geometry, False);
client_setfloating(c, True);
}
else if (state == net_wm_window_type_dialog)
{
c->isfloating = True;
client_resize(c, c->f_geometry, False);
}
client_setfloating(c, True);
}
void
ewmh_process_client_message(XClientMessageEvent *ev)