Merge lp:~roti-al/synapse-project/scroll2list into lp:synapse-project

Proposed by Hrotkó Gábor on 2018-03-20
Status: Needs review
Proposed branch: lp:~roti-al/synapse-project/scroll2list
Merge into: lp:synapse-project
Diff against target: 58 lines (+18/-1)
3 files modified
src/ui/controller.vala (+7/-0)
src/ui/interfaces.vala (+3/-0)
src/ui/view-base.vala (+8/-1)
To merge this branch: bzr merge lp:~roti-al/synapse-project/scroll2list
Reviewer Review Type Date Requested Status
Synapse core team 2018-03-20 Pending
Review via email: mp+341776@code.launchpad.net

Description of the change

Enable to display the result list to be displayed by mouse scroll also, not only with the 'Down' key.
This way the category lists are browseable with mouse only.

To post a comment you must log in.

Unmerged revisions

666. By Hrotkó Gábor on 2018-03-20

Show list with mouse scroll

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui/controller.vala'
2--- src/ui/controller.vala 2016-03-02 13:27:04 +0000
3+++ src/ui/controller.vala 2018-03-20 21:29:33 +0000
4@@ -101,6 +101,13 @@
5 this.fetch_command (command);
6 }
7 }
8+
9+ /* scroll_event should be fired on mouse scroll */
10+ public void scroll_event (Gdk.EventScroll event)
11+ {
12+ if (event.direction == Gdk.ScrollDirection.DOWN) this.fetch_command (KeyComboConfig.Commands.NEXT_RESULT);
13+ if (event.direction == Gdk.ScrollDirection.UP) this.fetch_command (KeyComboConfig.Commands.PREV_RESULT);
14+ }
15
16 /* category_changed_event should be fired ie when user clicks on a category */
17 public void category_changed_event (int category_index)
18
19=== modified file 'src/ui/interfaces.vala'
20--- src/ui/interfaces.vala 2017-06-16 18:56:25 +0000
21+++ src/ui/interfaces.vala 2018-03-20 21:29:33 +0000
22@@ -52,6 +52,9 @@
23 /* key_press_event should be fired on key press */
24 public abstract void key_press_event (Gdk.EventKey event);
25
26+ /* scroll_event should be fired on mouse scroll */
27+ public abstract void scroll_event (Gdk.EventScroll event);
28+
29 /* category_changed_event should be fired ie when user clicks on a category */
30 public abstract void category_changed_event (int category_index);
31
32
33=== modified file 'src/ui/view-base.vala'
34--- src/ui/view-base.vala 2016-02-27 15:10:45 +0000
35+++ src/ui/view-base.vala 2018-03-20 21:29:33 +0000
36@@ -169,7 +169,8 @@
37
38 /* Listen on click events */
39 this.set_events (this.get_events () | Gdk.EventMask.BUTTON_PRESS_MASK
40- | Gdk.EventMask.KEY_PRESS_MASK);
41+ | Gdk.EventMask.KEY_PRESS_MASK
42+ | Gdk.EventMask.SCROLL_MASK);
43
44 Gui.Utils.ensure_transparent_bg (this);
45
46@@ -318,6 +319,12 @@
47 return false;
48 }
49
50+ public override bool scroll_event (Gdk.EventScroll event)
51+ {
52+ this.controller.scroll_event(event);
53+ return false;
54+ }
55+
56 public override bool draw (Cairo.Context ctx)
57 {
58 Gtk.Allocation allocation;