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);
|
client_unfocus(c);
|
||||||
XUnmapWindow(globalconf.display, c->win);
|
XUnmapWindow(globalconf.display, c->win);
|
||||||
window_setstate(c->win, IconicState);
|
window_setstate(c->win, IconicState);
|
||||||
if(c->titlebar.sw)
|
if(c->titlebar.position)
|
||||||
XUnmapWindow(globalconf.display, c->titlebar.sw->window);
|
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)
|
if(rule && rule->titlebar.position != Auto)
|
||||||
c->titlebar = rule->titlebar;
|
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)
|
switch(c->titlebar.position)
|
||||||
{
|
{
|
||||||
case Top:
|
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,
|
c->titlebar.sw = simplewindow_new(globalconf.display,
|
||||||
phys_screen,
|
phys_screen,
|
||||||
c->geometry.x,
|
c->geometry.x,
|
||||||
|
@ -382,6 +383,15 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
titlebar_height,
|
titlebar_height,
|
||||||
0);
|
0);
|
||||||
break;
|
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:
|
default:
|
||||||
c->titlebar.position = Off;
|
c->titlebar.position = Off;
|
||||||
break;
|
break;
|
||||||
|
@ -547,22 +557,26 @@ client_resize(Client *c, area_t geometry)
|
||||||
if(!c->ismax)
|
if(!c->ismax)
|
||||||
c->f_geometry = geometry;
|
c->f_geometry = geometry;
|
||||||
|
|
||||||
if(c->titlebar.sw)
|
switch(c->titlebar.position)
|
||||||
{
|
{
|
||||||
switch(c->titlebar.position)
|
case Top:
|
||||||
{
|
simplewindow_move_resize(c->titlebar.sw,
|
||||||
case Top:
|
geometry.x,
|
||||||
simplewindow_move_resize(c->titlebar.sw,
|
geometry.y - c->titlebar.sw->geometry.height,
|
||||||
geometry.x,
|
geometry.width,
|
||||||
geometry.y - c->titlebar.sw->geometry.height,
|
c->titlebar.sw->geometry.height);
|
||||||
geometry.width,
|
break;
|
||||||
c->titlebar.sw->geometry.height);
|
case Bottom:
|
||||||
break;
|
simplewindow_move_resize(c->titlebar.sw,
|
||||||
default:
|
geometry.x,
|
||||||
break;
|
geometry.y + geometry.height + 2 * c->border,
|
||||||
}
|
geometry.width,
|
||||||
titlebar_update(c);
|
c->titlebar.sw->geometry.height);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
titlebar_update(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
XConfigureWindow(globalconf.display, c->win,
|
XConfigureWindow(globalconf.display, c->win,
|
||||||
|
|
33
titlebar.c
33
titlebar.c
|
@ -59,20 +59,31 @@ titlebar_update(Client *c)
|
||||||
area_t
|
area_t
|
||||||
titlebar_update_geometry(Client *c, area_t geometry)
|
titlebar_update_geometry(Client *c, area_t geometry)
|
||||||
{
|
{
|
||||||
if(!c->titlebar.position)
|
switch(c->titlebar.position)
|
||||||
return geometry;;
|
{
|
||||||
|
default:
|
||||||
simplewindow_move_resize(c->titlebar.sw,
|
return geometry;
|
||||||
geometry.x,
|
case Top:
|
||||||
geometry.y,
|
simplewindow_move_resize(c->titlebar.sw,
|
||||||
geometry.width,
|
geometry.x,
|
||||||
c->titlebar.sw->geometry.height);
|
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);
|
titlebar_update(c);
|
||||||
|
|
||||||
geometry.y += c->titlebar.sw->geometry.height;
|
|
||||||
geometry.height -= c->titlebar.sw->geometry.height;
|
|
||||||
|
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue