clients/titlebar: Re-Add titlebar border, better titlebar placement system

This commit is contained in:
Martin Duquesnoy 2008-10-24 19:12:52 +02:00
parent dcdffcd447
commit fb256b333f
4 changed files with 26 additions and 13 deletions

View File

@ -239,8 +239,10 @@ updatetitlebar(Client *c)
if(!c->title)
c->title = strdup("WMFS");
if(conf.titlebar.height)
bar_refresh_color(c->tbar);
if(!conf.titlebar.height)
return;
bar_refresh_color(c->tbar);
/* Draw the client title in the titlebar *logeek* */
if(conf.titlebar.height > 9)
@ -266,9 +268,8 @@ updatetitlebar(Client *c)
/* Draw title */
draw_text(c->tbar->dr, pos_x, pos_y, tmpcolor, conf.titlebar.bg, 0, c->title);
bar_refresh(c->tbar);
}
bar_refresh(c->tbar);
return;
}

View File

@ -125,6 +125,8 @@ client_focus(Client *c)
{
grabbuttons(sel, False);
XSetWindowBorder(dpy, sel->win, conf.client.bordernormal);
if(conf.titlebar.height)
XSetWindowBorder(dpy, sel->tbar->win, conf.client.bordernormal);
}
if(c)
@ -136,6 +138,8 @@ client_focus(Client *c)
if(c)
{
XSetWindowBorder(dpy, c->win, conf.client.borderfocus);
if(conf.titlebar.height)
XSetWindowBorder(dpy, sel->tbar->win, conf.client.borderfocus);
if(conf.raisefocus)
client_raise(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
@ -176,7 +180,9 @@ client_gettbar(Window w)
void
client_hide(Client *c)
{
client_unmap(c);
XMoveWindow(dpy, c->win, c->geo.x + mw * 2, c->geo.y);
if(conf.titlebar.height)
XMoveWindow(dpy, c->tbar->win, c->geo.x + mw * 2, c->geo.y);
setwinstate(c->win, IconicState);
return;
@ -237,20 +243,23 @@ client_manage(Window w, XWindowAttributes *wa)
c = emalloc(1, sizeof(Client));
c->win = w;
c->geo.x = wa->x;
/* Default free placement */
c->geo.y = wa->y + sgeo.y + conf.titlebar.height;
c->geo.width = wa->width;
c->geo.height = wa->height;
c->tag = seltag;
c->border = conf.client.borderheight;
/* Create titlebar */
/* Create titlebar (or not) */
if(conf.titlebar.height)
{
c->tbar = bar_create(c->geo.x,
c->geo.y - conf.titlebar.height,
c->geo.width + c->border,
conf.titlebar.height, 0,
c->geo.width,
conf.titlebar.height - conf.client.borderheight,
conf.client.borderheight,
conf.titlebar.bg, True);
XSetWindowBorder(dpy, c->tbar->win, conf.client.bordernormal);
}
winc.border_width = c->border;
XConfigureWindow(dpy, w, CWBorderWidth, &winc);
@ -346,8 +355,8 @@ client_moveresize(Client *c, XRectangle geo, bool r)
if(conf.titlebar.height)
bar_moveresize(c->tbar, geo.x,
geo.y - conf.titlebar.height,
geo.width + c->border*2,
conf.titlebar.height);
geo.width,
conf.titlebar.height - conf.client.borderheight);
updatetitlebar(c);
XSync(dpy, False);
@ -454,7 +463,9 @@ uicb_client_raise(uicb_t cmd)
void
client_unhide(Client *c)
{
client_map(c);
XMoveWindow(dpy, c->win, c->geo.x, c->geo.y);
if(conf.titlebar.height)
XMoveWindow(dpy, c->tbar->win, c->geo.x, c->geo.y - conf.titlebar.height);
setwinstate(c->win, NormalState);
return;

View File

@ -194,7 +194,7 @@ tile(void)
if(!n)
return;
/* tile mirror
/* Tile mirror, maybe soon...
nmaster = (n > tags[seltag].nmaster) ? n - tags[seltag].nmaster : tags[seltag].nmaster;
mwfact = (1 - tags[seltag].mwfact) * sgeo.width
*/

View File

@ -178,6 +178,7 @@ init(void)
updatebar();
/* INIT WORKABLE SPACE GEOMETRY */
conf.titlebar.height += conf.client.borderheight;
sgeo.x = 0;
sgeo.y = (conf.bartop) ? barheight + conf.titlebar.height : conf.titlebar.height;
sgeo.width = DisplayWidth(dpy, screen);