Split out titlebar handling into layout for non-floating, and into resize for floating
This commit is contained in:
parent
3c3015fd76
commit
dce101d044
60
client.c
60
client.c
|
@ -132,7 +132,7 @@ client_get_byname(Client *list, char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
client_updatetitlebar(Client *c)
|
client_updatetitlebar(Client *c)
|
||||||
{
|
{
|
||||||
DrawCtx *ctx;
|
DrawCtx *ctx;
|
||||||
|
@ -465,6 +465,25 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
ewmh_update_net_client_list(phys_screen);
|
ewmh_update_net_client_list(phys_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
area_t
|
||||||
|
client_titlebar_update_position(Client *c, area_t geometry)
|
||||||
|
{
|
||||||
|
if(!c->titlebar)
|
||||||
|
return geometry;;
|
||||||
|
|
||||||
|
simplewindow_move_resize(c->titlebar,
|
||||||
|
geometry.x,
|
||||||
|
geometry.y,
|
||||||
|
geometry.width,
|
||||||
|
c->titlebar->geometry.height);
|
||||||
|
|
||||||
|
client_updatetitlebar(c);
|
||||||
|
geometry.y += c->titlebar->geometry.height;
|
||||||
|
geometry.height -= c->titlebar->geometry.height;
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
area_t
|
area_t
|
||||||
client_geometry_hints(Client *c, area_t geometry)
|
client_geometry_hints(Client *c, area_t geometry)
|
||||||
{
|
{
|
||||||
|
@ -524,12 +543,6 @@ client_resize(Client *c, area_t geometry)
|
||||||
area_t area;
|
area_t area;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if(c->titlebar)
|
|
||||||
{
|
|
||||||
geometry.y += c->titlebar->geometry.height;
|
|
||||||
geometry.height -= c->titlebar->geometry.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(geometry.width <= 0 || geometry.height <= 0)
|
if(geometry.width <= 0 || geometry.height <= 0)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
@ -556,24 +569,25 @@ client_resize(Client *c, area_t geometry)
|
||||||
c->geometry.y = wc.y = geometry.y;
|
c->geometry.y = wc.y = geometry.y;
|
||||||
c->geometry.height = wc.height = geometry.height;
|
c->geometry.height = wc.height = geometry.height;
|
||||||
|
|
||||||
if(c->titlebar)
|
|
||||||
{
|
|
||||||
simplewindow_move_resize(c->titlebar,
|
|
||||||
geometry.x,
|
|
||||||
geometry.y - c->titlebar->geometry.height,
|
|
||||||
geometry.width,
|
|
||||||
c->titlebar->geometry.height);
|
|
||||||
client_updatetitlebar(c);
|
|
||||||
|
|
||||||
c->geometry.y -= c->titlebar->geometry.height;
|
|
||||||
c->geometry.height += c->titlebar->geometry.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save the floating geometry if the window is floating but not
|
/* save the floating geometry if the window is floating but not
|
||||||
* maximized */
|
* maximized */
|
||||||
if((c->isfloating ||
|
if(c->isfloating
|
||||||
layout_get_current(new_screen)->arrange == layout_floating) && !c->ismax)
|
|| layout_get_current(new_screen)->arrange == layout_floating)
|
||||||
c->f_geometry = geometry;
|
{
|
||||||
|
if(!c->ismax)
|
||||||
|
c->f_geometry = geometry;
|
||||||
|
|
||||||
|
if(c->titlebar)
|
||||||
|
{
|
||||||
|
simplewindow_move_resize(c->titlebar,
|
||||||
|
geometry.x,
|
||||||
|
geometry.y - c->titlebar->geometry.height,
|
||||||
|
geometry.width,
|
||||||
|
c->titlebar->geometry.height);
|
||||||
|
|
||||||
|
client_updatetitlebar(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XConfigureWindow(globalconf.display, c->win,
|
XConfigureWindow(globalconf.display, c->win,
|
||||||
CWX | CWY | CWWidth | CWHeight, &wc);
|
CWX | CWY | CWWidth | CWHeight, &wc);
|
||||||
|
|
2
client.h
2
client.h
|
@ -31,11 +31,13 @@ void client_focus(Client *, int, Bool);
|
||||||
void client_ban(Client *);
|
void client_ban(Client *);
|
||||||
void client_unban(Client *);
|
void client_unban(Client *);
|
||||||
void client_manage(Window, XWindowAttributes *, int);
|
void client_manage(Window, XWindowAttributes *, int);
|
||||||
|
area_t client_titlebar_update_position(Client *, area_t);
|
||||||
area_t client_geometry_hints(Client *, area_t);
|
area_t client_geometry_hints(Client *, area_t);
|
||||||
Bool client_resize(Client *, area_t);
|
Bool client_resize(Client *, area_t);
|
||||||
void client_unmanage(Client *);
|
void client_unmanage(Client *);
|
||||||
void client_updatewmhints(Client *);
|
void client_updatewmhints(Client *);
|
||||||
long client_updatesizehints(Client *);
|
long client_updatesizehints(Client *);
|
||||||
|
void client_updatetitlebar(Client *);
|
||||||
void client_updatetitle(Client *);
|
void client_updatetitle(Client *);
|
||||||
void client_saveprops(Client *);
|
void client_saveprops(Client *);
|
||||||
void client_kill(Client *);
|
void client_kill(Client *);
|
||||||
|
|
|
@ -83,9 +83,12 @@ layout_fibonacci(int screen, int shape)
|
||||||
geometry.width -= 2 * c->border;
|
geometry.width -= 2 * c->border;
|
||||||
geometry.height -= 2 * c->border;
|
geometry.height -= 2 * c->border;
|
||||||
if(globalconf.screens[screen].resize_hints)
|
if(globalconf.screens[screen].resize_hints)
|
||||||
client_resize(c, client_geometry_hints(c, geometry));
|
client_resize(c,
|
||||||
|
client_geometry_hints(c,
|
||||||
|
client_titlebar_update_position(c,
|
||||||
|
geometry)));
|
||||||
else
|
else
|
||||||
client_resize(c, geometry);
|
client_resize(c, client_titlebar_update_position(c, geometry));
|
||||||
geometry.width += 2 * c->border;
|
geometry.width += 2 * c->border;
|
||||||
geometry.height += 2 * c->border;
|
geometry.height += 2 * c->border;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,12 @@ layout_max(int screen)
|
||||||
area.width -= 2 * c->border;
|
area.width -= 2 * c->border;
|
||||||
area.height -= 2 * c->border;
|
area.height -= 2 * c->border;
|
||||||
if(globalconf.screens[screen].resize_hints)
|
if(globalconf.screens[screen].resize_hints)
|
||||||
client_resize(c, client_geometry_hints(c, area));
|
client_resize(c,
|
||||||
|
client_geometry_hints(c,
|
||||||
|
client_titlebar_update_position(c,
|
||||||
|
area)));
|
||||||
else
|
else
|
||||||
client_resize(c, area);
|
client_resize(c, client_titlebar_update_position(c, area));
|
||||||
area.width += 2 * c->border;
|
area.width += 2 * c->border;
|
||||||
area.height += 2 * c->border;
|
area.height += 2 * c->border;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,8 +203,12 @@ _tile(int screen, const Position position)
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry.width = mw - 2 * c->border;
|
geometry.width = mw - 2 * c->border;
|
||||||
geometry.height = mh - 2 * c->border;
|
geometry.height = mh - 2 * c->border;
|
||||||
|
|
||||||
|
geometry = client_titlebar_update_position(c, geometry);
|
||||||
|
|
||||||
if(globalconf.screens[screen].resize_hints)
|
if(globalconf.screens[screen].resize_hints)
|
||||||
geometry = client_geometry_hints(c, geometry);
|
geometry = client_geometry_hints(c, geometry);
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry);
|
||||||
|
@ -258,6 +262,9 @@ _tile(int screen, const Position position)
|
||||||
if(position == Bottom)
|
if(position == Bottom)
|
||||||
geometry.y += mh;
|
geometry.y += mh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
geometry = client_titlebar_update_position(c, geometry);
|
||||||
|
|
||||||
if(globalconf.screens[screen].resize_hints)
|
if(globalconf.screens[screen].resize_hints)
|
||||||
geometry = client_geometry_hints(c, geometry);
|
geometry = client_geometry_hints(c, geometry);
|
||||||
client_resize(c, geometry);
|
client_resize(c, geometry);
|
||||||
|
|
Loading…
Reference in New Issue