summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2011-03-18 19:04:04 +0100
committerMichael Cardell Widerkrantz <mc@hack.org>2011-03-20 15:15:05 +0100
commit45f5e57d3d95b9b1ea5d5e043cac86f03f197e1a (patch)
treed8c14aed3635260a86c09532481a96d17af5ab64
parent979d3f738ba1ae16d37a940ef6dd7dd3e0fd1dc2 (diff)
downloadmcwm-45f5e57d3d95b9b1ea5d5e043cac86f03f197e1a.zip
Handle mapping notify and regrab of keys. When implementing this we
leaked memory. Noticed that we need to use special free() function for keysyms.
-rw-r--r--NEWS4
-rw-r--r--TODO4
-rw-r--r--mcwm.c21
3 files changed, 21 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index b10914c..cded7ce 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
User visible changes
+2011-03-18
+
+ * Now handles keyboard remapping.
+
2011-02-23
* If you change focus window mcwm remembers where we last had
diff --git a/TODO b/TODO
index 643cee2..028e51d 100644
--- a/TODO
+++ b/TODO
@@ -9,10 +9,6 @@
Partially done. Now grabs all our keys unshifted as well as shifted.
Needs a way to tell in config.h what extra modifier is used.
-* MappingNotify
-
- Need to handle any changes of the keyboard mapping.
-
* Feedback window
We need to tell the user the new geometry somehow. Is this what I
diff --git a/mcwm.c b/mcwm.c
index f5c03c0..6a1869c 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -1008,7 +1008,7 @@ int setupkeys(void)
/* Couldn't set up keys! */
/* Get rid of key symbols. */
- free(keysyms);
+ xcb_key_symbols_free(keysyms);
return -1;
}
@@ -1042,13 +1042,12 @@ int setupkeys(void)
}
} /* for */
-
/* Need this to take effect NOW! */
xcb_flush(conn);
/* Get rid of the key symbols table. */
- free(keysyms);
-
+ xcb_key_symbols_free(keysyms);
+
return 0;
}
@@ -3048,6 +3047,20 @@ void events(void)
}
break;
+ case XCB_MAPPING_NOTIFY:
+ /*
+ * XXX Gah! We get a new notify message for *every* key!
+ * We want to know when the entire keyboard is finished.
+ */
+
+ /* Forget old key bindings. */
+ xcb_ungrab_key(conn, XCB_GRAB_ANY, screen->root, XCB_MOD_MASK_ANY);
+
+ /* Use the new ones. */
+ setupkeys();
+
+ break;
+
case XCB_UNMAP_NOTIFY:
{
xcb_unmap_notify_event_t *e =