all: Fix segfault (remove titlebar border again)
This commit is contained in:
parent
4bd8a487e9
commit
add0f0187b
27
src/client.c
27
src/client.c
@ -125,21 +125,16 @@ client_focus(Client *c)
|
||||
{
|
||||
grabbuttons(sel, False);
|
||||
XSetWindowBorder(dpy, sel->win, conf.client.bordernormal);
|
||||
if(conf.titlebar.exist)
|
||||
XSetWindowBorder(dpy, sel->tbar->win, conf.client.bordernormal);
|
||||
}
|
||||
|
||||
if(c)
|
||||
grabbuttons(c, True);
|
||||
|
||||
sel = c;
|
||||
selbytag[seltag] = sel;
|
||||
selbytag[seltag] = sel = c;
|
||||
|
||||
if(c)
|
||||
{
|
||||
XSetWindowBorder(dpy, c->win, conf.client.borderfocus);
|
||||
if(conf.titlebar.exist)
|
||||
XSetWindowBorder(dpy, sel->tbar->win, conf.client.borderfocus);
|
||||
if(conf.raisefocus)
|
||||
client_raise(c);
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
@ -219,13 +214,14 @@ client_map(Client *c)
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
if(conf.titlebar.exist)
|
||||
{
|
||||
XMapWindow(dpy, c->tbar->win);
|
||||
bar_refresh(c->tbar);
|
||||
}
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -265,14 +261,12 @@ client_manage(Window w, XWindowAttributes *wa)
|
||||
c->tag = t->tag;
|
||||
if(!c->free)
|
||||
c->free = (rettrans == Success) || c->hint;
|
||||
else
|
||||
client_raise(c);
|
||||
efree(t);
|
||||
|
||||
|
||||
client_attach(c);
|
||||
XMoveResizeWindow(dpy, c->win, c->geo.x, c->geo.y, c->geo.width, c->geo.height);
|
||||
client_map(c);
|
||||
client_raise(c);
|
||||
setwinstate(c->win, NormalState);
|
||||
client_focus(c);
|
||||
arrange();
|
||||
@ -430,13 +424,12 @@ client_raise(Client *c)
|
||||
if(!c || c->tile || c->max)
|
||||
return;
|
||||
|
||||
XRaiseWindow(dpy, c->win);
|
||||
|
||||
if(conf.titlebar.exist)
|
||||
{
|
||||
XRaiseWindow(dpy, c->tbar->win);
|
||||
titlebar_update(c);
|
||||
}
|
||||
XRaiseWindow(dpy, c->win);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -463,19 +456,23 @@ client_unhide(Client *c)
|
||||
void
|
||||
client_unmanage(Client *c)
|
||||
{
|
||||
int i;
|
||||
Client *cc;
|
||||
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(errorhandlerdummy);
|
||||
if(sel == c)
|
||||
client_focus(NULL);
|
||||
for(i = 0, cc = clients; cc; cc = cc->next, ++i)
|
||||
if(selbytag[i] == c)
|
||||
selbytag[i] = NULL;
|
||||
client_detach(c);
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
setwinstate(c->win, WithdrawnState);
|
||||
|
||||
XSync(dpy, False);
|
||||
XUngrabServer(dpy);
|
||||
|
||||
if(conf.titlebar.exist)
|
||||
bar_delete(c->tbar);
|
||||
titlebar_delete(c);
|
||||
efree(c);
|
||||
XSetErrorHandler(errorhandler);
|
||||
arrange();
|
||||
|
||||
@ -92,10 +92,10 @@ draw_taglist(Drawable dr)
|
||||
void
|
||||
draw_layout(void)
|
||||
{
|
||||
draw_text(bar->dr, taglen[conf.ntag] + BPAD/2, fonth,
|
||||
draw_text(bar->dr, taglen[conf.ntag] + 1, fonth,
|
||||
conf.colors.layout_fg,
|
||||
conf.colors.layout_bg,
|
||||
BPAD, tags[seltag].layout.symbol);
|
||||
2, tags[seltag].layout.symbol);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -396,10 +396,7 @@ unmapnotify(XEvent ev)
|
||||
Client *c;
|
||||
|
||||
if((c = client_get(ev.xunmap.window)))
|
||||
if(ev.xunmap.send_event
|
||||
&& ev.xunmap.event == RootWindow(ev.xany.display, screen)
|
||||
&& getwinstate(c->win) == NormalState)
|
||||
client_unmanage(c);
|
||||
client_unmanage(c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,9 +45,10 @@ arrange(void)
|
||||
|
||||
tags[seltag].layout.func();
|
||||
|
||||
if(selbytag[seltag] && selbytag[seltag]->win)
|
||||
if(selbytag[seltag] != NULL
|
||||
&& selbytag[seltag]->tbar != NULL)
|
||||
client_focus(selbytag[seltag]);
|
||||
else
|
||||
else
|
||||
client_focus(NULL);
|
||||
|
||||
updatebar();
|
||||
@ -71,8 +72,8 @@ freelayout(void)
|
||||
geo.y = c->ogeo.y;
|
||||
geo.width = c->ogeo.width;
|
||||
geo.height = c->ogeo.height;
|
||||
client_moveresize(c, geo, True);
|
||||
c->tile = c->lmax = False;
|
||||
client_moveresize(c, geo, True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ struct Client
|
||||
int border;
|
||||
/* Client Layout Information */
|
||||
Bool max, tile, free;
|
||||
Bool hint, lmax;
|
||||
Bool hint, lmax, havetbar;
|
||||
/* Struct in chains */
|
||||
Client *next;
|
||||
Client *prev;
|
||||
|
||||
@ -38,18 +38,31 @@ titlebar_create(Client *c)
|
||||
int y;
|
||||
|
||||
/* Set titlebar position : Top/Bottom */
|
||||
if(conf.titlebar.pos)
|
||||
switch(conf.titlebar.pos)
|
||||
{
|
||||
case Bottom:
|
||||
y = c->geo.y + c->geo.height + conf.client.borderheight;
|
||||
else
|
||||
break;
|
||||
default:
|
||||
case Top:
|
||||
y = c->geo.y - (conf.titlebar.height + conf.client.borderheight);
|
||||
break;
|
||||
}
|
||||
|
||||
c->tbar = bar_create(c->geo.x,
|
||||
y,
|
||||
c->geo.width,
|
||||
c->tbar = bar_create(c->geo.x, y, c->geo.width,
|
||||
conf.titlebar.height - conf.client.borderheight,
|
||||
conf.client.borderheight,
|
||||
conf.titlebar.bg, True);
|
||||
XSetWindowBorder(dpy, c->tbar->win, conf.client.bordernormal);
|
||||
XSetWindowBorder(dpy, c->tbar->win, conf.titlebar.bg);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
titlebar_delete(Client *c)
|
||||
{
|
||||
bar_delete(c->tbar);
|
||||
c->tbar = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -102,6 +102,7 @@ quit(void)
|
||||
efree(keys);
|
||||
efree(conf.titlebar.mouse);
|
||||
efree(conf.client.mouse);
|
||||
efree(conf.root.mouse);
|
||||
XSync(dpy, False);
|
||||
|
||||
return;
|
||||
|
||||
@ -60,7 +60,6 @@
|
||||
#define ITOA(p ,n) sprintf(p, "%i", n)
|
||||
#define debug(p) fprintf(stderr, "debug: %i\n", p)
|
||||
#define PAD 8
|
||||
#define BPAD 2
|
||||
|
||||
/* bar.c */
|
||||
BarWindow *bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask);
|
||||
@ -138,6 +137,7 @@ void uicb_tagtransfert(uicb_t);
|
||||
|
||||
/* titlebar.c */
|
||||
void titlebar_create(Client *c);
|
||||
void titlebar_delete(Client *c);
|
||||
Client* titlebar_get(Window w);
|
||||
void titlebar_update_position(Client *c);
|
||||
void titlebar_update(Client *c);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user