[Xfce4-commits] [xfce/xfce4-panel] 01/01: tasklist: Fix scrolling to cycle through open windows (Bug #13789)
noreply at xfce.org
noreply at xfce.org
Sun Aug 20 14:57:05 CEST 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit c2fc42eb5debd536bdce6761eb685ac65e6335c8
Author: Stefan Berzl <stefanberzl at gmail.com>
Date: Sun Aug 20 14:55:07 2017 +0200
tasklist: Fix scrolling to cycle through open windows (Bug #13789)
This patch also handles smooth scrolling.
---
plugins/tasklist/tasklist-widget.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index d75fc91..7497076 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1285,9 +1285,10 @@ static gboolean
xfce_tasklist_scroll_event (GtkWidget *widget,
GdkEventScroll *event)
{
- XfceTasklist *tasklist = XFCE_TASKLIST (widget);
- XfceTasklistChild *child = NULL;
- GList *li, *lnew = NULL;
+ XfceTasklist *tasklist = XFCE_TASKLIST (widget);
+ XfceTasklistChild *child = NULL;
+ GList *li, *lnew = NULL;
+ GdkScrollDirection scrolling_direction;
if (!tasklist->window_scrolling)
return TRUE;
@@ -1305,7 +1306,23 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
if (G_UNLIKELY (li == NULL))
return TRUE;
- switch (event->direction)
+ if (event->direction != GDK_SCROLL_SMOOTH)
+ scrolling_direction = event->direction;
+ else if (event->delta_y < 0)
+ scrolling_direction = GDK_SCROLL_UP;
+ else if (event->delta_y > 0)
+ scrolling_direction = GDK_SCROLL_DOWN;
+ else if (event->delta_x < 0)
+ scrolling_direction = GDK_SCROLL_LEFT;
+ else if (event->delta_x > 0)
+ scrolling_direction = GDK_SCROLL_RIGHT;
+ else
+ {
+ panel_debug_filtered (PANEL_DEBUG_TASKLIST, "scrolling event with no delta happend");
+ return TRUE;
+ }
+
+ switch (scrolling_direction)
{
case GDK_SCROLL_UP:
/* find previous button on the tasklist */
@@ -1342,10 +1359,6 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
case GDK_SCROLL_RIGHT:
/* TODO */
break;
-
- case GDK_SCROLL_SMOOTH:
- /* TODO */
- break;
}
if (lnew != NULL)
@@ -2128,6 +2141,8 @@ xfce_tasklist_child_new (XfceTasklist *tasklist)
gtk_widget_set_parent (child->button, GTK_WIDGET (tasklist));
gtk_button_set_relief (GTK_BUTTON (child->button),
tasklist->button_relief);
+ gtk_widget_add_events (GTK_WIDGET(child->button), GDK_SCROLL_MASK
+ | GDK_SMOOTH_SCROLL_MASK);
child->box = gtk_box_new (!xfce_tasklist_vertical (tasklist) ?
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, 6);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list