From c6c3e4cfc88e91b5f0c03c567afb758824aa0fe1 Mon Sep 17 00:00:00 2001 From: Andre Miranda Date: Wed, 14 May 2014 21:46:03 -0300 Subject: [PATCH] Scroll wheel cycling wrap --- plugins/tasklist/tasklist-widget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c index 52882de..7ebd77a 100644 --- a/plugins/tasklist/tasklist-widget.c +++ b/plugins/tasklist/tasklist-widget.c @@ -1235,6 +1235,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, if (!tasklist->window_scrolling) return TRUE; + /* get the current active button */ for (li = tasklist->windows; li != NULL; li = li->next) { child = li->data; @@ -1258,6 +1259,9 @@ xfce_tasklist_scroll_event (GtkWidget *widget, && GTK_WIDGET_VISIBLE (child->button)) break; } + + /* wrap if the first button is reached */ + lnew = lnew ? lnew : g_list_last (li); break; case GDK_SCROLL_DOWN: @@ -1269,6 +1273,9 @@ xfce_tasklist_scroll_event (GtkWidget *widget, && GTK_WIDGET_VISIBLE (child->button)) break; } + + /* wrap if the last button is reached */ + lnew = lnew ? lnew : g_list_first (li); break; case GDK_SCROLL_LEFT: @@ -1280,7 +1287,7 @@ xfce_tasklist_scroll_event (GtkWidget *widget, break; } - if (lnew != NULL) + if (G_LIKELY(lnew != NULL)) xfce_tasklist_button_activate (lnew->data, event->time); return TRUE; -- 1.9.2