dmenu has a bug (or undesirable behaviour) in that it does not raise
itself back to the top if another window appears on top of it, yet it
will still keep keyboard focus, and the user will be typing into an
invisible (or obscured) window.

The attached patch makes dmenu raise itself (by XRaiseWindow) if it is
ever obscured by another window.

diff -r b21ae6af42b7 dmenu.c
--- a/dmenu.c	Thu Apr 01 19:30:21 2010 +0200
+++ b/dmenu.c	Thu Apr 01 21:17:07 2010 +0200
@@ -671,6 +671,10 @@
 			if(ev.xexpose.count == 0)
 				drawmenu();
 			break;
+		case VisibilityNotify:
+			if (ev.xvisibility.state != VisibilityUnobscured)
+				XRaiseWindow(dpy, win);
+			break;
 		}
 }
 
@@ -704,7 +708,7 @@
 	/* menu window */
 	wa.override_redirect = True;
 	wa.background_pixmap = ParentRelative;
-	wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask;
+	wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask | VisibilityChangeMask;
 
 	/* menu window geometry */
 	mh = dc.font.height + 2;

-- 
\  Troels
/\ Henriksen

Reply via email to