changeset: 1344:ba02dda36aee
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Mon Aug 25 09:44:23 2008 +0100
files: dwm.c
description:
grabbuttons() and grabkeys() are now independent from prior numlockmask initialization
diff -r f4707b7bd3a2 -r ba02dda36aee dwm.c
--- a/dwm.c Mon Aug 25 09:37:39 2008 +0100
+++ b/dwm.c Mon Aug 25 09:44:23 2008 +0100
@@ -191,6 +191,7 @@
static void unmapnotify(XEvent *e);
static void updatebar(void);
static void updategeom(void);
+static void updatenumlockmask(void);
static void updatesizehints(Client *c);
static void updatetitle(Client *c);
static void updatewmhints(Client *c);
@@ -735,34 +736,27 @@
void
grabbuttons(Client *c, Bool focused) {
- unsigned int i, j;
- unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
-
- XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
- if(focused) {
- for(i = 0; i < LENGTH(buttons); i++)
- if(buttons[i].click == ClkClientWin)
- for(j = 0; j < LENGTH(modifiers); j++)
- XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
- } else
- XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
- BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+ updatenumlockmask();
+ {
+ unsigned int i, j;
+ unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
+ XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+ if(focused) {
+ for(i = 0; i < LENGTH(buttons); i++)
+ if(buttons[i].click == ClkClientWin)
+ for(j = 0; j < LENGTH(modifiers); j++)
+ XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+ } else
+ XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
+ BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+ }
}
void
grabkeys(void) {
- unsigned int i, j;
- XModifierKeymap *modmap;
-
- /* update modifier map */
- modmap = XGetModifierMapping(dpy);
- for(i = 0; i < 8; i++)
- for(j = 0; j < modmap->max_keypermod; j++)
- if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
- numlockmask = (1 << i);
- XFreeModifiermap(modmap);
-
+ updatenumlockmask();
{ /* grab keys */
+ unsigned int i, j;
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
KeyCode code;
@@ -1576,6 +1570,20 @@
}
void
+updatenumlockmask(void) {
+ unsigned int i, j;
+ XModifierKeymap *modmap;
+
+ numlockmask = 0;
+ modmap = XGetModifierMapping(dpy);
+ for(i = 0; i < 8; i++)
+ for(j = 0; j < modmap->max_keypermod; j++)
+ if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
+ numlockmask = (1 << i);
+ XFreeModifiermap(modmap);
+}
+
+void
updatesizehints(Client *c) {
long msize;
XSizeHints size;
Received on Mon Aug 25 2008 - 08:44:27 UTC
This archive was generated by hypermail 2.2.0 : Mon Aug 25 2008 - 08:48:07 UTC