diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2014-07-31 18:39:13 +0000 |
|---|---|---|
| committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-07-31 18:39:13 +0000 |
| commit | 8d619731e143d87de273edccce194c940da73b5b (patch) | |
| tree | bc15e462cf9e7f62534a5f39dd516b9748c9804e /unity-shared | |
| parent | a3547142c29510bf9512e8cf094f4b3bff5eddf6 (diff) | |
| parent | 3a635390e3e3aeb5fdf5827f8c36521b4984f63a (diff) | |
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. Fixes: 1340992 Approved by: Brandon Schaefer, PS Jenkins bot (bzr r3848)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/PlacesOverlayVScrollBar.cpp | 7 | ||||
| -rw-r--r-- | unity-shared/PlacesOverlayVScrollBar.h | 4 | ||||
| -rw-r--r-- | unity-shared/VScrollBarOverlayWindow.cpp | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/unity-shared/PlacesOverlayVScrollBar.cpp b/unity-shared/PlacesOverlayVScrollBar.cpp index 5136ed58f..6295bda52 100644 --- a/unity-shared/PlacesOverlayVScrollBar.cpp +++ b/unity-shared/PlacesOverlayVScrollBar.cpp @@ -66,6 +66,7 @@ PlacesOverlayVScrollBar::PlacesOverlayVScrollBar(NUX_FILE_LINE_DECL) overlay_window_->mouse_click.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseClick)); overlay_window_->mouse_move.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseMove)); overlay_window_->mouse_drag.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseDrag)); + overlay_window_->mouse_wheel.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnMouseWheel)); overlay_window_->sigHidden.connect(sigc::hide(sigc::mem_fun(this, &PlacesOverlayVScrollBar::ResetConnector))); _track->geometry_changed.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnTrackGeometryChanged)); @@ -371,6 +372,12 @@ void PlacesOverlayVScrollBar::OnMouseDrag(int /*x*/, int y, int /*dx*/, int dy, MouseDraggingOverlay(y, dy); } +void PlacesOverlayVScrollBar::OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state) +{ + mouse_wheel.emit(x, y, delta, mouse_state, key_state); + UpdateConnectorPosition(); +} + void PlacesOverlayVScrollBar::MouseDraggingOverlay(int y, int dy) { int const thumb_offset = overlay_window_->GetThumbOffsetY() + mouse_down_offset_; diff --git a/unity-shared/PlacesOverlayVScrollBar.h b/unity-shared/PlacesOverlayVScrollBar.h index 43a91d3ef..59a9778e1 100644 --- a/unity-shared/PlacesOverlayVScrollBar.h +++ b/unity-shared/PlacesOverlayVScrollBar.h @@ -67,10 +67,10 @@ private: void OnMouseDown(int x, int y, unsigned int button_flags, unsigned int key_flags); void OnMouseUp(int x, int y, unsigned int button_flags, unsigned int key_flags); - void OnMouseMove(int x, int y, int dx, int dy, unsigned int button_flags, unsigned int key_flags); - void OnMouseDrag(int x, int y, int dx, int dy, unsigned int button_flags, unsigned int key_flags); + void OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state); + void MouseDraggingOverlay(int y, int dy); bool IsMouseInTopHalfOfThumb(int y); diff --git a/unity-shared/VScrollBarOverlayWindow.cpp b/unity-shared/VScrollBarOverlayWindow.cpp index f2dd21af9..46f40eab3 100644 --- a/unity-shared/VScrollBarOverlayWindow.cpp +++ b/unity-shared/VScrollBarOverlayWindow.cpp @@ -49,6 +49,7 @@ VScrollBarOverlayWindow::VScrollBarOverlayWindow(nux::Geometry const& geo) { Area::SetGeometry(content_size_.x, content_size_.y, THUMB_WIDTH.CP(scale), content_size_.height); SetBackgroundColor(nux::color::Transparent); + SetAcceptMouseWheelEvent(true); show_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity)); show_animator_.finished.connect([this] { |
