]> Dogcows Code - chaz/openbox/commitdiff
handle enter/leave events in the menu
authorDana Jansens <danakj@orodu.net>
Sun, 22 Apr 2007 00:31:03 +0000 (00:31 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 22 Apr 2007 00:31:03 +0000 (00:31 +0000)
openbox/event.c

index b9f04e4d5c7ecd43d90bc47061386f3a87d942fa..00de8b36880e075ebef460e0b9da9bcf236a7d9a 100644 (file)
@@ -506,6 +506,11 @@ static void event_process(const XEvent *ec, gpointer data)
         xerror_set_ignore(FALSE);
     }
 
+    /* crossing events for menu */
+    if (e->type == EnterNotify || e->type == LeaveNotify)
+        if (menu_frame_visible)
+            event_handle_menu(e);
+
     /* user input (action-bound) events */
     if (e->type == ButtonPress || e->type == ButtonRelease ||
         e->type == MotionNotify || e->type == KeyPress ||
@@ -1262,24 +1267,24 @@ static void event_handle_menu(XEvent *ev)
                 menu_frame_hide_all();
         }
         break;
-    case MotionNotify:
-        if ((f = menu_frame_under(ev->xmotion.x_root,
-                                  ev->xmotion.y_root))) {
-            if ((e = menu_entry_frame_under(ev->xmotion.x_root,
-                                            ev->xmotion.y_root))) {
-                /* XXX menu_frame_entry_move_on_screen(f); */
-                menu_frame_select(f, e);
-            }
+    case EnterNotify:
+        if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) {
+            if (e->ignore_enters)
+                --e->ignore_enters;
+            else
+                menu_frame_select(e->frame, e);
         }
-        {
-            ObMenuFrame *a;
-
-            a = find_active_menu();
-            if (a && a != f &&
-                a->selected->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)
-            {
-                menu_frame_select(a, NULL);
-            }
+        break;
+    case LeaveNotify:
+        if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) {
+            if (e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)
+                menu_frame_select(e->frame, NULL);
+        }
+    case MotionNotify:
+        if ((e = menu_entry_frame_under(ev->xmotion.x_root,
+                                        ev->xmotion.y_root))) {
+            /* XXX menu_frame_entry_move_on_screen(f); */
+            menu_frame_select(e->frame, e);
         }
         break;
     case KeyPress:
This page took 0.029878 seconds and 4 git commands to generate.