]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
Some fixes for the submenu hide delay code
[chaz/openbox] / openbox / event.c
index 41f8eb16adf75b6b8ddeae3567356828b57a86c3..c77d968a8b3ea77f1ae33a78b06f1f1d8b319cef 100644 (file)
@@ -1800,6 +1800,15 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
     return ret;
 }
 
+static Bool event_look_for_menu_enter(Display *d, XEvent *ev, XPointer arg)
+{
+    ObMenuFrame *f = (ObMenuFrame*)arg;
+    ObMenuEntryFrame *e;
+    return ev->type == EnterNotify &&
+        (e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) &&
+        !e->ignore_enters && e->frame == f;
+}
+
 static gboolean event_handle_menu(XEvent *ev)
 {
     ObMenuFrame *f;
@@ -1837,11 +1846,17 @@ static gboolean event_handle_menu(XEvent *ev)
         if (ev->xcrossing.detail == NotifyInferior)
             break;
 
-        if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) &&
-            (f = find_active_menu()) && f->selected == e &&
-            e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)
+        if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)))
         {
-            menu_frame_select(e->frame, NULL, FALSE);
+            XEvent ce;
+
+            /* check if an EnterNotify event is coming, and if not, then select
+               nothing in the menu */
+            if (XCheckIfEvent(ob_display, &ce, event_look_for_menu_enter,
+                              (XPointer)e->frame))
+                XPutBackEvent(ob_display, &ce);
+            else
+                menu_frame_select(e->frame, NULL, FALSE);
         }
         break;
     case MotionNotify:
This page took 0.028299 seconds and 4 git commands to generate.