summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authoroga <oga>2008-07-22 20:51:54 +0000
committeroga <oga>2008-07-22 20:51:54 +0000
commit0df9e0673c948d588be79ba5beef761d3709b3d5 (patch)
tree11397963f0df661d2cc1bb2fb4001f7336ef49ce /calmwm.c
parent436a9e5c54297a7b9b684d307106e62764cd5e93 (diff)
downloadcwm-0df9e0673c948d588be79ba5beef761d3709b3d5.tar.gz
cwm-0df9e0673c948d588be79ba5beef761d3709b3d5.tar.xz
cwm-0df9e0673c948d588be79ba5beef761d3709b3d5.zip
We've been handling grabbing wrong all this time (noticed at c2k8).
add conf_grab() and conf_ungrab, and use them in the keybinding manipulation
functions to {,un}grab the binding for all screens we have defined.

the lovely little ordering problem comes in here, since when we parse
the config initially Screenq is empty, so regrab after we fill the
queue, hopefully later reordering will remove this little need and there
will be much rejoicing.

ok okan.
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/calmwm.c b/calmwm.c
index 419585d..2ef2c8b 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -127,6 +127,7 @@ void
 x_setup(void)
 {
 	struct screen_ctx	*sc;
+	struct keybinding	*kb;
 	int			 i;
 
 	Nscreens = ScreenCount(X_Dpy);
@@ -136,6 +137,14 @@ x_setup(void)
 		TAILQ_INSERT_TAIL(&Screenq, sc, entry);
 	}
 
+	/*
+	 * XXX key grabs weren't done before, since Screenq was empty,
+	 * do them here for now (this needs changing).
+	 */
+	TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
+		conf_grab(&Conf, kb);
+
+
 	Cursor_move = XCreateFontCursor(X_Dpy, XC_fleur);
 	Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
 	Cursor_select = XCreateFontCursor(X_Dpy, XC_hand1);
@@ -151,7 +160,6 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	Window			*wins, w0, w1;
 	XWindowAttributes	 winattr;
 	XSetWindowAttributes	 rootattr;
-	struct keybinding	*kb;
 	u_int			 nwins, i;
 
 	Curscreen = sc;
@@ -178,9 +186,6 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which),
 	    "black", &sc->blackcolor, &tmp);
 
-	TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
-		xu_key_grab(sc->rootwin, kb->modmask, kb->keysym);
-
 	sc->blackpixl = BlackPixel(X_Dpy, sc->which);
 	sc->whitepixl = WhitePixel(X_Dpy, sc->which);
 	sc->bluepixl = sc->fccolor.pixel;