titlebar: Remove border, just adjust the size with the client border

This commit is contained in:
Martin Duquesnoy 2008-11-08 00:22:43 +01:00
parent f789d0a28b
commit 0da49d84b4
4 changed files with 76 additions and 91 deletions

View File

@ -202,13 +202,13 @@ client_map(Client *c)
if(!c)
return;
XMapWindow(dpy, c->win);
XMapSubwindows(dpy, c->win);
if(conf.titlebar.exist)
{
XMapWindow(dpy, c->tbar->win);
bar_refresh(c->tbar);
}
XMapWindow(dpy, c->win);
XMapSubwindows(dpy, c->win);
return;
}
@ -335,72 +335,72 @@ client_moveresize(Client *c, XRectangle geo, bool r)
void
client_size_hints(Client *c)
{
long msize;
XSizeHints size;
long msize;
XSizeHints size;
if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
size.flags = PSize;
/* base */
if(size.flags & PBaseSize)
{
c->basew = size.base_width;
c->baseh = size.base_height;
}
else if(size.flags & PMinSize)
{
c->basew = size.min_width;
c->baseh = size.min_height;
}
else
c->basew = c->baseh = 0;
if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
size.flags = PSize;
/* base */
if(size.flags & PBaseSize)
{
c->basew = size.base_width;
c->baseh = size.base_height;
}
else if(size.flags & PMinSize)
{
c->basew = size.min_width;
c->baseh = size.min_height;
}
else
c->basew = c->baseh = 0;
/* inc */
if(size.flags & PResizeInc)
{
c->incw = size.width_inc;
c->inch = size.height_inc;
}
else
c->incw = c->inch = 0;
/* inc */
if(size.flags & PResizeInc)
{
c->incw = size.width_inc;
c->inch = size.height_inc;
}
else
c->incw = c->inch = 0;
/* max */
if(size.flags & PMaxSize)
{
c->maxw = size.max_width;
c->maxh = size.max_height;
}
else
c->maxw = c->maxh = 0;
/* max */
if(size.flags & PMaxSize)
{
c->maxw = size.max_width;
c->maxh = size.max_height;
}
else
c->maxw = c->maxh = 0;
/* min */
if(size.flags & PMinSize)
{
c->minw = size.min_width;
c->minh = size.min_height;
}
else if(size.flags & PBaseSize)
{
c->minw = size.base_width;
c->minh = size.base_height;
}
else
c->minw = c->minh = 0;
/* min */
if(size.flags & PMinSize)
{
c->minw = size.min_width;
c->minh = size.min_height;
}
else if(size.flags & PBaseSize)
{
c->minw = size.base_width;
c->minh = size.base_height;
}
else
c->minw = c->minh = 0;
/* aspect */
if(size.flags & PAspect)
{
c->minax = size.min_aspect.x;
c->maxax = size.max_aspect.x;
c->minay = size.min_aspect.y;
c->maxay = size.max_aspect.y;
}
else
/* aspect */
if(size.flags & PAspect)
{
c->minax = size.min_aspect.x;
c->maxax = size.max_aspect.x;
c->minay = size.min_aspect.y;
c->maxay = size.max_aspect.y;
}
else
c->minax = c->maxax = c->minay = c->maxay = 0;
c->hint = (c->maxw && c->minw && c->maxh && c->minh
&& c->maxw == c->minw && c->maxh == c->minh);
c->minax = c->maxax = c->minay = c->maxay = 0;
c->hint = (c->maxw && c->minw && c->maxh && c->minh
&& c->maxw == c->minw && c->maxh == c->minh);
return;
return;
}
void
@ -409,12 +409,12 @@ client_raise(Client *c)
if(!c || c->max || c->tile)
return;
XRaiseWindow(dpy, c->win);
if(conf.titlebar.exist)
{
XRaiseWindow(dpy, c->tbar->win);
titlebar_update(c);
}
XRaiseWindow(dpy, c->win);
return;
}
@ -457,7 +457,6 @@ client_unmanage(Client *c)
* and set the withdraw state */
client_detach(c);
setwinstate(c->win, WithdrawnState);
if(conf.titlebar.exist)
titlebar_delete(c);
efree(c);

View File

@ -35,7 +35,7 @@
void
infobar_init(InfoBar *ib)
{
ib->geo.height = font->height + (float)4.5;
ib->geo.height = font->height * 1.5;
ib->geo.y = (conf.bartop) ? 0 : MAXH - ib->geo.height;
/* Create infobar barwindow */
@ -45,9 +45,9 @@ infobar_init(InfoBar *ib)
ib->layout_switch = bar_create(0, (conf.bartop) ? ib->geo.y : ib->geo.y + 1,
1, ib->geo.height - 1, 0,
conf.colors.layout_bg, False);
ib->layout_type_switch = bar_create(0, ib->geo.y,
1, ib->geo.height,
0, conf.colors.layout_bg, False);
ib->layout_type_switch = bar_create(0, ib->geo.y,
1, ib->geo.height,
0, conf.colors.layout_bg, False);
/* Map all */
bar_map(ib->bar);

View File

@ -122,6 +122,7 @@ init_root(void)
SubstructureRedirectMask | SubstructureNotifyMask |
EnterWindowMask | LeaveWindowMask | StructureNotifyMask ;
at.cursor = cursor[CurNormal];
at.override_redirect = 1;
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &at);
if(conf.root.background_command)
uicb_spawn(conf.root.background_command);
@ -132,16 +133,15 @@ init_root(void)
void
init_geometry(void)
{
sgeo.x = 0;
sgeo.y = sgeo.x = 0;
if(conf.bartop)
sgeo.y = (conf.titlebar.pos)
? infobar.geo.height
: infobar.geo.height + conf.titlebar.height;
else
sgeo.y = (conf.titlebar.pos)
? 0
: conf.titlebar.height;
if(conf.titlebar.pos)
sgeo.y = conf.titlebar.height;
sgeo.width = MAXW;
sgeo.height = MAXH - (infobar.geo.height + conf.titlebar.height);

View File

@ -35,25 +35,10 @@
void
titlebar_create(Client *c)
{
int y;
/* Set titlebar position : Top/Bottom */
switch(conf.titlebar.pos)
{
default:
case Top:
y = c->geo.y - conf.titlebar.height;
break;
case Bottom:
y = c->geo.y + c->geo.height + conf.client.borderheight;
break;
}
c->tbar = bar_create(c->geo.x, y, c->geo.width,
c->tbar = bar_create(c->geo.x, c->geo.y, c->geo.width,
conf.titlebar.height - conf.client.borderheight,
conf.client.borderheight,
conf.titlebar.bg_normal, True);
XSetWindowBorder(dpy, c->tbar->win, conf.titlebar.bg_normal);
0, conf.titlebar.bg_normal, True);
titlebar_update_position(c);
return;
}
@ -100,7 +85,7 @@ titlebar_update_position(Client *c)
break;
}
bar_move(c->tbar, c->geo.x, y);
bar_resize(c->tbar, c->geo.width, conf.titlebar.height - conf.client.borderheight);
bar_resize(c->tbar, c->geo.width + c->border * 2, conf.titlebar.height);
return;
}
@ -112,6 +97,7 @@ titlebar_update(Client *c)
uint bg;
char *fg;
/* Get the window name, will be free by XFree later... */
XFetchName(dpy, c->win, &(c->title));
if(!c->title)
c->title = strdup("WMFS");
@ -150,7 +136,7 @@ titlebar_update(Client *c)
}
/* Set y text position (always at the middle) and fg color */
pos_y = (font->height - (font->descent ) - 1) + ((conf.titlebar.height - font->height) / 2);
pos_y = (font->height - (font->descent )) + ((conf.titlebar.height - font->height) / 2);
/* Draw title */
draw_text(c->tbar->dr, pos_x, pos_y, fg, bg, 0, c->title);