Merge lp:~townsend/unity/fix-dash-page-up-down into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3970
Proposed branch: lp:~townsend/unity/fix-dash-page-up-down
Merge into: lp:unity
Diff against target: 155 lines (+35/-9)
7 files modified
dash/DashView.cpp (+8/-2)
dash/ScopeView.cpp (+5/-0)
dash/ScopeView.h (+2/-0)
unity-shared/OverlayScrollView.cpp (+5/-1)
unity-shared/OverlayScrollView.h (+2/-0)
unity-shared/PlacesOverlayVScrollBar.cpp (+5/-0)
unity-shared/PlacesOverlayVScrollBar.h (+8/-6)
To merge this branch: bzr merge lp:~townsend/unity/fix-dash-page-up-down
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+257751@code.launchpad.net

Commit message

Enable real page up/page down key navigation in the Dash. When using these keys the view scrolls the length of the visible view.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Code looks fine, but... I'm not that favourable to the usage of a bool signature on those methods.

Couldn't we use something else (ScrollDir probably can't be exported easily, but maybe nux::KeyNavDirection could be fine).

Revision history for this message
Christopher Townsend (townsend) wrote :

I would have to add a couple of new KeyNavDirection enum types to handle this and I'm a bit loathe to touch Nux which is why I did it the way I did.

What is the reason why your not in favor of the bool?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2015-03-20 18:03:15 +0000
+++ dash/DashView.cpp 2015-05-05 13:08:22 +0000
@@ -1576,11 +1576,9 @@
1576 direction = KEY_NAV_RIGHT;1576 direction = KEY_NAV_RIGHT;
1577 break;1577 break;
1578 case NUX_VK_LEFT_TAB:1578 case NUX_VK_LEFT_TAB:
1579 case NUX_VK_PAGE_UP:
1580 direction = KEY_NAV_TAB_PREVIOUS;1579 direction = KEY_NAV_TAB_PREVIOUS;
1581 break;1580 break;
1582 case NUX_VK_TAB:1581 case NUX_VK_TAB:
1583 case NUX_VK_PAGE_DOWN:
1584 direction = KEY_NAV_TAB_NEXT;1582 direction = KEY_NAV_TAB_NEXT;
1585 break;1583 break;
1586 case NUX_VK_ENTER:1584 case NUX_VK_ENTER:
@@ -1588,6 +1586,14 @@
1588 // Not sure if Enter should be a navigation key1586 // Not sure if Enter should be a navigation key
1589 direction = KEY_NAV_ENTER;1587 direction = KEY_NAV_ENTER;
1590 break;1588 break;
1589 case NUX_VK_PAGE_UP:
1590 case NUX_VK_PAGE_DOWN:
1591 if (!preview_displaying_)
1592 {
1593 active_scope_view_->PerformPageNavigation((x11_key_code == NUX_VK_PAGE_UP) ? ScrollDir::UP : ScrollDir::DOWN);
1594 return nux::GetWindowCompositor().GetKeyFocusArea();
1595 }
1596 break;
1591 default:1597 default:
1592 auto const& close_key = WindowManager::Default().close_window_key();1598 auto const& close_key = WindowManager::Default().close_window_key();
15931599
15941600
=== modified file 'dash/ScopeView.cpp'
--- dash/ScopeView.cpp 2014-07-11 22:26:26 +0000
+++ dash/ScopeView.cpp 2015-05-05 13:08:22 +0000
@@ -1007,6 +1007,11 @@
1007 scroll_view_->ScrollToPosition(nux::Geometry(0, 0, 0, 0));1007 scroll_view_->ScrollToPosition(nux::Geometry(0, 0, 0, 0));
1008}1008}
10091009
1010void ScopeView::PerformPageNavigation(ScrollDir dir)
1011{
1012 scroll_view_->page_direction.emit(dir);
1013}
1014
1010void ScopeView::ActivateFirst()1015void ScopeView::ActivateFirst()
1011{1016{
1012 if (!scope_)1017 if (!scope_)
10131018
=== modified file 'dash/ScopeView.h'
--- dash/ScopeView.h 2015-02-03 09:46:48 +0000
+++ dash/ScopeView.h 2015-05-05 13:08:22 +0000
@@ -37,6 +37,7 @@
37#include "ResultViewGrid.h"37#include "ResultViewGrid.h"
38#include "unity-shared/NuxObjectPtrHash.h"38#include "unity-shared/NuxObjectPtrHash.h"
39#include "unity-shared/UBusWrapper.h"39#include "unity-shared/UBusWrapper.h"
40#include "unity-shared/PlacesOverlayVScrollBar.h"
4041
41namespace unity42namespace unity
42{43{
@@ -62,6 +63,7 @@
62 int GetNumRows();63 int GetNumRows();
63 void AboutToShow();64 void AboutToShow();
64 void JumpToTop();65 void JumpToTop();
66 void PerformPageNavigation(ScrollDir dir);
6567
66 virtual void ActivateFirst();68 virtual void ActivateFirst();
6769
6870
=== modified file 'unity-shared/OverlayScrollView.cpp'
--- unity-shared/OverlayScrollView.cpp 2014-07-11 22:57:51 +0000
+++ unity-shared/OverlayScrollView.cpp 2015-05-05 13:08:22 +0000
@@ -50,7 +50,11 @@
50 scale.changed.connect([this] (double scale) {50 scale.changed.connect([this] (double scale) {
51 m_MouseWheelScrollSize = MOUSE_WHEEL_SCROLL_SIZE.CP(scale);51 m_MouseWheelScrollSize = MOUSE_WHEEL_SCROLL_SIZE.CP(scale);
52 });52 });
53
54 page_direction.connect([scrollbar] (ScrollDir dir) {
55 scrollbar->PerformPageNavigation(dir);
56 });
53}57}
5458
55} // dash namespace59} // dash namespace
56} // unity namespace
57\ No newline at end of file60\ No newline at end of file
61} // unity namespace
5862
=== modified file 'unity-shared/OverlayScrollView.h'
--- unity-shared/OverlayScrollView.h 2014-07-11 22:24:13 +0000
+++ unity-shared/OverlayScrollView.h 2015-05-05 13:08:22 +0000
@@ -21,6 +21,7 @@
21#define _UNITY_SCROLL_VIEW_H_21#define _UNITY_SCROLL_VIEW_H_
2222
23#include <Nux/Nux.h>23#include <Nux/Nux.h>
24#include "PlacesOverlayVScrollBar.h"
2425
25namespace unity26namespace unity
26{27{
@@ -33,6 +34,7 @@
33 ScrollView(NUX_FILE_LINE_PROTO);34 ScrollView(NUX_FILE_LINE_PROTO);
3435
35 nux::RWProperty<double> scale;36 nux::RWProperty<double> scale;
37 sigc::signal<void, ScrollDir> page_direction;
3638
37 using nux::ScrollView::SetVScrollBar;39 using nux::ScrollView::SetVScrollBar;
38};40};
3941
=== modified file 'unity-shared/PlacesOverlayVScrollBar.cpp'
--- unity-shared/PlacesOverlayVScrollBar.cpp 2014-07-11 22:43:08 +0000
+++ unity-shared/PlacesOverlayVScrollBar.cpp 2015-05-05 13:08:22 +0000
@@ -121,6 +121,11 @@
121 animation_.SetFinishValue(stop);121 animation_.SetFinishValue(stop);
122}122}
123123
124void PlacesOverlayVScrollBar::PerformPageNavigation(ScrollDir dir)
125{
126 StartScrollAnimation(dir, _slider->GetBaseHeight());
127}
128
124void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop)129void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop)
125{130{
126 if (animation_.CurrentState() == nux::animation::Animation::State::Stopped)131 if (animation_.CurrentState() == nux::animation::Animation::State::Stopped)
127132
=== modified file 'unity-shared/PlacesOverlayVScrollBar.h'
--- unity-shared/PlacesOverlayVScrollBar.h 2014-07-11 22:43:08 +0000
+++ unity-shared/PlacesOverlayVScrollBar.h 2015-05-05 13:08:22 +0000
@@ -34,22 +34,24 @@
34namespace dash34namespace dash
35{35{
3636
37enum class ScrollDir : unsigned int
38{
39 UP,
40 DOWN,
41};
42
37class PlacesOverlayVScrollBar: public PlacesVScrollBar43class PlacesOverlayVScrollBar: public PlacesVScrollBar
38{44{
39public:45public:
40 PlacesOverlayVScrollBar(NUX_FILE_LINE_PROTO);46 PlacesOverlayVScrollBar(NUX_FILE_LINE_PROTO);
41 virtual ~PlacesOverlayVScrollBar() {}47 virtual ~PlacesOverlayVScrollBar() {}
4248
49 void PerformPageNavigation(ScrollDir dir);
50
43protected:51protected:
44 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);52 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
4553
46private:54private:
47 enum class ScrollDir : unsigned int
48 {
49 UP,
50 DOWN,
51 };
52
53 void OnTrackGeometryChanged(nux::Area* area, nux::Geometry& geo);55 void OnTrackGeometryChanged(nux::Area* area, nux::Geometry& geo);
54 void OnVisibilityChanged(nux::Area* area, bool visible);56 void OnVisibilityChanged(nux::Area* area, bool visible);
55 void OnSensitivityChanged(nux::Area* area, bool sensitive);57 void OnSensitivityChanged(nux::Area* area, bool sensitive);