Merge lp:~3v1n0/unity/scrollbars-thumb-wheel-fix into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3848
Proposed branch: lp:~3v1n0/unity/scrollbars-thumb-wheel-fix
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/dash-scrollbars-scaling
Diff against target: 53 lines (+10/-2)
3 files modified
unity-shared/PlacesOverlayVScrollBar.cpp (+7/-0)
unity-shared/PlacesOverlayVScrollBar.h (+2/-2)
unity-shared/VScrollBarOverlayWindow.cpp (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/scrollbars-thumb-wheel-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+226552@code.launchpad.net

Commit message

PlacesOverlayVScrollBar: redirect the mouse wheel scroll events coming from the thumb to the scrollview

This will make the scrollview to handle then and perform the same scrolling action it would do otherwise.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/PlacesOverlayVScrollBar.cpp'
2--- unity-shared/PlacesOverlayVScrollBar.cpp 2014-07-11 22:57:02 +0000
3+++ unity-shared/PlacesOverlayVScrollBar.cpp 2014-07-11 22:57:03 +0000
4@@ -66,6 +66,7 @@
5 overlay_window_->mouse_click.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseClick));
6 overlay_window_->mouse_move.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseMove));
7 overlay_window_->mouse_drag.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseDrag));
8+ overlay_window_->mouse_wheel.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseWheel));
9 overlay_window_->sigHidden.connect(sigc::hide(sigc::mem_fun(this, &PlacesOverlayVScrollBar::ResetConnector)));
10
11 _track->geometry_changed.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnTrackGeometryChanged));
12@@ -371,6 +372,12 @@
13 MouseDraggingOverlay(y, dy);
14 }
15
16+void PlacesOverlayVScrollBar::OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state)
17+{
18+ mouse_wheel.emit(x, y, delta, mouse_state, key_state);
19+ UpdateConnectorPosition();
20+}
21+
22 void PlacesOverlayVScrollBar::MouseDraggingOverlay(int y, int dy)
23 {
24 int const thumb_offset = overlay_window_->GetThumbOffsetY() + mouse_down_offset_;
25
26=== modified file 'unity-shared/PlacesOverlayVScrollBar.h'
27--- unity-shared/PlacesOverlayVScrollBar.h 2014-07-11 22:57:02 +0000
28+++ unity-shared/PlacesOverlayVScrollBar.h 2014-07-11 22:57:03 +0000
29@@ -67,10 +67,10 @@
30
31 void OnMouseDown(int x, int y, unsigned int button_flags, unsigned int key_flags);
32 void OnMouseUp(int x, int y, unsigned int button_flags, unsigned int key_flags);
33-
34 void OnMouseMove(int x, int y, int dx, int dy, unsigned int button_flags, unsigned int key_flags);
35-
36 void OnMouseDrag(int x, int y, int dx, int dy, unsigned int button_flags, unsigned int key_flags);
37+ void OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state);
38+
39 void MouseDraggingOverlay(int y, int dy);
40
41 bool IsMouseInTopHalfOfThumb(int y);
42
43=== modified file 'unity-shared/VScrollBarOverlayWindow.cpp'
44--- unity-shared/VScrollBarOverlayWindow.cpp 2014-07-11 22:57:02 +0000
45+++ unity-shared/VScrollBarOverlayWindow.cpp 2014-07-11 22:57:03 +0000
46@@ -49,6 +49,7 @@
47 {
48 Area::SetGeometry(content_size_.x, content_size_.y, THUMB_WIDTH.CP(scale), content_size_.height);
49 SetBackgroundColor(nux::color::Transparent);
50+ SetAcceptMouseWheelEvent(true);
51
52 show_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity));
53 show_animator_.finished.connect([this] {