diff --git a/gui_frame.c b/gui_frame.c index fe892e2..e52425d 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -1538,6 +1538,34 @@ static void unselect_pkg_name(void *data) } +static gboolean pkg_scroll_event(GtkWidget *widget, GdkEventScroll *event, + gpointer data) +{ + struct pkg *pkg, *last; + + switch (event->direction) { + case GDK_SCROLL_UP: + if (active_pkg->next) + active_pkg = active_pkg->next; + else + active_pkg = pkgs->next; + change_world(); + break; + case GDK_SCROLL_DOWN: + last = NULL; + for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg); + pkg = pkg->next) + last = pkg; + active_pkg = last; + change_world(); + break; + default: + /* ignore */; + } + return TRUE; +} + + static gboolean pkg_name_edit_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { @@ -1569,6 +1597,8 @@ static GtkWidget *build_pkg_name(void) g_signal_connect(G_OBJECT(box_of_label(label)), "button_press_event", G_CALLBACK(pkg_name_edit_event), NULL); + g_signal_connect(G_OBJECT(box_of_label(label)), + "scroll_event", G_CALLBACK(pkg_scroll_event), NULL); return box_of_label(label); } @@ -1577,34 +1607,6 @@ static GtkWidget *build_pkg_name(void) /* ----- packages ---------------------------------------------------------- */ -static gboolean pkg_scroll_event(GtkWidget *widget, GdkEventScroll *event, - gpointer data) -{ - struct pkg *pkg, *last; - - switch (event->direction) { - case GDK_SCROLL_UP: - if (active_pkg->next) - active_pkg = active_pkg->next; - else - active_pkg = pkgs->next; - change_world(); - break; - case GDK_SCROLL_DOWN: - last = NULL; - for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg); - pkg = pkg->next) - last = pkg; - active_pkg = last; - change_world(); - break; - default: - /* ignore */; - } - return TRUE; -} - - static gboolean pkg_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data) {