summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2011-06-24 06:52:23 +0000
committerokan <okan>2011-06-24 06:52:23 +0000
commitd8747ae7023d5c5e2c6542a835c008b262261e82 (patch)
treefe652b8825304bd99475d3b7f524c4f8e88f4712
parent8f1c5833613687e67c8422bd50c34b4d11fa2e6c (diff)
downloadcwm-d8747ae7023d5c5e2c6542a835c008b262261e82.tar.gz
cwm-d8747ae7023d5c5e2c6542a835c008b262261e82.tar.xz
cwm-d8747ae7023d5c5e2c6542a835c008b262261e82.zip
add 'normal' cursor and shuffle the others we use to make a bit more
sense and to be slightly less un-expected.  from Alexander Polakov.
re-use 'normal' cursor now instead XC_hand1 for menu selection.  i
really wish X had real docs and made sense.

ok on earlier diff with '?' removed (but it's back now) oga@
-rw-r--r--calmwm.c21
-rw-r--r--calmwm.h6
-rw-r--r--menu.c2
3 files changed, 15 insertions, 14 deletions
diff --git a/calmwm.c b/calmwm.c
index 0348454..8d90af1 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -35,11 +35,11 @@
 
 Display				*X_Dpy;
 
-Cursor				 Cursor_move;
-Cursor				 Cursor_resize;
-Cursor				 Cursor_select;
 Cursor				 Cursor_default;
+Cursor				 Cursor_move;
+Cursor				 Cursor_normal;
 Cursor				 Cursor_question;
+Cursor				 Cursor_resize;
 
 struct screen_ctx_q		 Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
 struct client_ctx_q		 Clientq = TAILQ_HEAD_INITIALIZER(Clientq);
@@ -120,6 +120,12 @@ x_setup(void)
 	struct keybinding	*kb;
 	int			 i;
 
+	Cursor_default = XCreateFontCursor(X_Dpy, XC_X_cursor);
+	Cursor_move = XCreateFontCursor(X_Dpy, XC_fleur);
+	Cursor_normal = XCreateFontCursor(X_Dpy, XC_left_ptr);
+	Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
+	Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
+
 	for (i = 0; i < ScreenCount(X_Dpy); i++) {
 		sc = xcalloc(1, sizeof(*sc));
 		x_setupscreen(sc, i);
@@ -132,12 +138,6 @@ x_setup(void)
 	 */
 	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);
-	Cursor_default = XCreateFontCursor(X_Dpy, XC_X_cursor);
-	Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
 }
 
 static void
@@ -179,11 +179,12 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 
 	xu_setwmname(sc);
 
+	rootattr.cursor = Cursor_normal;
 	rootattr.event_mask = ChildMask|PropertyChangeMask|EnterWindowMask|
 	    LeaveWindowMask|ColormapChangeMask|ButtonMask;
 
 	XChangeWindowAttributes(X_Dpy, sc->rootwin,
-	    CWEventMask, &rootattr);
+	    CWEventMask|CWCursor, &rootattr);
 
 	/* Deal with existing clients. */
 	XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
diff --git a/calmwm.h b/calmwm.h
index 168577b..d41d443 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -473,11 +473,11 @@ char			*xstrdup(const char *);
 /* Externs */
 extern Display				*X_Dpy;
 
-extern Cursor				 Cursor_move;
-extern Cursor				 Cursor_resize;
-extern Cursor				 Cursor_select;
 extern Cursor				 Cursor_default;
+extern Cursor				 Cursor_move;
+extern Cursor				 Cursor_normal;
 extern Cursor				 Cursor_question;
+extern Cursor				 Cursor_resize;
 
 extern struct screen_ctx_q		 Screenq;
 extern struct client_ctx_q		 Clientq;
diff --git a/menu.c b/menu.c
index 660ff8b..04870fe 100644
--- a/menu.c
+++ b/menu.c
@@ -405,7 +405,7 @@ menu_handle_move(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc)
 		XFillRectangle(X_Dpy, sc->menuwin, sc->gc, 0,
 		    font_height(sc) * mc->prev, mc->width, font_height(sc));
 	if (mc->entry != -1) {
-		xu_ptr_regrab(MenuGrabMask, Cursor_select);
+		xu_ptr_regrab(MenuGrabMask, Cursor_normal);
 		XFillRectangle(X_Dpy, sc->menuwin, sc->gc, 0,
 		    font_height(sc) * mc->entry, mc->width, font_height(sc));
 	} else