Merge lp:~3v1n0/libindicator/horizontal-scrolling into lp:libindicator/14.04

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Charles Kerr
Approved revision: 532
Merged at revision: 530
Proposed branch: lp:~3v1n0/libindicator/horizontal-scrolling
Merge into: lp:libindicator/14.04
Diff against target: 96 lines (+59/-2)
3 files modified
debian/changelog (+6/-0)
libindicator/indicator-ng.c (+6/-2)
tools/indicator-loader.c (+47/-0)
To merge this branch: bzr merge lp:~3v1n0/libindicator/horizontal-scrolling
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+227031@code.launchpad.net

Commit message

IndicatorNG: Reverse the scroll delta on left scroll events

As it happens for left scroll events.

Description of the change

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM

review: Approve
533. By Marco Trevisan (Treviño)

debian/changelog: add bug statement

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-04-02 14:50:54 +0000
3+++ debian/changelog 2014-10-07 15:22:02 +0000
4@@ -1,3 +1,9 @@
5+libindicator (12.10.2+14.04.20141007-0ubuntu1) UNRELEASED; urgency=low
6+
7+ * IndicatorNG: Reverse the scroll delta on left scroll events (LP: #1342731)
8+
9+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 07 Oct 2014 17:17:25 +0200
10+
11 libindicator (12.10.2+14.04.20140402-0ubuntu1) trusty; urgency=low
12
13 [ William Hua ]
14
15=== modified file 'libindicator/indicator-ng.c'
16--- libindicator/indicator-ng.c 2014-01-29 13:16:59 +0000
17+++ libindicator/indicator-ng.c 2014-10-07 15:22:02 +0000
18@@ -194,8 +194,12 @@
19
20 if (self->actions && self->scroll_action)
21 {
22- if (direction == INDICATOR_OBJECT_SCROLL_DOWN)
23- delta *= -1;
24+ if (direction == INDICATOR_OBJECT_SCROLL_DOWN ||
25+ direction == INDICATOR_OBJECT_SCROLL_LEFT)
26+ {
27+ delta *= -1;
28+ }
29+
30 g_action_group_activate_action (self->actions, self->scroll_action,
31 g_variant_new_int32 (delta));
32 }
33
34=== modified file 'tools/indicator-loader.c'
35--- tools/indicator-loader.c 2013-07-26 17:32:08 +0000
36+++ tools/indicator-loader.c 2014-10-07 15:22:02 +0000
37@@ -55,6 +55,50 @@
38 }
39 }
40
41+static void
42+scroll_entry (GtkWidget *widget, GdkEventScroll* event, gpointer user_data)
43+{
44+ gpointer entry;
45+
46+ g_return_if_fail (INDICATOR_IS_OBJECT(user_data));
47+
48+ entry = g_object_get_qdata (G_OBJECT(widget), entry_data_quark());
49+ IndicatorScrollDirection direction = G_MAXINT;
50+
51+ switch (event->direction)
52+ {
53+ case GDK_SCROLL_UP:
54+ direction = INDICATOR_OBJECT_SCROLL_UP;
55+ break;
56+ case GDK_SCROLL_DOWN:
57+ direction = INDICATOR_OBJECT_SCROLL_DOWN;
58+ break;
59+ case GDK_SCROLL_LEFT:
60+ direction = INDICATOR_OBJECT_SCROLL_LEFT;
61+ break;
62+ case GDK_SCROLL_RIGHT:
63+ direction = INDICATOR_OBJECT_SCROLL_RIGHT;
64+ break;
65+ default:
66+ break;
67+ }
68+
69+ if (entry == NULL)
70+ {
71+ g_debug("Scroll on: (null)");
72+ }
73+ else if (direction == G_MAXINT)
74+ {
75+ g_debug("Scroll direction not supported");
76+ }
77+ else
78+ {
79+ g_signal_emit_by_name(INDICATOR_OBJECT(user_data),
80+ INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED,
81+ entry, 1, direction);
82+ }
83+}
84+
85 static GtkWidget*
86 create_menu_item (IndicatorObjectEntry * entry)
87 {
88@@ -106,6 +150,9 @@
89 g_object_set_qdata (G_OBJECT(menu_item), entry_data_quark(), entry);
90 g_signal_connect (menu_item, "activate", G_CALLBACK(activate_entry), io);
91
92+ gtk_widget_set_events (menu_item, gtk_widget_get_events (menu_item) | GDK_SCROLL_MASK);
93+ g_signal_connect (menu_item, "scroll-event", G_CALLBACK(scroll_entry), io);
94+
95 gtk_menu_shell_append (GTK_MENU_SHELL(user_data), menu_item);
96 }
97

Subscribers

People subscribed via source and target branches