better event handling for menus

This commit is contained in:
Dana Jansens 2007-04-22 00:53:21 +00:00
parent 957963e272
commit b6897feb40
2 changed files with 7 additions and 11 deletions

View file

@ -1276,17 +1276,12 @@ static void event_handle_menu(XEvent *ev)
}
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);
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)
{
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:
if (ev->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
menu_frame_hide_all();

View file

@ -738,7 +738,8 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
XMapWindow(ob_display, self->window);
if (screen_pointer_pos(&dx, &dy) && (e = menu_entry_frame_under(dx, dy)))
if (screen_pointer_pos(&dx, &dy) && (e = menu_entry_frame_under(dx, dy)) &&
e->frame == self)
++e->ignore_enters;
return TRUE;