Add support for Bottom titlebar

This commit is contained in:
Julien Danjou 2008-03-15 14:19:52 +01:00
parent 9bd32fc3b8
commit eb595fe06e
2 changed files with 54 additions and 29 deletions

View File

@ -171,7 +171,7 @@ client_ban(Client *c)
client_unfocus(c);
XUnmapWindow(globalconf.display, c->win);
window_setstate(c->win, IconicState);
if(c->titlebar.sw)
if(c->titlebar.position)
XUnmapWindow(globalconf.display, c->titlebar.sw->window);
}
@ -368,12 +368,13 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
if(rule && rule->titlebar.position != Auto)
c->titlebar = rule->titlebar;
titlebar_height = 1.5 * MAX(globalconf.screens[c->screen].styles.normal.font->height,
MAX(globalconf.screens[c->screen].styles.focus.font->height,
globalconf.screens[c->screen].styles.urgent.font->height));
switch(c->titlebar.position)
{
case Top:
titlebar_height = 1.5 * MAX(globalconf.screens[c->screen].styles.normal.font->height,
MAX(globalconf.screens[c->screen].styles.focus.font->height,
globalconf.screens[c->screen].styles.urgent.font->height)),
c->titlebar.sw = simplewindow_new(globalconf.display,
phys_screen,
c->geometry.x,
@ -382,6 +383,15 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
titlebar_height,
0);
break;
case Bottom:
c->titlebar.sw = simplewindow_new(globalconf.display,
phys_screen,
c->geometry.x,
c->geometry.y + c->geometry.height,
c->geometry.width + 2 * c->border,
titlebar_height,
0);
break;
default:
c->titlebar.position = Off;
break;
@ -547,8 +557,6 @@ client_resize(Client *c, area_t geometry)
if(!c->ismax)
c->f_geometry = geometry;
if(c->titlebar.sw)
{
switch(c->titlebar.position)
{
case Top:
@ -558,12 +566,18 @@ client_resize(Client *c, area_t geometry)
geometry.width,
c->titlebar.sw->geometry.height);
break;
case Bottom:
simplewindow_move_resize(c->titlebar.sw,
geometry.x,
geometry.y + geometry.height + 2 * c->border,
geometry.width,
c->titlebar.sw->geometry.height);
break;
default:
break;
}
titlebar_update(c);
}
}
XConfigureWindow(globalconf.display, c->win,
CWX | CWY | CWWidth | CWHeight, &wc);

View File

@ -59,19 +59,30 @@ titlebar_update(Client *c)
area_t
titlebar_update_geometry(Client *c, area_t geometry)
{
if(!c->titlebar.position)
return geometry;;
switch(c->titlebar.position)
{
default:
return geometry;
case Top:
simplewindow_move_resize(c->titlebar.sw,
geometry.x,
geometry.y,
geometry.width,
c->titlebar.sw->geometry.height);
titlebar_update(c);
geometry.y += c->titlebar.sw->geometry.height;
geometry.height -= c->titlebar.sw->geometry.height;
break;
case Bottom:
geometry.height -= c->titlebar.sw->geometry.height;
simplewindow_move_resize(c->titlebar.sw,
geometry.x,
geometry.y + geometry.height + 2 * c->border,
geometry.width,
c->titlebar.sw->geometry.height);
break;
}
titlebar_update(c);
return geometry;
}