Merge lp:~nick-dedekind/unity/smart-scopes.entry-activation into lp:~unity-team/unity/libunity-7.0-breakage

Proposed by Nick Dedekind
Status: Merged
Approved by: Paweł Stołowski
Approved revision: no longer in the source branch.
Merged at revision: 3142
Proposed branch: lp:~nick-dedekind/unity/smart-scopes.entry-activation
Merge into: lp:~unity-team/unity/libunity-7.0-breakage
Diff against target: 134 lines (+22/-12)
2 files modified
dash/DashView.cpp (+21/-12)
dash/DashView.h (+1/-0)
To merge this branch: bzr merge lp:~nick-dedekind/unity/smart-scopes.entry-activation
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+163563@code.launchpad.net

Commit message

If enter is pressed while a search is still being performed, we wait a maximum of one second before activating.

Description of the change

If enter is pressed while a search is still being performed, we wait a maximum of one second before activating.

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
Paweł Stołowski (stolowski) wrote :

LGTM and works fine.

review: Approve

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 2013-04-30 23:37:21 +0000
3+++ dash/DashView.cpp 2013-05-13 16:04:38 +0000
4@@ -57,6 +57,8 @@
5 const int GROUP_HEADING_HEIGHT = 24;
6
7 const int PREVIEW_ICON_SPLIT_OFFSCREEN_OFFSET = 10;
8+
9+const int MAX_ENTRY_ACTIVATE_WAIT_TIMEOUT = 1000;
10 }
11
12 // This is so we can access some protected members in nux::VLayout and
13@@ -190,7 +192,7 @@
14 }
15
16
17-void DashView::OnResultActivated(ResultView::ActivateType type, LocalResult const& local_result, GVariant* data, std::string const& unique_id)
18+void DashView::OnResultActivated(ResultView::ActivateType type, LocalResult const& local_result, GVariant* data, std::string const& unique_id)
19 {
20 last_activated_result_ = local_result;
21 stored_activated_unique_id_ = unique_id;
22@@ -226,7 +228,7 @@
23 void DashView::BuildPreview(Preview::Ptr model)
24 {
25 if (!preview_displaying_)
26- {
27+ {
28 StartPreviewAnimation();
29
30 content_view_->SetPresentRedirectedView(false);
31@@ -369,7 +371,7 @@
32 });
33
34 split_animation_->finished.connect(sigc::mem_fun(this, &DashView::OnPreviewAnimationFinished));
35- split_animation_->Start();
36+ split_animation_->Start();
37 }
38
39 void DashView::EndPreviewAnimation()
40@@ -474,12 +476,12 @@
41
42 /* Give the scopes a chance to prep data before we map them */
43 if (active_scope_view_)
44- {
45+ {
46 scope_bar_->Activate(active_scope_view_->scope()->id());
47
48 active_scope_view_->SetVisible(true);
49 active_scope_view_->scope()->view_type = ScopeViewType::SCOPE_VIEW;
50-
51+
52 // this will make sure the spinner animates if the search takes a while
53 search_bar_->ForceLiveSearch();
54 }
55@@ -704,7 +706,7 @@
56 graphics_engine.PushClippingRectangle(geo_split_clip);
57
58 if (preview_scope_view_.IsValid())
59- {
60+ {
61 DrawPreviewResultTextures(graphics_engine, force_draw);
62 }
63
64@@ -923,7 +925,7 @@
65
66 std::vector<ResultViewTexture::Ptr> result_textures = preview_scope_view_->GetResultTextureContainers();
67 std::vector<ResultViewTexture::Ptr> top_textures;
68-
69+
70 int height_concat_below = 0;
71
72 // int i = 0;
73@@ -1063,12 +1065,12 @@
74 }
75
76 preview_container_->SetPresentRedirectedView(true);
77-
78+
79 graphics_engine.GetRenderStates().SetBlend(alpha, src, dest);
80 }
81 else
82 {
83- preview_container_->ProcessDraw(graphics_engine, preview_force_draw);
84+ preview_container_->ProcessDraw(graphics_engine, preview_force_draw);
85 }
86
87 if (preview_force_draw)
88@@ -1109,10 +1111,10 @@
89 if (visible_ && handled_type == ScopeHandledType::NOT_HANDLED)
90 {
91 ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST, NULL,
92- glib::Source::Priority::HIGH);
93+ glib::Source::Priority::HIGH);
94 }
95 else if (!visible_ || handled_type == ScopeHandledType::GOTO_DASH_URI)
96- {
97+ {
98 if (!scopes_->GetScope(id))
99 {
100 // should trigger the addition of the scope.
101@@ -1210,7 +1212,8 @@
102
103 search_bar_->SetSearchFinished();
104 search_in_progress_ = false;
105-
106+
107+ activate_timeout_.reset();
108 if (activate_on_finish_ && !err)
109 OnEntryActivated();
110 activate_on_finish_= false;
111@@ -1350,6 +1353,12 @@
112 }
113 // delay the activation until we get the SearchFinished signal
114 activate_on_finish_ = search_in_progress_;
115+
116+ activate_timeout_.reset(new glib::Timeout(MAX_ENTRY_ACTIVATE_WAIT_TIMEOUT, [this] {
117+ activate_on_finish_ = false;
118+ active_scope_view_->ActivateFirst();
119+ return FALSE;
120+ }));
121 }
122
123 // Keyboard navigation
124
125=== modified file 'dash/DashView.h'
126--- dash/DashView.h 2013-04-17 15:10:39 +0000
127+++ dash/DashView.h 2013-05-13 16:04:38 +0000
128@@ -162,6 +162,7 @@
129 guint64 last_activated_timestamp_;
130 bool search_in_progress_;
131 bool activate_on_finish_;
132+ glib::Source::UniquePtr activate_timeout_;
133
134 bool visible_;
135

Subscribers

People subscribed via source and target branches

to all changes: