Merge lp:~gordallott/unity/keynav-fixes-11-03-10 into lp:unity
- keynav-fixes-11-03-10
- Merge into trunk
Proposed by
Gord Allott
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 943 | ||||
Proposed branch: | lp:~gordallott/unity/keynav-fixes-11-03-10 | ||||
Merge into: | lp:unity | ||||
Prerequisite: | lp:~unity-team/unity/various-fixes-2011-03-08 | ||||
Diff against target: |
454 lines (+120/-34) 14 files modified
src/IconTexture.cpp (+2/-1) src/IconTexture.h (+2/-3) src/PlacesGroup.cpp (+60/-13) src/PlacesGroup.h (+4/-0) src/PlacesResultsView.cpp (+19/-0) src/PlacesResultsView.h (+2/-0) src/PlacesSearchBar.cpp (+4/-6) src/PlacesSearchBar.h (+0/-2) src/PlacesTile.cpp (+7/-0) src/PlacesTile.h (+2/-2) src/PlacesView.cpp (+15/-1) src/StaticCairoText.cpp (+1/-5) src/StaticCairoText.h (+0/-1) tests/TestPlaces.cpp (+2/-0) |
||||
To merge this branch: | bzr merge lp:~gordallott/unity/keynav-fixes-11-03-10 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Approve | ||
Review via email: mp+52843@code.launchpad.net |
Commit message
Description of the change
Bunch of keynav fixes - still a few issues;
Can't click to focus the search bar anymore, not sure why, but as a consequence you don't get a cursor
when keynav is used on a group that has more items than are visible, you can navigate "into" that group, effectively losing focus on your keynav - should be fixed once groups are updated to not create more items than they can fit or groups at least make the items return false on IsVisible (); - unity bug not a keynav one
Keynav doesn't scroll the window
Combo-box isn't supported so you can't keynav to that yet.
requires https:/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/IconTexture.cpp' | |||
2 | --- src/IconTexture.cpp 2011-03-01 09:22:43 +0000 | |||
3 | +++ src/IconTexture.cpp 2011-03-10 15:06:55 +0000 | |||
4 | @@ -46,6 +46,7 @@ | |||
5 | 46 | LoadIcon (); | 46 | LoadIcon (); |
6 | 47 | 47 | ||
7 | 48 | _can_pass_focus_to_composite_layout = false; | 48 | _can_pass_focus_to_composite_layout = false; |
8 | 49 | SetCanFocus (false); | ||
9 | 49 | } | 50 | } |
10 | 50 | 51 | ||
11 | 51 | IconTexture::~IconTexture () | 52 | IconTexture::~IconTexture () |
12 | @@ -187,7 +188,7 @@ | |||
13 | 187 | } | 188 | } |
14 | 188 | 189 | ||
15 | 189 | bool | 190 | bool |
17 | 190 | IconTexture::CanFocus () | 191 | IconTexture::DoCanFocus () |
18 | 191 | { | 192 | { |
19 | 192 | return false; | 193 | return false; |
20 | 193 | } | 194 | } |
21 | 194 | 195 | ||
22 | === modified file 'src/IconTexture.h' | |||
23 | --- src/IconTexture.h 2011-02-28 16:49:11 +0000 | |||
24 | +++ src/IconTexture.h 2011-03-10 15:06:55 +0000 | |||
25 | @@ -42,7 +42,8 @@ | |||
26 | 42 | protected: | 42 | protected: |
27 | 43 | const gchar* GetName (); | 43 | const gchar* GetName (); |
28 | 44 | void AddProperties (GVariantBuilder *builder); | 44 | void AddProperties (GVariantBuilder *builder); |
30 | 45 | 45 | virtual bool DoCanFocus (); | |
31 | 46 | |||
32 | 46 | private: | 47 | private: |
33 | 47 | void Draw (nux::GraphicsEngine& GfxContext, bool force_draw); | 48 | void Draw (nux::GraphicsEngine& GfxContext, bool force_draw); |
34 | 48 | 49 | ||
35 | @@ -53,8 +54,6 @@ | |||
36 | 53 | char *_icon_name; | 54 | char *_icon_name; |
37 | 54 | unsigned int _size; | 55 | unsigned int _size; |
38 | 55 | 56 | ||
39 | 56 | virtual bool CanFocus (); | ||
40 | 57 | |||
41 | 58 | GdkPixbuf *_pixbuf_cached; | 57 | GdkPixbuf *_pixbuf_cached; |
42 | 59 | nux::BaseTexture *_texture_cached; | 58 | nux::BaseTexture *_texture_cached; |
43 | 60 | int _texture_width; | 59 | int _texture_width; |
44 | 61 | 60 | ||
45 | === modified file 'src/PlacesGroup.cpp' | |||
46 | --- src/PlacesGroup.cpp 2011-03-07 10:40:56 +0000 | |||
47 | +++ src/PlacesGroup.cpp 2011-03-10 15:06:55 +0000 | |||
48 | @@ -58,7 +58,8 @@ | |||
49 | 58 | { | 58 | { |
50 | 59 | PlacesStyle *style = PlacesStyle::GetDefault (); | 59 | PlacesStyle *style = PlacesStyle::GetDefault (); |
51 | 60 | nux::BaseTexture *arrow = style->GetGroupUnexpandIcon (); | 60 | nux::BaseTexture *arrow = style->GetGroupUnexpandIcon (); |
53 | 61 | 61 | ||
54 | 62 | _cached_name = NULL; | ||
55 | 62 | _group_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION); | 63 | _group_layout = new nux::VLayout ("", NUX_TRACKER_LOCATION); |
56 | 63 | 64 | ||
57 | 64 | _header_layout = new nux::HLayout (NUX_TRACKER_LOCATION); | 65 | _header_layout = new nux::HLayout (NUX_TRACKER_LOCATION); |
58 | @@ -77,11 +78,17 @@ | |||
59 | 77 | _expand_label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END); | 78 | _expand_label->SetTextEllipsize (nux::StaticCairoText::NUX_ELLIPSIZE_END); |
60 | 78 | _expand_label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT); | 79 | _expand_label->SetTextAlignment (nux::StaticCairoText::NUX_ALIGN_LEFT); |
61 | 79 | _expand_label->SetTextColor (kExpandDefaultTextColor); | 80 | _expand_label->SetTextColor (kExpandDefaultTextColor); |
62 | 81 | _expand_label->SetCanFocus (true); | ||
63 | 82 | _expand_label->FocusActivated.connect (sigc::mem_fun (this, &PlacesGroup::OnLabelActivated)); | ||
64 | 83 | _expand_label->FocusChanged.connect (sigc::mem_fun (this, &PlacesGroup::OnLabelFocusChanged)); | ||
65 | 84 | |||
66 | 85 | |||
67 | 80 | _header_layout->AddView (_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); | 86 | _header_layout->AddView (_expand_label, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
68 | 81 | 87 | ||
69 | 82 | _expand_icon = new nux::TextureArea (); | 88 | _expand_icon = new nux::TextureArea (); |
70 | 83 | _expand_icon->SetTexture (arrow); | 89 | _expand_icon->SetTexture (arrow); |
71 | 84 | _expand_icon->SetMinimumSize (arrow->GetWidth (), arrow->GetHeight ()); | 90 | _expand_icon->SetMinimumSize (arrow->GetWidth (), arrow->GetHeight ()); |
72 | 91 | _expand_icon->SetCanFocus (false); | ||
73 | 85 | _header_layout->AddView (_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); | 92 | _header_layout->AddView (_expand_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
74 | 86 | 93 | ||
75 | 87 | SetLayout (_group_layout); | 94 | SetLayout (_group_layout); |
76 | @@ -107,17 +114,39 @@ | |||
77 | 107 | } | 114 | } |
78 | 108 | 115 | ||
79 | 109 | void | 116 | void |
80 | 117 | PlacesGroup::OnLabelActivated (nux::Area *label) | ||
81 | 118 | { | ||
82 | 119 | SetExpanded (!_is_expanded); | ||
83 | 120 | } | ||
84 | 121 | |||
85 | 122 | void | ||
86 | 123 | PlacesGroup::OnLabelFocusChanged (nux::Area *label) | ||
87 | 124 | { | ||
88 | 125 | RefreshLabel (); | ||
89 | 126 | } | ||
90 | 127 | void | ||
91 | 110 | PlacesGroup::SetName (const char *name) | 128 | PlacesGroup::SetName (const char *name) |
92 | 111 | { | 129 | { |
93 | 112 | // Spaces are on purpose, want padding to be proportional to the size of the text | 130 | // Spaces are on purpose, want padding to be proportional to the size of the text |
94 | 113 | // Bear with me, I'm trying something different :) | 131 | // Bear with me, I'm trying something different :) |
95 | 114 | const gchar *temp = " <big>%s</big> "; | 132 | const gchar *temp = " <big>%s</big> "; |
97 | 115 | gchar *tmp, *final; | 133 | const gchar *temp_focused = " <big><b>%s</b></big> "; |
98 | 134 | gchar *tmp = NULL; | ||
99 | 135 | gchar *final = NULL; | ||
100 | 136 | if (_cached_name != NULL) | ||
101 | 137 | { | ||
102 | 138 | g_free (_cached_name); | ||
103 | 139 | } | ||
104 | 140 | |||
105 | 141 | _cached_name = g_strdup (name); | ||
106 | 116 | 142 | ||
107 | 117 | tmp = g_markup_escape_text (name, -1); | 143 | tmp = g_markup_escape_text (name, -1); |
108 | 118 | 144 | ||
111 | 119 | final = g_strdup_printf (temp, tmp); | 145 | if (_expand_label->GetFocused ()) |
112 | 120 | 146 | final = g_strdup_printf (temp_focused, tmp); | |
113 | 147 | else | ||
114 | 148 | final = g_strdup_printf (temp, tmp); | ||
115 | 149 | |||
116 | 121 | _name->SetText (final); | 150 | _name->SetText (final); |
117 | 122 | 151 | ||
118 | 123 | g_free (tmp); | 152 | g_free (tmp); |
119 | @@ -149,7 +178,7 @@ | |||
120 | 149 | } | 178 | } |
121 | 150 | 179 | ||
122 | 151 | void | 180 | void |
124 | 152 | PlacesGroup::Refresh () | 181 | PlacesGroup::RefreshLabel () |
125 | 153 | { | 182 | { |
126 | 154 | const char *temp = "<small>%s</small>"; | 183 | const char *temp = "<small>%s</small>"; |
127 | 155 | char *result_string; | 184 | char *result_string; |
128 | @@ -166,26 +195,38 @@ | |||
129 | 166 | else | 195 | else |
130 | 167 | { | 196 | { |
131 | 168 | result_string = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, | 197 | result_string = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, |
135 | 169 | "See one more result", | 198 | "See one more result", |
136 | 170 | "See %d more results", | 199 | "See %d more results", |
137 | 171 | _n_total_items - _n_visible_items_in_unexpand_mode), | 200 | _n_total_items - _n_visible_items_in_unexpand_mode), |
138 | 172 | _n_total_items - _n_visible_items_in_unexpand_mode); | 201 | _n_total_items - _n_visible_items_in_unexpand_mode); |
139 | 173 | } | 202 | } |
141 | 174 | 203 | ||
142 | 175 | _expand_icon->SetVisible (!(_n_visible_items_in_unexpand_mode >= _n_total_items && _n_total_items != 0)); | 204 | _expand_icon->SetVisible (!(_n_visible_items_in_unexpand_mode >= _n_total_items && _n_total_items != 0)); |
143 | 176 | 205 | ||
144 | 206 | char *tmpname = g_strdup (_cached_name); | ||
145 | 207 | SetName (tmpname); | ||
146 | 208 | g_free (tmpname); | ||
147 | 209 | |||
148 | 177 | final = g_strdup_printf (temp, result_string); | 210 | final = g_strdup_printf (temp, result_string); |
150 | 178 | 211 | ||
151 | 179 | _expand_label->SetText (final); | 212 | _expand_label->SetText (final); |
152 | 180 | _expand_label->SetVisible (_n_visible_items_in_unexpand_mode < _n_total_items); | 213 | _expand_label->SetVisible (_n_visible_items_in_unexpand_mode < _n_total_items); |
153 | 181 | 214 | ||
154 | 215 | QueueDraw (); | ||
155 | 216 | |||
156 | 217 | g_free ((result_string)); | ||
157 | 218 | g_free (final); | ||
158 | 219 | } | ||
159 | 220 | |||
160 | 221 | void | ||
161 | 222 | PlacesGroup::Refresh () | ||
162 | 223 | { | ||
163 | 224 | RefreshLabel (); | ||
164 | 182 | ComputeChildLayout (); | 225 | ComputeChildLayout (); |
165 | 183 | QueueDraw (); | 226 | QueueDraw (); |
166 | 184 | |||
167 | 185 | g_free ((result_string)); | ||
168 | 186 | g_free (final); | ||
169 | 187 | } | 227 | } |
170 | 188 | 228 | ||
171 | 229 | |||
172 | 189 | void | 230 | void |
173 | 190 | PlacesGroup::Relayout () | 231 | PlacesGroup::Relayout () |
174 | 191 | { | 232 | { |
175 | @@ -203,6 +244,12 @@ | |||
176 | 203 | self->ComputeChildLayout (); | 244 | self->ComputeChildLayout (); |
177 | 204 | self->_idle_id = 0; | 245 | self->_idle_id = 0; |
178 | 205 | 246 | ||
179 | 247 | if (self->GetFocused ()) | ||
180 | 248 | { | ||
181 | 249 | self->SetFocused (false); // unset focus on all children | ||
182 | 250 | self->SetFocused (true); // set focus on first child | ||
183 | 251 | } | ||
184 | 252 | |||
185 | 206 | return FALSE; | 253 | return FALSE; |
186 | 207 | } | 254 | } |
187 | 208 | 255 | ||
188 | 209 | 256 | ||
189 | === modified file 'src/PlacesGroup.h' | |||
190 | --- src/PlacesGroup.h 2011-03-06 17:40:56 +0000 | |||
191 | +++ src/PlacesGroup.h 2011-03-10 15:06:55 +0000 | |||
192 | @@ -65,6 +65,9 @@ | |||
193 | 65 | void RecvMouseClick (int x, int y, unsigned long button_flags, unsigned long key_flags); | 65 | void RecvMouseClick (int x, int y, unsigned long button_flags, unsigned long key_flags); |
194 | 66 | void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); | 66 | void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); |
195 | 67 | void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); | 67 | void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); |
196 | 68 | void OnLabelActivated (nux::Area *label); | ||
197 | 69 | void OnLabelFocusChanged (nux::Area *label); | ||
198 | 70 | void RefreshLabel (); | ||
199 | 68 | 71 | ||
200 | 69 | private: | 72 | private: |
201 | 70 | nux::VLayout *_group_layout; | 73 | nux::VLayout *_group_layout; |
202 | @@ -81,6 +84,7 @@ | |||
203 | 81 | bool _is_expanded; | 84 | bool _is_expanded; |
204 | 82 | guint _n_visible_items_in_unexpand_mode; | 85 | guint _n_visible_items_in_unexpand_mode; |
205 | 83 | guint _n_total_items; | 86 | guint _n_total_items; |
206 | 87 | char *_cached_name; | ||
207 | 84 | }; | 88 | }; |
208 | 85 | 89 | ||
209 | 86 | #endif | 90 | #endif |
210 | 87 | 91 | ||
211 | === modified file 'src/PlacesResultsView.cpp' | |||
212 | --- src/PlacesResultsView.cpp 2011-02-28 16:49:11 +0000 | |||
213 | +++ src/PlacesResultsView.cpp 2011-03-10 15:06:55 +0000 | |||
214 | @@ -41,6 +41,7 @@ | |||
215 | 41 | 41 | ||
216 | 42 | EnableVerticalScrollBar (true); | 42 | EnableVerticalScrollBar (true); |
217 | 43 | EnableHorizontalScrollBar (false); | 43 | EnableHorizontalScrollBar (false); |
218 | 44 | _idle_id = 0; | ||
219 | 44 | } | 45 | } |
220 | 45 | 46 | ||
221 | 46 | PlacesResultsView::~PlacesResultsView () | 47 | PlacesResultsView::~PlacesResultsView () |
222 | @@ -55,8 +56,24 @@ | |||
223 | 55 | ResetScrollToUp (); | 56 | ResetScrollToUp (); |
224 | 56 | _groups.push_back (group); | 57 | _groups.push_back (group); |
225 | 57 | _layout->AddView (group, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 58 | _layout->AddView (group, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
226 | 59 | |||
227 | 60 | if (_idle_id == 0) | ||
228 | 61 | _idle_id = g_idle_add ((GSourceFunc)OnIdleFocus, this); | ||
229 | 58 | } | 62 | } |
230 | 59 | 63 | ||
231 | 64 | gboolean | ||
232 | 65 | PlacesResultsView::OnIdleFocus (PlacesResultsView *self) | ||
233 | 66 | { | ||
234 | 67 | self->_idle_id = 0; | ||
235 | 68 | |||
236 | 69 | if (self->GetFocused ()) | ||
237 | 70 | { | ||
238 | 71 | self->SetFocused (false); // unset focus on all children | ||
239 | 72 | self->SetFocused (true); // set focus on first child | ||
240 | 73 | } | ||
241 | 74 | |||
242 | 75 | return FALSE; | ||
243 | 76 | } | ||
244 | 60 | void | 77 | void |
245 | 61 | PlacesResultsView::RemoveGroup (PlacesGroup *group) | 78 | PlacesResultsView::RemoveGroup (PlacesGroup *group) |
246 | 62 | { | 79 | { |
247 | @@ -64,6 +81,8 @@ | |||
248 | 64 | ResetScrollToUp (); | 81 | ResetScrollToUp (); |
249 | 65 | _groups.remove (group); | 82 | _groups.remove (group); |
250 | 66 | _layout->RemoveChildObject (group); | 83 | _layout->RemoveChildObject (group); |
251 | 84 | if (_idle_id == 0) | ||
252 | 85 | _idle_id = g_idle_add ((GSourceFunc)OnIdleFocus, this); | ||
253 | 67 | } | 86 | } |
254 | 68 | 87 | ||
255 | 69 | void | 88 | void |
256 | 70 | 89 | ||
257 | === modified file 'src/PlacesResultsView.h' | |||
258 | --- src/PlacesResultsView.h 2011-02-28 10:08:19 +0000 | |||
259 | +++ src/PlacesResultsView.h 2011-03-10 15:06:55 +0000 | |||
260 | @@ -54,6 +54,8 @@ | |||
261 | 54 | private: | 54 | private: |
262 | 55 | nux::Layout *_layout; | 55 | nux::Layout *_layout; |
263 | 56 | std::list<PlacesGroup *> _groups; | 56 | std::list<PlacesGroup *> _groups; |
264 | 57 | uint _idle_id; | ||
265 | 58 | static gboolean OnIdleFocus (PlacesResultsView *self); | ||
266 | 57 | }; | 59 | }; |
267 | 58 | 60 | ||
268 | 59 | #endif // PLACE_RESULTS_VIEW_H | 61 | #endif // PLACE_RESULTS_VIEW_H |
269 | 60 | 62 | ||
270 | === modified file 'src/PlacesSearchBar.cpp' | |||
271 | --- src/PlacesSearchBar.cpp 2011-03-08 18:01:39 +0000 | |||
272 | +++ src/PlacesSearchBar.cpp 2011-03-10 15:06:55 +0000 | |||
273 | @@ -65,15 +65,18 @@ | |||
274 | 65 | _search_icon->SetMinMaxSize (icon->GetWidth (), icon->GetHeight ()); | 65 | _search_icon->SetMinMaxSize (icon->GetWidth (), icon->GetHeight ()); |
275 | 66 | _layout->AddView (_search_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 66 | _layout->AddView (_search_icon, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
276 | 67 | _search_icon->OnMouseClick.connect (sigc::mem_fun (this, &PlacesSearchBar::OnClearClicked)); | 67 | _search_icon->OnMouseClick.connect (sigc::mem_fun (this, &PlacesSearchBar::OnClearClicked)); |
277 | 68 | _search_icon->SetCanFocus (false); | ||
278 | 68 | 69 | ||
279 | 69 | _layered_layout = new nux::LayeredLayout (); | 70 | _layered_layout = new nux::LayeredLayout (); |
280 | 70 | 71 | ||
281 | 71 | _hint = new nux::StaticCairoText (" "); | 72 | _hint = new nux::StaticCairoText (" "); |
282 | 72 | _hint->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.5f)); | 73 | _hint->SetTextColor (nux::Color (1.0f, 1.0f, 1.0f, 0.5f)); |
283 | 74 | _hint->SetCanFocus (false); | ||
284 | 73 | _layered_layout->AddLayer (_hint); | 75 | _layered_layout->AddLayer (_hint); |
285 | 74 | 76 | ||
286 | 75 | _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION); | 77 | _pango_entry = new nux::TextEntry ("", NUX_TRACKER_LOCATION); |
287 | 76 | _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged)); | 78 | _pango_entry->sigTextChanged.connect (sigc::mem_fun (this, &PlacesSearchBar::OnSearchChanged)); |
288 | 79 | _pango_entry->SetCanFocus (true); | ||
289 | 77 | _pango_entry->activated.connect (sigc::mem_fun (this, &PlacesSearchBar::OnEntryActivated)); | 80 | _pango_entry->activated.connect (sigc::mem_fun (this, &PlacesSearchBar::OnEntryActivated)); |
290 | 78 | _layered_layout->AddLayer (_pango_entry); | 81 | _layered_layout->AddLayer (_pango_entry); |
291 | 79 | 82 | ||
292 | @@ -87,6 +90,7 @@ | |||
293 | 87 | _combo->SetVisible (false); | 90 | _combo->SetVisible (false); |
294 | 88 | _combo->sigTriggered.connect (sigc::mem_fun (this, &PlacesSearchBar::OnComboChanged)); | 91 | _combo->sigTriggered.connect (sigc::mem_fun (this, &PlacesSearchBar::OnComboChanged)); |
295 | 89 | _combo->GetMenuPage ()->sigMouseDownOutsideMenuCascade.connect (sigc::mem_fun (this, &PlacesSearchBar::OnMenuClosing)); | 92 | _combo->GetMenuPage ()->sigMouseDownOutsideMenuCascade.connect (sigc::mem_fun (this, &PlacesSearchBar::OnMenuClosing)); |
296 | 93 | _combo->SetCanFocus (false); // NOT SUPPORTING THIS QUITE YET | ||
297 | 90 | _layout->AddView (_combo, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); | 94 | _layout->AddView (_combo, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); |
298 | 91 | 95 | ||
299 | 92 | _layout->SetVerticalExternalMargin (18); | 96 | _layout->SetVerticalExternalMargin (18); |
300 | @@ -119,12 +123,6 @@ | |||
301 | 119 | return ""; | 123 | return ""; |
302 | 120 | } | 124 | } |
303 | 121 | 125 | ||
304 | 122 | bool | ||
305 | 123 | PlacesSearchBar::CanFocus () | ||
306 | 124 | { | ||
307 | 125 | return false; | ||
308 | 126 | } | ||
309 | 127 | |||
310 | 128 | void PlacesSearchBar::AddProperties (GVariantBuilder *builder) | 126 | void PlacesSearchBar::AddProperties (GVariantBuilder *builder) |
311 | 129 | { | 127 | { |
312 | 130 | nux::Geometry geo = GetGeometry (); | 128 | nux::Geometry geo = GetGeometry (); |
313 | 131 | 129 | ||
314 | === modified file 'src/PlacesSearchBar.h' | |||
315 | --- src/PlacesSearchBar.h 2011-03-08 18:01:39 +0000 | |||
316 | +++ src/PlacesSearchBar.h 2011-03-10 15:06:55 +0000 | |||
317 | @@ -57,8 +57,6 @@ | |||
318 | 57 | sigc::signal<void, const char *> search_changed; | 57 | sigc::signal<void, const char *> search_changed; |
319 | 58 | sigc::signal<void> activated; | 58 | sigc::signal<void> activated; |
320 | 59 | 59 | ||
321 | 60 | bool CanFocus (); | ||
322 | 61 | |||
323 | 62 | protected: | 60 | protected: |
324 | 63 | // Introspectable methods | 61 | // Introspectable methods |
325 | 64 | const gchar * GetName (); | 62 | const gchar * GetName (); |
326 | 65 | 63 | ||
327 | === modified file 'src/PlacesTile.cpp' | |||
328 | --- src/PlacesTile.cpp 2011-03-09 14:13:41 +0000 | |||
329 | +++ src/PlacesTile.cpp 2011-03-10 15:06:55 +0000 | |||
330 | @@ -41,6 +41,7 @@ | |||
331 | 41 | OnMouseEnter.connect (sigc::mem_fun (this, &PlacesTile::RecvMouseEnter)); | 41 | OnMouseEnter.connect (sigc::mem_fun (this, &PlacesTile::RecvMouseEnter)); |
332 | 42 | OnMouseLeave.connect (sigc::mem_fun (this, &PlacesTile::RecvMouseLeave)); | 42 | OnMouseLeave.connect (sigc::mem_fun (this, &PlacesTile::RecvMouseLeave)); |
333 | 43 | FocusChanged.connect (sigc::mem_fun (this, &PlacesTile::OnFocusChanged)); | 43 | FocusChanged.connect (sigc::mem_fun (this, &PlacesTile::OnFocusChanged)); |
334 | 44 | FocusActivated.connect (sigc::mem_fun (this, &PlacesTile::OnFocusActivated)); | ||
335 | 44 | _can_pass_focus_to_composite_layout = false; | 45 | _can_pass_focus_to_composite_layout = false; |
336 | 45 | } | 46 | } |
337 | 46 | 47 | ||
338 | @@ -349,3 +350,9 @@ | |||
339 | 349 | { | 350 | { |
340 | 350 | QueueDraw (); | 351 | QueueDraw (); |
341 | 351 | } | 352 | } |
342 | 353 | |||
343 | 354 | void | ||
344 | 355 | PlacesTile::OnFocusActivated (nux::Area *area) | ||
345 | 356 | { | ||
346 | 357 | sigClick.emit (this); | ||
347 | 358 | } | ||
348 | 352 | 359 | ||
349 | === modified file 'src/PlacesTile.h' | |||
350 | --- src/PlacesTile.h 2011-03-09 14:13:41 +0000 | |||
351 | +++ src/PlacesTile.h 2011-03-10 15:06:55 +0000 | |||
352 | @@ -40,7 +40,7 @@ | |||
353 | 40 | 40 | ||
354 | 41 | protected: | 41 | protected: |
355 | 42 | virtual nux::Geometry GetHighlightGeometry (); | 42 | virtual nux::Geometry GetHighlightGeometry (); |
357 | 43 | 43 | ||
358 | 44 | private: | 44 | private: |
359 | 45 | void Draw (nux::GraphicsEngine &GfxContext, bool force_draw); | 45 | void Draw (nux::GraphicsEngine &GfxContext, bool force_draw); |
360 | 46 | void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw); | 46 | void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw); |
361 | @@ -69,7 +69,7 @@ | |||
362 | 69 | nux::TextureLayer *_hilight_layer; | 69 | nux::TextureLayer *_hilight_layer; |
363 | 70 | 70 | ||
364 | 71 | void OnFocusChanged (nux::Area *area); | 71 | void OnFocusChanged (nux::Area *area); |
366 | 72 | 72 | void OnFocusActivated (nux::Area *area); | |
367 | 73 | int _last_width; | 73 | int _last_width; |
368 | 74 | int _last_height; | 74 | int _last_height; |
369 | 75 | 75 | ||
370 | 76 | 76 | ||
371 | === modified file 'src/PlacesView.cpp' | |||
372 | --- src/PlacesView.cpp 2011-03-09 19:57:01 +0000 | |||
373 | +++ src/PlacesView.cpp 2011-03-10 15:06:55 +0000 | |||
374 | @@ -303,11 +303,13 @@ | |||
375 | 303 | _group_added_conn = _entry->group_added.connect (sigc::mem_fun (this, &PlacesView::OnGroupAdded)); | 303 | _group_added_conn = _entry->group_added.connect (sigc::mem_fun (this, &PlacesView::OnGroupAdded)); |
376 | 304 | _result_added_conn = _entry->result_added.connect (sigc::mem_fun (this, &PlacesView::OnResultAdded)); | 304 | _result_added_conn = _entry->result_added.connect (sigc::mem_fun (this, &PlacesView::OnResultAdded)); |
377 | 305 | _result_removed_conn = _entry->result_removed.connect (sigc::mem_fun (this, &PlacesView::OnResultRemoved)); | 305 | _result_removed_conn = _entry->result_removed.connect (sigc::mem_fun (this, &PlacesView::OnResultRemoved)); |
379 | 306 | 306 | ||
380 | 307 | if (_entry == _home_entry && (g_strcmp0 (search_string, "") == 0)) | 307 | if (_entry == _home_entry && (g_strcmp0 (search_string, "") == 0)) |
381 | 308 | _layered_layout->SetActiveLayer (_home_view); | 308 | _layered_layout->SetActiveLayer (_home_view); |
382 | 309 | else | 309 | else |
383 | 310 | _layered_layout->SetActiveLayer (_results_view); | 310 | _layered_layout->SetActiveLayer (_results_view); |
384 | 311 | |||
385 | 312 | |||
386 | 311 | } | 313 | } |
387 | 312 | 314 | ||
388 | 313 | PlaceEntry * | 315 | PlaceEntry * |
389 | @@ -605,6 +607,18 @@ | |||
390 | 605 | 607 | ||
391 | 606 | self->PlaceEntryActivateRequest (id, section, search_string); | 608 | self->PlaceEntryActivateRequest (id, section, search_string); |
392 | 607 | 609 | ||
393 | 610 | if (self->GetFocused ()) | ||
394 | 611 | { | ||
395 | 612 | // reset the focus | ||
396 | 613 | self->SetFocused (false); | ||
397 | 614 | self->SetFocused (true); | ||
398 | 615 | } | ||
399 | 616 | else | ||
400 | 617 | { | ||
401 | 618 | // Not focused but we really should be | ||
402 | 619 | self->SetFocused (true); | ||
403 | 620 | } | ||
404 | 621 | |||
405 | 608 | g_free (id); | 622 | g_free (id); |
406 | 609 | g_free (search_string); | 623 | g_free (search_string); |
407 | 610 | } | 624 | } |
408 | 611 | 625 | ||
409 | === modified file 'src/StaticCairoText.cpp' | |||
410 | --- src/StaticCairoText.cpp 2011-02-28 16:27:57 +0000 | |||
411 | +++ src/StaticCairoText.cpp 2011-03-10 15:06:55 +0000 | |||
412 | @@ -50,6 +50,7 @@ | |||
413 | 50 | _ellipsize = NUX_ELLIPSIZE_END; | 50 | _ellipsize = NUX_ELLIPSIZE_END; |
414 | 51 | _align = NUX_ALIGN_LEFT; | 51 | _align = NUX_ALIGN_LEFT; |
415 | 52 | _fontstring = NULL; | 52 | _fontstring = NULL; |
416 | 53 | SetCanFocus (false); | ||
417 | 53 | } | 54 | } |
418 | 54 | 55 | ||
419 | 55 | StaticCairoText::~StaticCairoText () | 56 | StaticCairoText::~StaticCairoText () |
420 | @@ -477,9 +478,4 @@ | |||
421 | 477 | self->sigFontChanged.emit (self); | 478 | self->sigFontChanged.emit (self); |
422 | 478 | } | 479 | } |
423 | 479 | 480 | ||
424 | 480 | bool StaticCairoText::CanFocus () | ||
425 | 481 | { | ||
426 | 482 | return false; | ||
427 | 483 | } | ||
428 | 484 | |||
429 | 485 | } | 481 | } |
430 | 486 | 482 | ||
431 | === modified file 'src/StaticCairoText.h' | |||
432 | --- src/StaticCairoText.h 2011-02-28 16:27:57 +0000 | |||
433 | +++ src/StaticCairoText.h 2011-03-10 15:06:55 +0000 | |||
434 | @@ -89,7 +89,6 @@ | |||
435 | 89 | sigc::signal<void, StaticCairoText*> sigTextChanged; | 89 | sigc::signal<void, StaticCairoText*> sigTextChanged; |
436 | 90 | sigc::signal<void, StaticCairoText*> sigTextColorChanged; | 90 | sigc::signal<void, StaticCairoText*> sigTextColorChanged; |
437 | 91 | sigc::signal<void, StaticCairoText*> sigFontChanged; | 91 | sigc::signal<void, StaticCairoText*> sigFontChanged; |
438 | 92 | virtual bool CanFocus (); | ||
439 | 93 | 92 | ||
440 | 94 | private: | 93 | private: |
441 | 95 | int _cached_extent_width; | 94 | int _cached_extent_width; |
442 | 96 | 95 | ||
443 | === modified file 'tests/TestPlaces.cpp' | |||
444 | --- tests/TestPlaces.cpp 2011-02-28 23:17:14 +0000 | |||
445 | +++ tests/TestPlaces.cpp 2011-03-10 15:06:55 +0000 | |||
446 | @@ -46,6 +46,8 @@ | |||
447 | 46 | _combo = new nux::ComboBoxSimple (NUX_TRACKER_LOCATION); | 46 | _combo = new nux::ComboBoxSimple (NUX_TRACKER_LOCATION); |
448 | 47 | _combo->SetMinimumWidth (150); | 47 | _combo->SetMinimumWidth (150); |
449 | 48 | _combo->sigTriggered.connect (sigc::mem_fun (this, &TestApp::OnComboChangedFoRealz)); | 48 | _combo->sigTriggered.connect (sigc::mem_fun (this, &TestApp::OnComboChangedFoRealz)); |
450 | 49 | _combo->SetCanFocus (false); | ||
451 | 50 | g_debug ("can we focus? %s", _combo->CanFocus () ? "yes :(" : "no! :D"); | ||
452 | 49 | layout->AddView (_combo, 0, nux::eCenter, nux::eFix); | 51 | layout->AddView (_combo, 0, nux::eCenter, nux::eFix); |
453 | 50 | 52 | ||
454 | 51 | _factory = PlaceFactory::GetDefault (); | 53 | _factory = PlaceFactory::GetDefault (); |
Very, very cool, works well and we can fix the remaining things for next week. Approved.