X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=ac534a8c73f74020056d6942cd1b92f4caea4f99;hp=b3a389d6811ef993904252ed38502d531adfcf70;hb=a88e0373efe5f6800a99fca2c228be98b522aaa9;hpb=9e8dd3479da9f484c9aa37adcd327989149e89ef diff --git a/dwm.c b/dwm.c index b3a389d..ac534a8 100644 --- a/dwm.c +++ b/dwm.c @@ -41,6 +41,7 @@ #endif /* XINERAMA */ /* macros */ +#define D if(1) #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) @@ -847,7 +848,8 @@ focusmon(const Arg *arg) { if(!mons->next) return; - m = dirtomon(arg->i); + if((m = dirtomon(arg->i)) == selmon) + return; unfocus(selmon->sel); selmon = m; focus(NULL); @@ -1388,12 +1390,27 @@ restack(Monitor *m) { void run(void) { XEvent ev; - + static const char *evname[LASTEvent] = { + [ButtonPress] = "buttonpress", + [ConfigureRequest] = "configurerequest", + [ConfigureNotify] = "configurenotify", + [DestroyNotify] = "destroynotify", + [EnterNotify] = "enternotify", + [Expose] = "expose", + [FocusIn] = "focusin", + [KeyPress] = "keypress", + [MappingNotify] = "mappingnotify", + [MapRequest] = "maprequest", + [PropertyNotify] = "propertynotify", + [UnmapNotify] = "unmapnotify" + }; /* main event loop */ XSync(dpy, False); - while(running && !XNextEvent(dpy, &ev)) + while(running && !XNextEvent(dpy, &ev)) { + D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window); if(handler[ev.type]) handler[ev.type](&ev); /* call handler */ + } } void @@ -1449,10 +1466,9 @@ void setlayout(const Arg *arg) { if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) selmon->sellt ^= 1; - if(arg && arg->v) { + if(arg && arg->v) selmon->lt[selmon->sellt] = (Layout *)arg->v; - strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); - } + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); if(selmon->sel) arrange(selmon); else