]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
Some fixes for the submenu hide delay code
[chaz/openbox] / openbox / event.c
index bbe7038e6c3d073874cdd5cad6a51998ecd7e9d9..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,14 +1846,16 @@ 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)
+        if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)))
         {
-            ObMenuEntryFrame *u = menu_entry_frame_under(ev->xcrossing.x_root,
-                                                         ev->xcrossing.y_root);
-            /* if we're just going from one entry in the menu to the next,
-               don't unselect stuff first */
-            if (!u || e->frame != u->frame)
+            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;
This page took 0.022867 seconds and 4 git commands to generate.