Client/Button/Titlbar: Fix potential segfault.

This commit is contained in:
Martin Duquesnoy 2009-03-23 02:24:28 +01:00
parent d51ee4deda
commit ac7b3b0d15
3 changed files with 8 additions and 4 deletions

View File

@ -238,7 +238,7 @@ client_focus(Client *c)
Client *c;
int i;
if(!BUTTONWH)
if(!BUTTONWH || !(TBARH - BORDH))
return NULL;
for(c = clients; c; c = c->next)

View File

@ -423,6 +423,7 @@ maprequest(XMapRequestEvent *ev)
CHECK(XGetWindowAttributes(dpy, ev->window, &at));
CHECK(!at.override_redirect);
if(!(c = client_gb_win(ev->window)))
client_manage(ev->window, &at);
@ -440,6 +441,7 @@ propertynotify(XPropertyEvent *ev)
if(ev->state == PropertyDelete)
return;
if((c = client_gb_win(ev->window)))
{
switch(ev->atom)
@ -453,9 +455,11 @@ propertynotify(XPropertyEvent *ev)
case XA_WM_NORMAL_HINTS:
client_size_hints(c);
break;
case XA_WM_NAME:
client_get_name(c);
break;
}
if(ev->atom == XA_WM_NAME
|| ev->atom == net_atom[net_wm_name])
if(ev->atom == net_atom[net_wm_name])
client_get_name(c);
}

View File

@ -206,7 +206,7 @@ frame_update(Client *c)
if(conf.titlebar.nbutton && BUTTONWH >= 1)
{
if(conf.titlebar.stipple)
draw_rectangle(c->titlebar->dr, 0, 0, c->button_last_x + TBARH,
draw_rectangle(c->titlebar->dr, 0, 0, c->button_last_x + TBARH - (TBARH / 4),
TBARH + BORDH * 2, c->colors.frame);
for(i = 0; i < conf.titlebar.nbutton; ++i)