gtkmenu: ignore left/right scroll events

Menus are placed vertically by definition, it does not make much sense
to support horizontal axis for scrolling.

Use GDK_EVENT_STOP/GDK_EVENT_PROPAGATE instead of TRUE/FALSE and add a
default case to return GDK_EVENT_PROPAGATE for unhandled events.

https://bugzilla.gnome.org/show_bug.cgi?id=765939
This commit is contained in:
Olivier Fourdan 2016-05-09 08:56:56 +02:00
parent c134d52dd7
commit 126156e820

View File

@ -3557,24 +3557,25 @@ gtk_menu_scroll (GtkWidget *widget,
GtkMenu *menu = GTK_MENU (widget);
if (_gdk_event_get_pointer_emulated ((GdkEvent *) event))
return FALSE;
return GDK_EVENT_PROPAGATE;
switch (event->direction)
{
case GDK_SCROLL_RIGHT:
case GDK_SCROLL_DOWN:
gtk_menu_scroll_by (menu, MENU_SCROLL_STEP2);
break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_UP:
gtk_menu_scroll_by (menu, - MENU_SCROLL_STEP2);
break;
case GDK_SCROLL_SMOOTH:
gtk_menu_scroll_by (menu, event->delta_y * MENU_SCROLL_STEP2);
break;
default:
return GDK_EVENT_PROPAGATE;
break;
}
return TRUE;
return GDK_EVENT_STOP;
}
static void