Add support for Bottom titlebar
This commit is contained in:
parent
9bd32fc3b8
commit
eb595fe06e
50
client.c
50
client.c
|
@ -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,22 +557,26 @@ client_resize(Client *c, area_t geometry)
|
|||
if(!c->ismax)
|
||||
c->f_geometry = geometry;
|
||||
|
||||
if(c->titlebar.sw)
|
||||
switch(c->titlebar.position)
|
||||
{
|
||||
switch(c->titlebar.position)
|
||||
{
|
||||
case Top:
|
||||
simplewindow_move_resize(c->titlebar.sw,
|
||||
geometry.x,
|
||||
geometry.y - c->titlebar.sw->geometry.height,
|
||||
geometry.width,
|
||||
c->titlebar.sw->geometry.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
titlebar_update(c);
|
||||
case Top:
|
||||
simplewindow_move_resize(c->titlebar.sw,
|
||||
geometry.x,
|
||||
geometry.y - c->titlebar.sw->geometry.height,
|
||||
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,
|
||||
|
|
33
titlebar.c
33
titlebar.c
|
@ -59,20 +59,31 @@ titlebar_update(Client *c)
|
|||
area_t
|
||||
titlebar_update_geometry(Client *c, area_t geometry)
|
||||
{
|
||||
if(!c->titlebar.position)
|
||||
return geometry;;
|
||||
|
||||
simplewindow_move_resize(c->titlebar.sw,
|
||||
geometry.x,
|
||||
geometry.y,
|
||||
geometry.width,
|
||||
c->titlebar.sw->geometry.height);
|
||||
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);
|
||||
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);
|
||||
|
||||
geometry.y += c->titlebar.sw->geometry.height;
|
||||
geometry.height -= c->titlebar.sw->geometry.height;
|
||||
|
||||
return geometry;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue