handle enter/leave events in the menu

This commit is contained in:
Dana Jansens 2007-04-22 00:31:03 +00:00
parent 213426194f
commit 8644a47cb7

View file

@ -506,6 +506,11 @@ static void event_process(const XEvent *ec, gpointer data)
xerror_set_ignore(FALSE); 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 */ /* user input (action-bound) events */
if (e->type == ButtonPress || e->type == ButtonRelease || if (e->type == ButtonPress || e->type == ButtonRelease ||
e->type == MotionNotify || e->type == KeyPress || e->type == MotionNotify || e->type == KeyPress ||
@ -1262,24 +1267,24 @@ static void event_handle_menu(XEvent *ev)
menu_frame_hide_all(); menu_frame_hide_all();
} }
break; break;
case MotionNotify: case EnterNotify:
if ((f = menu_frame_under(ev->xmotion.x_root, if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) {
ev->xmotion.y_root))) { if (e->ignore_enters)
if ((e = menu_entry_frame_under(ev->xmotion.x_root, --e->ignore_enters;
ev->xmotion.y_root))) { else
/* XXX menu_frame_entry_move_on_screen(f); */ menu_frame_select(e->frame, e);
menu_frame_select(f, e);
}
} }
{ break;
ObMenuFrame *a; case LeaveNotify:
if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window))) {
a = find_active_menu(); if (e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)
if (a && a != f && menu_frame_select(e->frame, NULL);
a->selected->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU) }
{ case MotionNotify:
menu_frame_select(a, NULL); 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; break;
case KeyPress: case KeyPress: