Merge lp:~azzar1/unity/fix-932486 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3937
Proposed branch: lp:~azzar1/unity/fix-932486
Merge into: lp:unity
Diff against target: 199 lines (+26/-18)
9 files modified
launcher/AbstractLauncherIcon.h (+1/-1)
launcher/LauncherController.cpp (+5/-1)
launcher/LauncherIcon.cpp (+4/-4)
launcher/LauncherIcon.h (+1/-1)
launcher/MockLauncherIcon.h (+1/-1)
launcher/QuicklistManager.cpp (+4/-3)
launcher/QuicklistManager.h (+1/-1)
launcher/QuicklistView.cpp (+6/-4)
launcher/QuicklistView.h (+3/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-932486
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Stephen M. Webb (community) Approve
Review via email: mp+253699@code.launchpad.net

Commit message

Do not restore focus if a quicklist is opened during launcher key navigation.

Description of the change

Do not restore focus if a quicklist is opened during launcher key navigation.

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) :
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 'launcher/AbstractLauncherIcon.h'
2--- launcher/AbstractLauncherIcon.h 2014-04-16 01:21:56 +0000
3+++ launcher/AbstractLauncherIcon.h 2015-03-20 16:39:20 +0000
4@@ -151,7 +151,7 @@
5
6 virtual void SetSortPriority(int priority) = 0;
7
8- virtual bool OpenQuicklist(bool select_first_item = false, int monitor = -1) = 0;
9+ virtual bool OpenQuicklist(bool select_first_item = false, int monitor = -1, bool restore_input_focus = false) = 0;
10 virtual void CloseQuicklist() = 0;
11
12 virtual void SetCenter(nux::Point3 const& center, int monitor) = 0;
13
14=== modified file 'launcher/LauncherController.cpp'
15--- launcher/LauncherController.cpp 2014-04-25 03:02:15 +0000
16+++ launcher/LauncherController.cpp 2015-03-20 16:39:20 +0000
17@@ -158,7 +158,10 @@
18
19 ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) {
20 if (reactivate_keynav)
21+ {
22 parent_->KeyNavGrab();
23+ keynav_restore_window_ = true;
24+ }
25
26 model_->SetSelection(reactivate_index);
27 AbstractLauncherIcon::Ptr const& selected = model_->Selection();
28@@ -1506,8 +1509,9 @@
29
30 void Controller::Impl::OpenQuicklist()
31 {
32- if (model_->Selection()->OpenQuicklist(true, keyboard_launcher_->monitor()))
33+ if (model_->Selection()->OpenQuicklist(true, keyboard_launcher_->monitor(), keynav_restore_window_))
34 {
35+ keynav_restore_window_ = false;
36 reactivate_keynav = true;
37 reactivate_index = model_->SelectionIndex();
38 parent_->KeyNavTerminate(false);
39
40=== modified file 'launcher/LauncherIcon.cpp'
41--- launcher/LauncherIcon.cpp 2014-08-26 15:14:57 +0000
42+++ launcher/LauncherIcon.cpp 2015-03-20 16:39:20 +0000
43@@ -518,7 +518,7 @@
44 _allow_quicklist_to_show = true;
45 }
46
47-bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)
48+bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor, bool restore_input_focus)
49 {
50 MenuItemsVector const& menus = Menus();
51
52@@ -588,14 +588,14 @@
53 if (win_manager.IsExpoActive())
54 {
55 auto conn = std::make_shared<sigc::connection>();
56- *conn = win_manager.terminate_expo.connect([this, conn, pos] {
57- QuicklistManager::Default()->ShowQuicklist(_quicklist, pos.x, pos.y);
58+ *conn = win_manager.terminate_expo.connect([this, conn, pos, restore_input_focus] {
59+ QuicklistManager::Default()->ShowQuicklist(_quicklist, pos.x, pos.y, restore_input_focus);
60 conn->disconnect();
61 });
62 }
63 else
64 {
65- QuicklistManager::Default()->ShowQuicklist(_quicklist, pos.x, pos.y);
66+ QuicklistManager::Default()->ShowQuicklist(_quicklist, pos.x, pos.y, restore_input_focus);
67 }
68
69 return true;
70
71=== modified file 'launcher/LauncherIcon.h'
72--- launcher/LauncherIcon.h 2014-08-08 14:22:45 +0000
73+++ launcher/LauncherIcon.h 2015-03-20 16:39:20 +0000
74@@ -73,7 +73,7 @@
75
76 void ShowTooltip();
77
78- bool OpenQuicklist(bool select_first_item = false, int monitor = -1);
79+ bool OpenQuicklist(bool select_first_item = false, int monitor = -1, bool restore_input_focus = false);
80 void CloseQuicklist();
81
82 void SetCenter(nux::Point3 const& center, int parent_monitor);
83
84=== modified file 'launcher/MockLauncherIcon.h'
85--- launcher/MockLauncherIcon.h 2014-08-05 17:28:36 +0000
86+++ launcher/MockLauncherIcon.h 2015-03-20 16:39:20 +0000
87@@ -148,7 +148,7 @@
88
89 void SetOrder(int order) { order_ = order; }
90
91- bool OpenQuicklist(bool select_first_item = false, int monitor = -1)
92+ bool OpenQuicklist(bool select_first_item = false, int monitor = -1, bool restore_input_focus = false)
93 {
94 return false;
95 }
96
97=== modified file 'launcher/QuicklistManager.cpp'
98--- launcher/QuicklistManager.cpp 2013-10-03 22:31:39 +0000
99+++ launcher/QuicklistManager.cpp 2015-03-20 16:39:20 +0000
100@@ -74,8 +74,9 @@
101 return true;
102 }
103
104-void QuicklistManager::ShowQuicklist(nux::ObjectPtr<QuicklistView> const& quicklist, int tip_x,
105- int tip_y, bool hide_existing_if_open)
106+void QuicklistManager::ShowQuicklist(nux::ObjectPtr<QuicklistView> const& quicklist,
107+ int tip_x, int tip_y,
108+ bool restore_input_focus, bool hide_existing_if_open)
109 {
110 if (_current_quicklist == quicklist)
111 return;
112@@ -85,7 +86,7 @@
113 HideQuicklist(_current_quicklist);
114 }
115
116- quicklist->ShowQuicklistWithTipAt(tip_x, tip_y);
117+ quicklist->ShowQuicklistWithTipAt(tip_x, tip_y, restore_input_focus);
118 nux::GetWindowCompositor().SetKeyFocusArea(quicklist.GetPointer());
119 }
120
121
122=== modified file 'launcher/QuicklistManager.h'
123--- launcher/QuicklistManager.h 2013-10-03 22:31:39 +0000
124+++ launcher/QuicklistManager.h 2015-03-20 16:39:20 +0000
125@@ -40,7 +40,7 @@
126 nux::ObjectPtr<QuicklistView> Current();
127
128 bool RegisterQuicklist(nux::ObjectPtr<QuicklistView> const&);
129- void ShowQuicklist(nux::ObjectPtr<QuicklistView> const&, int x, int y, bool hide_existing_if_open = true);
130+ void ShowQuicklist(nux::ObjectPtr<QuicklistView> const&, int x, int y, bool restore_input_focus = false, bool hide_existing_if_open = true);
131 void HideQuicklist(nux::ObjectPtr<QuicklistView> const&);
132 void MoveQuicklist(nux::ObjectPtr<QuicklistView> const&, int x, int y);
133
134
135=== modified file 'launcher/QuicklistView.cpp'
136--- launcher/QuicklistView.cpp 2014-03-25 00:35:42 +0000
137+++ launcher/QuicklistView.cpp 2015-03-20 16:39:20 +0000
138@@ -75,6 +75,7 @@
139 , _padding(decoration::Style::Get()->ActiveShadowRadius())
140 , _mouse_down(false)
141 , _enable_quicklist_for_testing(false)
142+ , _restore_input_focus(false)
143 , _cairo_text_has_changed(true)
144 , _current_item_index(-1)
145 {
146@@ -300,7 +301,7 @@
147 case NUX_VK_ESCAPE:
148 Hide();
149 // inform UnityScreen we leave key-nav completely
150- UBusManager::SendMessage(UBUS_LAUNCHER_END_KEY_NAV);
151+ UBusManager::SendMessage(UBUS_LAUNCHER_END_KEY_NAV, glib::Variant(_restore_input_focus));
152 break;
153
154 // <SPACE>, <RETURN> (activate selected menu-item)
155@@ -354,16 +355,17 @@
156 }
157 }
158
159-void QuicklistView::ShowQuicklistWithTipAt(int x, int y)
160+void QuicklistView::ShowQuicklistWithTipAt(int x, int y, bool restore_input_focus)
161 {
162 SetQuicklistPosition(x, y);
163- Show();
164+ Show(restore_input_focus);
165 }
166
167-void QuicklistView::Show()
168+void QuicklistView::Show(bool restore_input_focus)
169 {
170 if (!IsVisible())
171 {
172+ _restore_input_focus = restore_input_focus;
173 CairoBaseWindow::Show();
174 GrabPointer();
175 GrabKeyboard();
176
177=== modified file 'launcher/QuicklistView.h'
178--- launcher/QuicklistView.h 2014-03-25 00:03:56 +0000
179+++ launcher/QuicklistView.h 2015-03-20 16:39:20 +0000
180@@ -56,9 +56,9 @@
181 void RenderQuicklistView();
182
183 void SetQuicklistPosition(int x, int y);
184- void ShowQuicklistWithTipAt(int x, int y);
185+ void ShowQuicklistWithTipAt(int x, int y, bool restore_input_focus = false);
186
187- void Show();
188+ void Show(bool restore_input_focus = false);
189 void Hide();
190 void HideAndEndQuicklistNav();
191
192@@ -152,6 +152,7 @@
193 //iIf true, suppress the Quicklist behaviour that is expected in Unity.
194 // Keep the Quicklist on screen for testing and automation.
195 bool _enable_quicklist_for_testing;
196+ bool _restore_input_focus;
197
198 nux::HLayout* _hlayout;
199 nux::VLayout* _vlayout;