From 460cd6923baff9f5543c7c3b2cceeefda85e8ac9 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 12 Aug 2008 14:36:03 +0200 Subject: [PATCH] [wmfs.c] Fix ydb's bug (client bar block) --- local.h | 2 +- wmfs.c | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/local.h b/local.h index 21a5b10..8acbd84 100644 --- a/local.h +++ b/local.h @@ -32,7 +32,7 @@ #define ALT Mod1Mask #define SHIFT ShiftMask #define LEN(x) (sizeof x / sizeof x[0]) -#define ITOA(p,n) sprintf(p,"%i",n) +#define ITOA(p,n) sprintf(p,"%i",n) #define Move 0 #define Resize 1 #define MAXTAG 36 diff --git a/wmfs.c b/wmfs.c index 0e8c43a..68c42bd 100644 --- a/wmfs.c +++ b/wmfs.c @@ -138,6 +138,7 @@ getevent(void) { int i; char s[6]; struct timeval tv; + if(QLength(dpy) > 0) { XNextEvent(dpy, &event); } else { @@ -185,8 +186,6 @@ getevent(void) { c->title = NULL; updatetitle(c); } - if(event.xproperty.atom == XA_WM_NORMAL_HINTS) - setsizehints(c); } } break; @@ -327,9 +326,9 @@ grabkeys(void) { void hide(Client *c) { if(c) { - XMoveWindow(dpy,c->win,c->x,c->y+mh*2); - XMoveWindow(dpy,c->tbar,c->x,c->y+mh*2); - XMoveWindow(dpy,c->button,c->x,c->y+mh*2); + XMoveWindow(dpy, c->win, c->x, c->y+mh*2); + XMoveWindow(dpy, c->tbar, c->x, c->y+mh*2); + XMoveWindow(dpy, c->button, c->x, c->y+mh*2); } } @@ -398,7 +397,7 @@ init(void) { CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); XSetWindowBackground(dpy, bar, conf.colors.bar); - XMapWindow(dpy, bar); + XMapRaised(dpy, bar); /* INIT STUFF */ XSetErrorHandler(errorhandler); @@ -610,6 +609,14 @@ mouseaction(Client *c, int x, int y, int type) { (ocx + (ev.xmotion.x - x)), (ocy + (ev.xmotion.y - y)), c->w, c->h); + + if(conf.clientbarblock) { + if(c->y < barheight + conf.ttbarheight - 5) { + moveresize(c, c->x, barheight+conf.ttbarheight, c->w, c->h); + XUngrabPointer(dpy, CurrentTime); + return; + } + } } } return; @@ -636,9 +643,10 @@ moveresize(Client *c, int x, int y, int w, int h) { c->w = w; c->h = h; - if(conf.clientbarblock) + if(conf.clientbarblock) { if((y-conf.ttbarheight) <= barheight) y = barheight+conf.ttbarheight; + } else updatebar(); XMoveResizeWindow(dpy, c->win, x, y, w ,h); XMoveResizeWindow(dpy, c->tbar, x, y - conf.ttbarheight, w, conf.ttbarheight); @@ -746,6 +754,7 @@ tag(char *cmd) { if(c->tag == tmp) unhide(c); } + seltag = tmp; sel = NULL; return; @@ -765,9 +774,8 @@ tagswitch(char *cmd) { for(c = clients; c; c = c->next) { if(c->tag == seltag - tmp) hide(c); - if(c->tag == seltag) { + if(c->tag == seltag) unhide(c); - } } sel = NULL; return; @@ -862,6 +870,9 @@ unhide(Client *c) { XMoveWindow(dpy,c->button, (c->x + c->w -10), (c->y - 9)); + if(conf.clientbarblock) + if(c->y+conf.ttbarheight <= barheight) + moveresize(c, c->x, barheight + conf.ttbarheight, c->w, c->h); } } @@ -932,6 +943,7 @@ updatebar(void) { XSetForeground(dpy, gc, conf.colors.text); XDrawString(dpy, bar, gc, mw- j*6, fonth -1 , status, j); XDrawLine(dpy, bar, gc, mw-j*6-5, 0 , mw-j*6-5, barheight); + XSync(dpy, False); return; }