X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=wm.c;h=038e6b9b9971bf2b564708a010459d39e064f3a1;hb=366d81e313e6dd4e9e6c61ed8dfca4b4b40ccde6;hp=843aaac30fbd83ddbd89febb77b4fe37d6e5694e;hpb=3a69c5173cdd24959410870bec2a10a76272e034;p=dwm.git diff --git a/wm.c b/wm.c index 843aaac..038e6b9 100644 --- a/wm.c +++ b/wm.c @@ -20,10 +20,10 @@ Atom wm_atom[WMLast], net_atom[NetLast]; Cursor cursor[CurLast]; XRectangle rect, barrect; Bool running = True; +Client *client = NULL; -char *bartext; +char *bartext, tag[256]; int screen, sel_screen; -unsigned int lock_mask, numlock_mask; /* draw structs */ Brush brush = {0}; @@ -74,12 +74,11 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, &res, &extra, prop); - if(status != Success || *prop == 0) { + if(status != Success || *prop == NULL) { return 0; } - if(res == 0) { + if(res == 0) free((void *) *prop); - } return res; } @@ -144,32 +143,6 @@ startup_error_handler(Display *dpy, XErrorEvent *error) } static void -init_lock_keys() -{ - XModifierKeymap *modmap; - KeyCode numlock; - int i; - static int masks[] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, - Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask - }; - - numlock_mask = 0; - modmap = XGetModifierMapping(dpy); - numlock = XKeysymToKeycode(dpy, XStringToKeysym("Num_Lock")); - - if(modmap && modmap->max_keypermod > 0) { - int max = (sizeof(masks) / sizeof(int)) * modmap->max_keypermod; - for(i = 0; i < max; i++) - if(numlock && (modmap->modifiermap[i] == numlock)) - numlock_mask = masks[i / modmap->max_keypermod]; - } - XFreeModifiermap(modmap); - - lock_mask = 255 & ~(numlock_mask | LockMask); -} - -static void cleanup() { /* @@ -243,7 +216,7 @@ main(int argc, char *argv[]) cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); - init_lock_keys(); + update_keys(); brush.drawable = XCreatePixmap(dpy, root, rect.width, rect.height, DefaultDepth(dpy, screen)); @@ -264,7 +237,7 @@ main(int argc, char *argv[]) barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - bartext = 0; + bartext = NULL; XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); draw_bar();