[wmii] small patch for wmiimenu.c

From: WUSTRACK Jonas <Jonas.WUSTRACK_AT_supinfo.com>
Date: Wed, 3 May 2006 12:52:12 +0200

Hi,

I've noticed that sometimes when calling wmiimenu and beginning to type just after, the first characters are ignored by wmiimenu and thus sent to the selected client. This can be quite annoying especially with clients like vi.
Thus I've made a simple patch, putting the XKeyGrab call as early as possible in main (so just after the initialization of dpy).
It worked for me and I don't think it could cause any problems on other systems.

Here's the patch (hg diff on the lastest hg):

--- a/cmd/wmiimenu.c Tue May 02 20:11:44 2006 +0000
+++ b/cmd/wmiimenu.c Wed May 03 12:45:57 2006 +0200
@@ -336,6 +336,12 @@ main(int argc, char *argv[])
                fprintf(stderr, "%s", "wmiimenu: cannot open display\n");
                exit(1);
        }
+
+ while(XGrabKeyboard
+ (dpy, RootWindow(dpy, screen), True, GrabModeAsync,
+ GrabModeAsync, CurrentTime) != GrabSuccess)
+ usleep(1000);
+
        screen = DefaultScreen(dpy);
 
        /* set font and colors */
@@ -383,11 +389,6 @@ main(int argc, char *argv[])
        draw_menu();
        XSync(dpy, False);
 
- while(XGrabKeyboard
- (dpy, RootWindow(dpy, screen), True, GrabModeAsync,
- GrabModeAsync, CurrentTime) != GrabSuccess)
- usleep(1000);
-
        /* main event loop */
 
        while(!XNextEvent(dpy, &ev)) {

Regards,

Jonas Wustrack (doez)
Received on Wed May 03 2006 - 12:53:45 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:04:10 UTC