XButtonPressedEvent *ev = &e->xbutton;
if(barwin == ev->window) {
- if(ev->x < modew)
- togglemode(NULL);
- else {
- x = modew;
- for(a.i = 0; a.i < ntags; a.i++) {
- x += textw(tags[a.i]);
- if(ev->x < x) {
- if(ev->button == Button1)
+ x = 0;
+ for(a.i = 0; a.i < ntags; a.i++) {
+ x += textw(tags[a.i]);
+ if(ev->x < x) {
+ if(ev->button == Button1) {
+ if(ev->state & MODKEY)
+ tag(&a);
+ else
view(&a);
- else if(ev->button == Button3)
+ }
+ else if(ev->button == Button3) {
+ if(ev->state & MODKEY)
+ toggletag(&a);
+ else
toggleview(&a);
- return;
}
+ return;
}
}
+ if(ev->x < x + bmw) {
+ if(ev->button == Button1)
+ togglemode(NULL);
+ }
}
else if((c = getclient(ev->window))) {
focus(c);
- if(CLEANMASK(ev->state) == 0)
+ if(maximized || CLEANMASK(ev->state) != MODKEY)
return;
- switch(ev->button) {
- default:
- break;
- case Button1:
- if(!c->ismax && (arrange == dofloat || c->isfloat)) {
- restack(c);
- movemouse(c);
- }
- break;
- case Button2:
+ if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) {
+ restack(c);
+ movemouse(c);
+ }
+ else if(ev->button == Button2)
zoom(NULL);
- break;
- case Button3:
- if(!c->ismax && (arrange == dofloat || c->isfloat)) {
- restack(c);
- resizemouse(c);
- }
- break;
+ else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)) {
+ restack(c);
+ resizemouse(c);
}
}
}
+static void
+synconfig(Client *c, int x, int y, int w, int h, unsigned int border)
+{
+ XEvent synev;
+
+ synev.type = ConfigureNotify;
+ synev.xconfigure.display = dpy;
+ synev.xconfigure.event = c->win;
+ synev.xconfigure.window = c->win;
+ synev.xconfigure.x = x;
+ synev.xconfigure.y = y;
+ synev.xconfigure.width = w;
+ synev.xconfigure.height = h;
+ synev.xconfigure.border_width = border;
+ synev.xconfigure.above = None;
+ XSendEvent(dpy, c->win, True, NoEventMask, &synev);
+}
+
static void
configurerequest(XEvent *e)
{
unsigned long newmask;
Client *c;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
- XEvent synev;
XWindowChanges wc;
if((c = getclient(ev->window))) {
+ if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) {
+ synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width);
+ XSync(dpy, False);
+ return;
+ }
gravitate(c, True);
if(ev->value_mask & CWX)
c->x = ev->x;
newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
if(newmask)
XConfigureWindow(dpy, c->win, newmask, &wc);
- else {
- synev.type = ConfigureNotify;
- synev.xconfigure.display = dpy;
- synev.xconfigure.event = c->win;
- synev.xconfigure.window = c->win;
- synev.xconfigure.x = c->x;
- synev.xconfigure.y = c->y;
- synev.xconfigure.width = c->w;
- synev.xconfigure.height = c->h;
- synev.xconfigure.border_width = c->border;
- synev.xconfigure.above = None;
- /* Send synthetic ConfigureNotify */
- XSendEvent(dpy, c->win, True, NoEventMask, &synev);
- }
+ else
+ synconfig(c, c->x, c->y, c->w, c->h, c->border);
XSync(dpy, False);
if(c->isfloat)
resize(c, False, TopLeft);