]> Dogcows Code - chaz/openbox/commitdiff
don't take KeyRelease events for menus until they receive a KeyPress event first...
authorDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 23:57:32 +0000 (18:57 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 23:57:32 +0000 (18:57 -0500)
openbox/event.c
openbox/menuframe.h

index d2cb7567c63fbb3027da80172265ff4e7641cfba..6b0ecdd7b04304ff88ec5bc6d4e6dbac46625656 100644 (file)
@@ -1671,6 +1671,8 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
 
     /* Allow control while going thru the menu */
     else if (ev->type == KeyPress && (state & ~ControlMask) == 0) {
+        frame->got_press = TRUE;
+
         if (keycode == ob_keycode(OB_KEY_ESCAPE)) {
             menu_frame_hide_all();
             ret = TRUE;
@@ -1704,7 +1706,7 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
 
        Allow ControlMask only, and don't bother if the menu is empty */
     else if (ev->type == KeyRelease && (state & ~ControlMask) == 0 &&
-             frame->entries)
+             frame->entries && frame->got_press)
     {
         if (keycode == ob_keycode(OB_KEY_RETURN)) {
             /* Enter runs the active item or goes into the submenu.
index 191bcfe8f4c5d68eb1397d7db94e56d40988199b..069759721e0c0b8a437156d2afe9dc69f3d10464 100644 (file)
@@ -73,6 +73,11 @@ struct _ObMenuFrame
 
     RrAppearance *a_title;
     RrAppearance *a_items;
+
+    gboolean got_press; /* don't allow a KeyRelease event to run things in the
+                           menu until it has seen a KeyPress.  this is to
+                           avoid having the keybinding used to show the menu
+                           end up running something inside the menu */
 };
 
 struct _ObMenuEntryFrame
This page took 0.027435 seconds and 4 git commands to generate.