diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2014-09-22 13:41:26 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-09-22 13:41:26 +0000 |
commit | 5ae67890e7b5a0131a48476736e8b86e409d2a01 (patch) | |
tree | 97612d9bbc70fc3326942d00b1b143587da96771 | |
parent | 14a8261fa665d98b030ea7e6f1060ed281e13845 (diff) | |
parent | 19b729898ed630a0923fa91a4ee4c0146c7939a7 (diff) | |
download | libayatana-indicator-5ae67890e7b5a0131a48476736e8b86e409d2a01.tar.gz libayatana-indicator-5ae67890e7b5a0131a48476736e8b86e409d2a01.tar.bz2 libayatana-indicator-5ae67890e7b5a0131a48476736e8b86e409d2a01.zip |
IndicatorNG: Reverse the scroll delta on left scroll events
As it happens for left scroll events. Fixes: 1342731
Approved by: Charles Kerr, PS Jenkins bot
-rw-r--r-- | libindicator/indicator-ng.c | 8 | ||||
-rw-r--r-- | tools/indicator-loader.c | 47 |
2 files changed, 53 insertions, 2 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c index d83a2b5..d1d2854 100644 --- a/libindicator/indicator-ng.c +++ b/libindicator/indicator-ng.c @@ -194,8 +194,12 @@ indicator_ng_entry_scrolled (IndicatorObject *io, if (self->actions && self->scroll_action) { - if (direction == INDICATOR_OBJECT_SCROLL_DOWN) - delta *= -1; + if (direction == INDICATOR_OBJECT_SCROLL_DOWN || + direction == INDICATOR_OBJECT_SCROLL_LEFT) + { + delta *= -1; + } + g_action_group_activate_action (self->actions, self->scroll_action, g_variant_new_int32 (delta)); } diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 153cca7..a734b8a 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -55,6 +55,50 @@ activate_entry (GtkWidget * widget, gpointer user_data) } } +static void +scroll_entry (GtkWidget *widget, GdkEventScroll* event, gpointer user_data) +{ + gpointer entry; + + g_return_if_fail (INDICATOR_IS_OBJECT(user_data)); + + entry = g_object_get_qdata (G_OBJECT(widget), entry_data_quark()); + IndicatorScrollDirection direction = G_MAXINT; + + switch (event->direction) + { + case GDK_SCROLL_UP: + direction = INDICATOR_OBJECT_SCROLL_UP; + break; + case GDK_SCROLL_DOWN: + direction = INDICATOR_OBJECT_SCROLL_DOWN; + break; + case GDK_SCROLL_LEFT: + direction = INDICATOR_OBJECT_SCROLL_LEFT; + break; + case GDK_SCROLL_RIGHT: + direction = INDICATOR_OBJECT_SCROLL_RIGHT; + break; + default: + break; + } + + if (entry == NULL) + { + g_debug("Scroll on: (null)"); + } + else if (direction == G_MAXINT) + { + g_debug("Scroll direction not supported"); + } + else + { + g_signal_emit_by_name(INDICATOR_OBJECT(user_data), + INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, + entry, 1, direction); + } +} + static GtkWidget* create_menu_item (IndicatorObjectEntry * entry) { @@ -106,6 +150,9 @@ entry_added (IndicatorObject * io, g_object_set_qdata (G_OBJECT(menu_item), entry_data_quark(), entry); g_signal_connect (menu_item, "activate", G_CALLBACK(activate_entry), io); + gtk_widget_set_events (menu_item, gtk_widget_get_events (menu_item) | GDK_SCROLL_MASK); + g_signal_connect (menu_item, "scroll-event", G_CALLBACK(scroll_entry), io); + gtk_menu_shell_append (GTK_MENU_SHELL(user_data), menu_item); } |