[PATCH to panel] popup menu and "run" dialog independant of the state of ScrollLock and NumLock



 Hi, 

 Currently, the panel, as shipped with gnome-1.4b1, won't popup menu or
"Run.." dialog if any of additional modifiers (like scrolllock, numlock,
capslock or even alternative keyboard group) is active.

 This patch fixes this problem,

 What do you think about it?

 Best regards,
  -Vlad
diff -ru panel~/global-keys.c panel/global-keys.c
--- panel~/global-keys.c	Tue Jan 30 20:59:56 2001
+++ panel/global-keys.c	Tue Feb 27 21:49:45 2001
@@ -27,10 +27,10 @@
 
 	gdk_error_trap_push();
 	if (lastkey_menu)
-		XUngrabKey (GDK_DISPLAY(), lastkey_menu, laststate_menu,
+		XUngrabKey (GDK_DISPLAY(), lastkey_menu, AnyModifier,
 			    GDK_ROOT_WINDOW());
 	if (lastkey_run && !same)
-		XUngrabKey (GDK_DISPLAY(), lastkey_run, laststate_run,
+		XUngrabKey (GDK_DISPLAY(), lastkey_run, AnyModifier,
 			    GDK_ROOT_WINDOW());
 	
 	if (global_config.keys_enabled && 
@@ -39,7 +39,7 @@
 						global_config.menu_keysym);
 		laststate_menu = global_config.menu_state;
 		if(lastkey_menu)
-			XGrabKey (GDK_DISPLAY(), lastkey_menu, laststate_menu, 
+			XGrabKey (GDK_DISPLAY(), lastkey_menu, AnyModifier, 
 				  GDK_ROOT_WINDOW(), True,
 				  GrabModeAsync, GrabModeAsync);
 	} else
@@ -53,7 +53,7 @@
 		if(lastkey_run &&
 		   (lastkey_menu != lastkey_run ||
 		    laststate_menu != laststate_run))
-			XGrabKey (GDK_DISPLAY(), lastkey_run, laststate_run, 
+			XGrabKey (GDK_DISPLAY(), lastkey_run, AnyModifier, 
 				  GDK_ROOT_WINDOW(), True,
 				  GrabModeAsync, GrabModeAsync);
 	} else
@@ -71,10 +71,14 @@
 	guint keycode, state;
 	guint menu_keycode, menu_state;
 	guint run_keycode, run_state;
+	guint ignored_mods;
 
 	if(xevent->type != KeyRelease)
 		return GDK_FILTER_CONTINUE;
-
+	
+	ignored_mods = ~(GDK_LOCK_MASK /*capslock*/ | GDK_MOD2_MASK /*numlk*/ | 
+		GDK_MOD5_MASK /*scrolllock*/| 0x2000 /*Xkb modifier*/);
+		
 	keycode = xevent->xkey.keycode;
 	state = xevent->xkey.state;
 
@@ -87,7 +91,7 @@
 	run_state = global_config.run_state;
 
 	if (keycode == menu_keycode &&
-	    state == menu_state) {
+	    (state & ignored_mods) == menu_state) {
 		PanelWidget *panel;
 		GtkWidget *menu, *basep;
 		/* check if anybody else has a grab */
@@ -110,7 +114,7 @@
 				NULL, NULL, 0, GDK_CURRENT_TIME);
 		return GDK_FILTER_REMOVE;
 	} else if (keycode == run_keycode &&
-		   state == run_state) {
+		   (state & ignored_mods) == run_state) {
 		/* check if anybody else has a grab */
 		if (gdk_pointer_grab (GDK_ROOT_PARENT(), FALSE, 
 				      0, NULL, NULL, GDK_CURRENT_TIME)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]