X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=event.c;h=20c1533c6adc74132650351d57fb5a799d63c1b9;hb=dee5ea23358ec0a9684265dc8cb1d2e4d56e9b84;hp=b23fd3f6e8da87ba5b36809dd6de820f655e9bd8;hpb=ebd17e4827ba4ad21b8f323765abef893316436b;p=dwm.git diff --git a/event.c b/event.c index b23fd3f..20c1533 100644 --- a/event.c +++ b/event.c @@ -1,4 +1,4 @@ -/* (C)opyright MMVI Anselm R. Garbe +/* (C)opyright MMVI-MMVII Anselm R. Garbe * See LICENSE file for license details. */ #include "dwm.h" @@ -131,8 +131,20 @@ buttonpress(XEvent *e) { return; } } - if((ev->x < x + bmw) && (ev->button == Button1)) - togglemode(NULL); + if(ev->x < x + bmw) + switch(ev->button) { + case Button1: + togglemode(NULL); + break; + case Button4: + a.i = 1; + incnmaster(&a); + break; + case Button5: + a.i = -1; + incnmaster(&a); + break; + } } else if((c = getclient(ev->window))) { focus(c); @@ -184,7 +196,7 @@ configurerequest(XEvent *e) { if(c->isfloat) { resize(c, False, TopLeft); if(!isvisible(c)) - ban(c); + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); } else arrange(); @@ -218,25 +230,23 @@ enternotify(XEvent *e) { if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; - if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) + if((c = getclient(ev->window)) && isvisible(c)) focus(c); else if(ev->window == root) { issel = True; XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - drawall(); + if(sel) + XSetWindowBorder(dpy, sel->win, dc.sel[ColBorder]); } } static void expose(XEvent *e) { - Client *c; XExposeEvent *ev = &e->xexpose; if(ev->count == 0) { if(barwin == ev->window) drawstatus(); - else if((c = getctitle(ev->window))) - drawtitle(c); } } @@ -264,7 +274,8 @@ leavenotify(XEvent *e) { if((ev->window == root) && !ev->same_screen) { issel = False; - drawall(); + if(sel) + XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); } } @@ -319,8 +330,8 @@ propertynotify(XEvent *e) { } if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { updatetitle(c); - resizetitle(c); - drawtitle(c); + if(c == sel) + drawstatus(); } } }