[hackers] [wmii] Don't confine the mouse to the menu in 9menu.

From: Kris Maglione <jg_AT_suckless.org>
Date: Thu Mar 01 02:19:30 2007

changeset: 1978:48c204455c1d
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Feb 28 20:16:21 2007 -0500
summary: Don't confine the mouse to the menu in 9menu.

diff -r f1bf18948bea -r 48c204455c1d 9menu.c
--- a/9menu.c Wed Feb 28 20:06:43 2007 -0500
+++ b/9menu.c Wed Feb 28 20:16:21 2007 -0500
@@ -424,9 +424,9 @@ run_menu()
                                 break;
                         i = ev.xbutton.y/high;
                         if (ev.xbutton.x < 0 || ev.xbutton.x > wide)
- break;
+ return;
                         else if (i < 0 || i >= numitems)
- break;
+ return;
                         if (teleport == Warp)
                                 restoremouse();
 
@@ -436,10 +436,8 @@ run_menu()
                 case MotionNotify:
                         old = cur;
                         cur = ev.xbutton.y/high;
- if (cur < 0)
- cur = 0;
- else if (cur >= numitems)
- cur = numitems - 1;
+ if (ev.xbutton.x < 0 || ev.xbutton.x > wide)
+ cur = ~0;
                         if (cur == old)
                                 break;
                         redraw(cur, high, wide);
@@ -452,7 +450,7 @@ run_menu()
                         redraw(cur = i, high, wide);
                         if(XGrabPointer(dpy, menuwin, False, MouseMask,
                                 GrabModeAsync, GrabModeAsync,
- menuwin, None, CurrentTime
+ 0, None, CurrentTime
                                 ) != GrabSuccess) {
                                 fprintf(stderr, "Failed to grab the mouse\n");
                         }
Received on Thu Mar 01 2007 - 02:19:30 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:01 UTC