X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=5df4919ec073579cfccfb4edd87402e186f6d938;hp=88d80b2a447be77a7872e2ea3c0a82fb8f44a1cf;hb=5c6545adf5e2fc7011bd53735910f66998cade64;hpb=d6bdd03d915ecb800444986503b43aa488a82e36 diff --git a/dwm.c b/dwm.c index 88d80b2..5df4919 100644 --- a/dwm.c +++ b/dwm.c @@ -41,7 +41,6 @@ #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)) @@ -58,7 +57,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ -enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ +enum { NetSupported, NetWMName, NetWMState, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -815,8 +814,8 @@ void focus(Client *c) { if(!c || !ISVISIBLE(c)) for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); -// if(selmon->sel) -// unfocus(selmon->sel); + if(selmon->sel) + unfocus(selmon->sel); if(c) { if(c->mon != selmon) selmon = c->mon; @@ -848,7 +847,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); @@ -1389,24 +1389,9 @@ 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)) { - D fprintf(stderr, "run event %s\n", evname[ev.type]); if(handler[ev.type]) handler[ev.type](&ev); /* call handler */ } @@ -1509,6 +1494,7 @@ setup(void) { wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); + netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); @@ -2017,7 +2003,7 @@ zoom(const Arg *arg) { int main(int argc, char *argv[]) { if(argc == 2 && !strcmp("-v", argv[1])) - die("dwm-"VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n"); + die("dwm-"VERSION", © 2006-2010 dwm engineers, see LICENSE for details\n"); else if(argc != 1) die("usage: dwm [-v]\n"); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())