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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Mikkel Kamstrup Erlandsen
Approved revision: no longer in the source branch.
Merged at revision: 1884
Proposed branch: lp:~azzar1/unity/fix-919567
Merge into: lp:unity
Diff against target: 186 lines (+39/-7)
10 files modified
manual-tests/Dash.txt (+16/-0)
plugins/unityshell/src/DashSearchBar.cpp (+1/-1)
plugins/unityshell/src/FilterBasicButton.cpp (+11/-5)
plugins/unityshell/src/FilterBasicButton.h (+1/-0)
plugins/unityshell/src/FilterExpanderLabel.cpp (+3/-1)
plugins/unityshell/src/FilterMultiRangeButton.cpp (+2/-0)
plugins/unityshell/src/FilterRatingsButton.cpp (+1/-0)
plugins/unityshell/src/FilterWidget.cpp (+1/-0)
plugins/unityshell/src/Launcher.cpp (+1/-0)
plugins/unityshell/src/LensBarIcon.cpp (+2/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-919567
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Mirco Müller (community) Needs Fixing
Review via email: mp+90340@code.launchpad.net

Description of the change

Make sure that the dash searchbar doesn't lose the focus when clicking on an empty dash area (or an area that should not get the focus on mouse down).

SetAccepetKeyNavFocus is already tested in trunk.

UNBLOCK

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Even without this branch it already works with trunk. So why is this branch needed?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Even without this branch it already works with trunk. So why is this branch
> needed?

To test it:
- Open the app lens
- Expand the filter bar
- Make sure the dash has the focus
- The cursor should blink
- Click (for example) between a filter expander and the All Button
  (for example between Type > and All)
- The cursor is still blinking.

Revision history for this message
Mirco Müller (macslow) wrote :

Works... add that description above as a manual-test and I'm good to approve it.

review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Works... add that description above as a manual-test and I'm good to approve
> it.

Done.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Why not include a test for the other bug you've linked, that is, bug #923988?

Also - the fix for this bug seems more like a band aid than a real fix. Is the bug not that the text changes on unrelated events?

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Why not include a test for the other bug you've linked, that is, bug #923988?
>

I've updated the manual test for the moment.

> Also - the fix for this bug seems more like a band aid than a real fix. Is the
> bug not that the text changes on unrelated events?

The text changes because the dash bar loses the key focus.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

> > Also - the fix for this bug seems more like a band aid than a real fix. Is
> the
> > bug not that the text changes on unrelated events?
>
> The text changes because the dash bar loses the key focus.

Exactly. That is what I consider to be the real bug. This patch fixes the symptoms but not the cause :-)

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> > > Also - the fix for this bug seems more like a band aid than a real fix. Is
> > the
> > > bug not that the text changes on unrelated events?
> >
> > The text changes because the dash bar loses the key focus.
>
> Exactly. That is what I consider to be the real bug. This patch fixes the
> symptoms but not the cause :-)

Then it's a general problem. We should create two bugs:

- The searchbar should not lose the focus when clicking on a filter button
- The searchbar text should not change when the searchbar loses the focus.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Agreed.

Code looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Dash.txt'
2--- manual-tests/Dash.txt 2012-01-26 12:59:18 +0000
3+++ manual-tests/Dash.txt 2012-01-31 08:47:28 +0000
4@@ -10,6 +10,22 @@
5 Outcome
6 The dash disappears, and gedit is run. If nothing happens or the first
7 command is run (in this case gcc), this test failed.
8+
9+
10+Mouse down and search bar focus
11+-------------------------------
12+This test makes sure that the search bar doesn't lose the focus clicking into
13+am emtpy area (or into a filter button).
14+
15+#. Open the app lens
16+#. Expand the filter bar
17+#. Make sure the dash has the focus
18+#. The cursor should blink
19+#. Click between a filter expander and the All Button (for example between Type > and All)
20+ or into a filter button.
21+
22+Outcome
23+The cursor is still blinking.
24
25
26 Category headers focus
27
28=== modified file 'plugins/unityshell/src/DashSearchBar.cpp'
29--- plugins/unityshell/src/DashSearchBar.cpp 2012-01-26 15:06:38 +0000
30+++ plugins/unityshell/src/DashSearchBar.cpp 2012-01-31 08:47:28 +0000
31@@ -474,4 +474,4 @@
32 }
33
34 } // namespace dash
35-} // namespace unity
36\ No newline at end of file
37+} // namespace unity
38
39=== modified file 'plugins/unityshell/src/FilterBasicButton.cpp'
40--- plugins/unityshell/src/FilterBasicButton.cpp 2012-01-26 15:06:38 +0000
41+++ plugins/unityshell/src/FilterBasicButton.cpp 2012-01-31 08:47:28 +0000
42@@ -36,33 +36,39 @@
43 FilterBasicButton::FilterBasicButton(nux::TextureArea* image, NUX_FILE_LINE_DECL)
44 : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
45 {
46- InitTheme();
47+ Init();
48 }
49
50 FilterBasicButton::FilterBasicButton(std::string const& label, NUX_FILE_LINE_DECL)
51 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
52 , label_(label)
53 {
54- InitTheme();
55+ Init();
56 }
57
58 FilterBasicButton::FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_DECL)
59 : nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
60 , label_(label)
61 {
62- InitTheme();
63+ Init();
64 }
65
66 FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
67 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
68 {
69- InitTheme();
70+ Init();
71 }
72
73 FilterBasicButton::~FilterBasicButton()
74 {
75 }
76
77+void FilterBasicButton::Init()
78+{
79+ InitTheme();
80+ SetAcceptKeyNavFocusOnMouseDown(false);
81+}
82+
83 void FilterBasicButton::InitTheme()
84 {
85 if (!active_)
86@@ -144,4 +150,4 @@
87 }
88
89 } // namespace dash
90-} // namespace unity
91\ No newline at end of file
92+} // namespace unity
93
94=== modified file 'plugins/unityshell/src/FilterBasicButton.h'
95--- plugins/unityshell/src/FilterBasicButton.h 2012-01-10 14:09:12 +0000
96+++ plugins/unityshell/src/FilterBasicButton.h 2012-01-31 08:47:28 +0000
97@@ -46,6 +46,7 @@
98 virtual long ComputeContentSize();
99 virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
100
101+ void Init();
102 void InitTheme();
103 void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
104
105
106=== modified file 'plugins/unityshell/src/FilterExpanderLabel.cpp'
107--- plugins/unityshell/src/FilterExpanderLabel.cpp 2012-01-26 15:06:38 +0000
108+++ plugins/unityshell/src/FilterExpanderLabel.cpp 2012-01-31 08:47:28 +0000
109@@ -93,6 +93,8 @@
110 cairo_label_ = new nux::StaticText(label_.c_str(), NUX_TRACKER_LOCATION);
111 cairo_label_->SetFontName("Ubuntu 10");
112 cairo_label_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
113+ cairo_label_->SetAcceptKeyNavFocusOnMouseDown(false);
114+
115 cairo_label_->mouse_down.connect(
116 [&](int x, int y, unsigned long button_flags, unsigned long key_flag)
117 {
118@@ -174,4 +176,4 @@
119 }
120
121 } // namespace dash
122-} // namespace unity
123\ No newline at end of file
124+} // namespace unity
125
126=== modified file 'plugins/unityshell/src/FilterMultiRangeButton.cpp'
127--- plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-01-10 14:09:12 +0000
128+++ plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-01-31 08:47:28 +0000
129@@ -45,6 +45,8 @@
130 , side_(MultiRangeSide::CENTER)
131 {
132 InitTheme();
133+ SetAcceptKeyNavFocusOnMouseDown(false);
134+
135 state_change.connect(sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
136 }
137
138
139=== modified file 'plugins/unityshell/src/FilterRatingsButton.cpp'
140--- plugins/unityshell/src/FilterRatingsButton.cpp 2012-01-10 14:09:12 +0000
141+++ plugins/unityshell/src/FilterRatingsButton.cpp 2012-01-31 08:47:28 +0000
142@@ -36,6 +36,7 @@
143 : nux::ToggleButton(NUX_FILE_LINE_PARAM)
144 {
145 InitTheme();
146+ SetAcceptKeyNavFocusOnMouseDown(false);
147
148 mouse_up.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseUp));
149 mouse_drag.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseDrag));
150
151=== modified file 'plugins/unityshell/src/FilterWidget.cpp'
152--- plugins/unityshell/src/FilterWidget.cpp 2012-01-10 14:09:12 +0000
153+++ plugins/unityshell/src/FilterWidget.cpp 2012-01-31 08:47:28 +0000
154@@ -32,6 +32,7 @@
155 FilterWidget::FilterWidget( NUX_FILE_LINE_DECL)
156 : nux::View(NUX_FILE_LINE_PARAM)
157 {
158+ SetAcceptKeyNavFocusOnMouseDown(false);
159 }
160
161 } // namespace dash
162
163=== modified file 'plugins/unityshell/src/Launcher.cpp'
164--- plugins/unityshell/src/Launcher.cpp 2012-01-30 19:21:52 +0000
165+++ plugins/unityshell/src/Launcher.cpp 2012-01-31 08:47:28 +0000
166@@ -156,6 +156,7 @@
167 //OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));
168
169 CaptureMouseDownAnyWhereElse(true);
170+ SetAcceptKeyNavFocusOnMouseDown(false);
171
172 QuicklistManager& ql_manager = *(QuicklistManager::Default());
173 ql_manager.quicklist_opened.connect(sigc::mem_fun(this, &Launcher::RecvQuicklistOpened));
174
175=== modified file 'plugins/unityshell/src/LensBarIcon.cpp'
176--- plugins/unityshell/src/LensBarIcon.cpp 2011-09-29 03:45:59 +0000
177+++ plugins/unityshell/src/LensBarIcon.cpp 2012-01-31 08:47:28 +0000
178@@ -39,6 +39,8 @@
179 SetMaximumHeight(24);
180 SetOpacity(inactive_opacity_);
181
182+ SetAcceptKeyNavFocusOnMouseDown(false);
183+
184 active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged));
185 mouse_enter.connect([&]
186 (int, int, unsigned long, unsigned long) { QueueDraw(); });