Merge lp:~hikiko/unity/unity.1281925 into lp:unity

Proposed by Eleni Maria Stea
Status: Work in progress
Proposed branch: lp:~hikiko/unity/unity.1281925
Merge into: lp:unity
Diff against target: 81 lines (+27/-0)
5 files modified
dash/DashView.cpp (+2/-0)
dash/ResultViewGrid.cpp (+7/-0)
dash/ResultViewGrid.h (+2/-0)
dash/ScopeView.cpp (+14/-0)
dash/ScopeView.h (+2/-0)
To merge this branch: bzr merge lp:~hikiko/unity/unity.1281925
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
John Lea Pending
Andrea Azzarone Pending
Unity Team Pending
Review via email: mp+210157@code.launchpad.net

Commit message

fixes bug: #1281925

Description of the change

fixes bug: #1281925

To post a comment you must log in.
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

@John:
From bug #1281925 description:
"it would be nice if the first item in the Dash would be visually highlighted somehow, to make clear that pressing Enter will activate it right from the search field."

I'd just like you to confirm that the branch is ok from a design perspective. Here's a video of the dash after the change: https://www.youtube.com/watch?v=yzfkaLdJKVM

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

@hikiko; thanks for looking into this!

At 0:58 in the attached youtube video there is a brief moment when both the category header and the first search result are both highlighted at the same time. We have an issue in that there should only every be one item highlighted at any one time. When we looked at this issue before we couldn't find a clean way around this issue and that is why the first search result is not currently highlighted by default.

If the first search result is highlighted by default, obvious solution to this problem (when the user presses the down arrow, the highlight moves up) would be confusing because the focus would be going the the opposite direction from the key press. Jumping the first category header would also be inconsistent.

See if you can find a clean solution around the problem given that A) there can only be one focused item at any one time B) when the user presses the down arrow for the first time they expect the focus to go one step downwards from the text entry box they were typing in. The current implementation in 13.10 is the best solution we could find to this problem, but there may be a better solution and we are open to suggestions.

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

I see... Thanks for the review :) I'll ping you if I come up with any fresh ideas...

Unmerged revisions

3691. By Eleni Maria Stea

removed empty line, commented out NeedRedraw (avoid delay during the 1st
    search, convenience with lambdas in the constructor)

3690. By Eleni Maria Stea

fixed :)

3689. By Eleni Maria Stea

quick backup

3688. By Eleni Maria Stea

works sometimes

3687. By Eleni Maria Stea

fixing 1281925 in progress

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2014-03-05 14:18:31 +0000
3+++ dash/DashView.cpp 2014-03-10 09:39:59 +0000
4@@ -1192,6 +1192,8 @@
5 if (scope_pos == scope_views_.end() || scope_pos->second != active_scope_view_)
6 return;
7
8+ active_scope_view_->SelectFirstResultOfFirstScope();
9+
10 if (search_string == search_bar_->search_string)
11 {
12 if (err)
13
14=== modified file 'dash/ResultViewGrid.cpp'
15--- dash/ResultViewGrid.cpp 2013-11-19 18:48:35 +0000
16+++ dash/ResultViewGrid.cpp 2014-03-10 09:39:59 +0000
17@@ -307,6 +307,13 @@
18 rows = result_model_ ? ceil(static_cast<double>(result_model_->count()) / static_cast<double>(std::max<int>(1, columns))) : 0.0;
19 }
20
21+void ResultViewGrid::SelectFirst()
22+{
23+ focused_result_ = (*GetIteratorAtRow(0));
24+ selected_index_ = 0;
25+ NeedRedraw();
26+}
27+
28 void ResultViewGrid::SetModelRenderer(ResultRenderer* renderer)
29 {
30 ResultView::SetModelRenderer(renderer);
31
32=== modified file 'dash/ResultViewGrid.h'
33--- dash/ResultViewGrid.h 2013-09-24 20:18:42 +0000
34+++ dash/ResultViewGrid.h 2014-03-10 09:39:59 +0000
35@@ -60,6 +60,8 @@
36
37 virtual void GetResultDimensions(int& rows, int& columns);
38
39+ void SelectFirst();
40+
41 protected:
42 void MouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
43 void MouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
44
45=== modified file 'dash/ScopeView.cpp'
46--- dash/ScopeView.cpp 2013-11-19 18:48:35 +0000
47+++ dash/ScopeView.cpp 2014-03-10 09:39:59 +0000
48@@ -1101,6 +1101,20 @@
49 result_view->RenderResultTexture(result_texture);
50 }
51
52+void ScopeView::SelectFirstResultOfFirstScope()
53+{
54+ if (!scope_)
55+ return;
56+
57+ Results::Ptr results = scope_->results;
58+ if (results->count())
59+ {
60+ PlacesGroup::Ptr group = category_views_[(unsigned int)*category_order_.begin()];
61+ ResultViewGrid* result_view = static_cast<ResultViewGrid*>(group->GetChildView());
62+ result_view->SelectFirst();
63+ }
64+}
65+
66 void ScopeView::PushFilterExpansion(bool expand)
67 {
68 filter_expansion_pushed_ = filters_expanded;
69
70=== modified file 'dash/ScopeView.h'
71--- dash/ScopeView.h 2013-09-19 16:44:03 +0000
72+++ dash/ScopeView.h 2014-03-10 09:39:59 +0000
73@@ -86,6 +86,8 @@
74 std::vector<ResultViewTexture::Ptr> GetResultTextureContainers();
75 void RenderResultTexture(ResultViewTexture::Ptr const& result_texture);
76
77+ void SelectFirstResultOfFirstScope();
78+
79 private:
80 void SetupViews(nux::Area* show_filters);
81 void SetupCategories(Categories::Ptr const& categories);