Merge lp:~njpatel/unity/dash-fixes-2011-08-22 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1413
Proposed branch: lp:~njpatel/unity/dash-fixes-2011-08-22
Merge into: lp:unity
Diff against target: 1339 lines (+587/-82)
30 files modified
UnityCore/Lens.cpp (+0/-1)
plugins/unityshell/src/BFBLauncherIcon.cpp (+2/-1)
plugins/unityshell/src/DashSearchBarSpinner.cpp (+17/-5)
plugins/unityshell/src/DashSearchBarSpinner.h (+2/-0)
plugins/unityshell/src/DashView.cpp (+7/-10)
plugins/unityshell/src/FilterExpanderLabel.cpp (+2/-2)
plugins/unityshell/src/FilterGenreWidget.cpp (+4/-1)
plugins/unityshell/src/FilterMultiRangeButton.cpp (+1/-1)
plugins/unityshell/src/FontSettings.cpp (+88/-0)
plugins/unityshell/src/FontSettings.h (+43/-0)
plugins/unityshell/src/HomeView.cpp (+40/-2)
plugins/unityshell/src/HomeView.h (+5/-0)
plugins/unityshell/src/IconTexture.cpp (+5/-0)
plugins/unityshell/src/IconTexture.h (+4/-2)
plugins/unityshell/src/Launcher.cpp (+3/-1)
plugins/unityshell/src/LensBar.cpp (+48/-25)
plugins/unityshell/src/LensBar.h (+11/-1)
plugins/unityshell/src/LensBarIcon.cpp (+101/-0)
plugins/unityshell/src/LensBarIcon.h (+56/-0)
plugins/unityshell/src/LensView.cpp (+94/-16)
plugins/unityshell/src/LensView.h (+11/-0)
plugins/unityshell/src/PlacesGroup.cpp (+1/-1)
plugins/unityshell/src/PlacesStyle.cpp (+4/-0)
plugins/unityshell/src/PlacesStyle.h (+2/-0)
plugins/unityshell/src/ResultRendererTile.cpp (+21/-13)
plugins/unityshell/src/StaticCairoText.cpp (+1/-0)
plugins/unityshell/src/unityshell.cpp (+1/-0)
plugins/unityshell/src/unityshell.h (+3/-0)
tests/CMakeLists.txt (+8/-0)
tests/standalone_dash.cpp (+2/-0)
To merge this branch: bzr merge lp:~njpatel/unity/dash-fixes-2011-08-22
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+72699@code.launchpad.net

Description of the change

Miscellaneous fixes for the dash for renderering and also fixes a bunch of bugs.

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 'UnityCore/Lens.cpp'
2--- UnityCore/Lens.cpp 2011-08-10 09:51:24 +0000
3+++ UnityCore/Lens.cpp 2011-08-24 12:31:11 +0000
4@@ -173,7 +173,6 @@
5 glib::String search_string;
6
7 g_variant_get(parameters, "(sa{sv})", &search_string, NULL);
8- g_debug ("HELLO");
9 owner_->search_finished.emit(search_string.Str());
10 }
11
12
13=== modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp'
14--- plugins/unityshell/src/BFBLauncherIcon.cpp 2011-08-03 14:25:30 +0000
15+++ plugins/unityshell/src/BFBLauncherIcon.cpp 2011-08-24 12:31:11 +0000
16@@ -50,6 +50,7 @@
17 if (arg.button == 1)
18 {
19 UBusServer* ubus = ubus_server_get_default();
20- ubus_server_send_message(ubus, UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
21+ ubus_server_send_message(ubus, UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
22+ g_variant_new("(sus)", "home.lens", 0, ""));
23 }
24 }
25
26=== modified file 'plugins/unityshell/src/DashSearchBarSpinner.cpp'
27--- plugins/unityshell/src/DashSearchBarSpinner.cpp 2011-08-09 17:45:12 +0000
28+++ plugins/unityshell/src/DashSearchBarSpinner.cpp 2011-08-24 12:31:11 +0000
29@@ -52,6 +52,9 @@
30 {
31 if (_spinner_timeout)
32 g_source_remove(_spinner_timeout);
33+
34+ if (_frame_timeout)
35+ g_source_remove(_frame_timeout);
36 }
37
38 long
39@@ -157,8 +160,10 @@
40 texxform,
41 nux::color::White);
42 }
43-
44 GfxContext.PopClippingRectangle();
45+
46+ if (_state == STATE_SEARCHING && !_frame_timeout)
47+ _frame_timeout = g_timeout_add(22, (GSourceFunc)SearchBarSpinner::OnFrame, this);
48 }
49
50 void
51@@ -167,18 +172,24 @@
52 }
53
54 gboolean
55+SearchBarSpinner::OnTimeout(SearchBarSpinner* self)
56+{
57+ self->_state = STATE_READY;
58+ return FALSE;
59+}
60+
61+gboolean
62 SearchBarSpinner::OnFrame(SearchBarSpinner* self)
63 {
64 self->_rotation += 0.1f;
65-
66 if (self->_rotation >= 360.0f)
67 self->_rotation = 0.0f;
68
69 self->_2d_rotate.Rotate_z(self->_rotation);
70+ self->_frame_timeout = 0;
71
72 self->QueueDraw();
73-
74- return TRUE;
75+ return FALSE;
76 }
77
78 void
79@@ -192,12 +203,13 @@
80 if (_spinner_timeout)
81 g_source_remove(_spinner_timeout);
82 _spinner_timeout = 0;
83+
84 _2d_rotate.Rotate_z(0.0f);
85 _rotation = 0.0f;
86
87 if (_state == STATE_SEARCHING)
88 {
89- _spinner_timeout = g_timeout_add(15, (GSourceFunc)SearchBarSpinner::OnFrame, this);
90+ _spinner_timeout = g_timeout_add_seconds(5, (GSourceFunc)SearchBarSpinner::OnTimeout, this);
91 }
92
93 QueueDraw();
94
95=== modified file 'plugins/unityshell/src/DashSearchBarSpinner.h'
96--- plugins/unityshell/src/DashSearchBarSpinner.h 2011-08-09 06:24:59 +0000
97+++ plugins/unityshell/src/DashSearchBarSpinner.h 2011-08-24 12:31:11 +0000
98@@ -56,6 +56,7 @@
99 // Introspectable methods
100 const gchar* GetName();
101 void AddProperties(GVariantBuilder* builder);
102+ static gboolean OnTimeout(SearchBarSpinner* self);
103 static gboolean OnFrame(SearchBarSpinner* self);
104
105 // Key navigation
106@@ -76,6 +77,7 @@
107 float _rotation;
108
109 guint32 _spinner_timeout;
110+ guint32 _frame_timeout;
111 };
112
113 }
114
115=== modified file 'plugins/unityshell/src/DashView.cpp'
116--- plugins/unityshell/src/DashView.cpp 2011-08-22 13:48:47 +0000
117+++ plugins/unityshell/src/DashView.cpp 2011-08-24 12:31:11 +0000
118@@ -55,7 +55,7 @@
119 mouse_down.connect(sigc::mem_fun(this, &DashView::OnMouseButtonDown));
120
121 Relayout();
122- OnLensBarActivated("home");
123+ lens_bar_->Activate("home.lens");
124
125 bg_effect_helper_.owner = this;
126 bg_effect_helper_.enabled = false;
127@@ -105,7 +105,7 @@
128
129 home_view_ = new HomeView();
130 active_lens_view_ = home_view_;
131- lens_views_["home"] = home_view_;
132+ lens_views_["home.lens"] = home_view_;
133 lenses_layout_->AddView(home_view_);
134
135 lens_bar_ = new LensBar();
136@@ -117,8 +117,6 @@
137 {
138 ubus_manager_.RegisterInterest(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
139 sigc::mem_fun(this, &DashView::OnActivateRequest));
140- ubus_manager_.RegisterInterest(UBUS_PLACE_VIEW_QUEUE_DRAW,
141- [&] (GVariant* args) { QueueDraw(); });
142 ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED,
143 sigc::mem_fun(this, &DashView::OnBackgroundColorChanged));
144 }
145@@ -260,7 +258,7 @@
146 texxform,
147 nux::color::White);
148 }
149- {
150+ {
151 // Bottom repeated texture
152 int real_width = geo.width - corner->GetWidth();
153 int offset = real_width % bottom->GetWidth();
154@@ -276,7 +274,6 @@
155 texxform,
156 nux::color::White);
157 }
158-
159 {
160 // Right repeated texture
161 int real_height = geo.height - corner->GetHeight();
162@@ -358,7 +355,7 @@
163
164 g_variant_get(args, "(sus)", &id, NULL, &search_string);
165
166- OnLensBarActivated(id.Str());
167+ lens_bar_->Activate(id.Str());
168
169 // Reset focus
170 SetFocused(false);
171@@ -405,8 +402,6 @@
172
173 lens->activated.connect(sigc::mem_fun(this, &DashView::OnUriActivatedReply));
174 lens->search_finished.connect(sigc::mem_fun(this, &DashView::OnSearchFinished));
175-
176- lens->Search("");
177 }
178
179 void DashView::OnLensBarActivated(std::string const& id)
180@@ -418,7 +413,10 @@
181 }
182
183 for (auto it: lens_views_)
184+ {
185 it.second->SetVisible(it.first == id);
186+ it.second->active = it.first == id;
187+ }
188
189 LensView* view = active_lens_view_ = lens_views_[id];
190 search_bar_->search_string = view->search_string;
191@@ -447,7 +445,6 @@
192 void DashView::OnUriActivatedReply(std::string const& uri, HandledType type, Lens::Hints const&)
193 {
194 // We don't want to close the dash if there was another activation pending
195-
196 if (type == NOT_HANDLED)
197 {
198 if (!DoFallbackActivation(uri))
199
200=== modified file 'plugins/unityshell/src/FilterExpanderLabel.cpp'
201--- plugins/unityshell/src/FilterExpanderLabel.cpp 2011-08-19 15:17:30 +0000
202+++ plugins/unityshell/src/FilterExpanderLabel.cpp 2011-08-24 12:31:11 +0000
203@@ -34,7 +34,7 @@
204 , contents_ (NULL)
205 , right_hand_contents_ (NULL)
206 , expander_graphic_ (NULL)
207- , label_("<span font_size='x-large'>" + label + "</span>")
208+ , label_("<span font_size='larger'>" + label + "</span>")
209 {
210 expanded.changed.connect (sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange));
211 BuildLayout ();
212@@ -46,7 +46,7 @@
213
214 void FilterExpanderLabel::SetLabel (std::string label)
215 {
216- label_ = "<style size='x-large'>" + label + "</style>";
217+ label_ = "<style size='larger'>" + label + "</style>";
218 cairo_label_->SetText(label.c_str());
219 }
220
221
222=== modified file 'plugins/unityshell/src/FilterGenreWidget.cpp'
223--- plugins/unityshell/src/FilterGenreWidget.cpp 2011-08-17 15:00:14 +0000
224+++ plugins/unityshell/src/FilterGenreWidget.cpp 2011-08-24 12:31:11 +0000
225@@ -25,6 +25,7 @@
226 #include "FilterGenreWidget.h"
227 #include "FilterGenreButton.h"
228 #include "FilterBasicButton.h"
229+#include "PlacesStyle.h"
230
231 namespace unity {
232
233@@ -37,13 +38,15 @@
234 all_button_->activated.connect(sigc::mem_fun(this, &FilterGenre::OnAllActivated));
235 all_button_->Reference();
236
237+ PlacesStyle* style = PlacesStyle::GetDefault();
238+
239 genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION);
240 genre_layout_->ForceChildrenSize(true);
241 genre_layout_->SetHeightMatchContent(true);
242 genre_layout_->SetVerticalInternalMargin (6);
243 genre_layout_->SetHorizontalInternalMargin (6);
244 genre_layout_->EnablePartialVisibility (false);
245- genre_layout_->SetChildrenSize (120, 40);
246+ genre_layout_->SetChildrenSize (style->GetTileWidth() - 12, style->GetTextLineHeight() * 2);
247 genre_layout_->Reference();
248
249 SetRightHandView(all_button_);
250
251=== modified file 'plugins/unityshell/src/FilterMultiRangeButton.cpp'
252--- plugins/unityshell/src/FilterMultiRangeButton.cpp 2011-08-22 12:04:21 +0000
253+++ plugins/unityshell/src/FilterMultiRangeButton.cpp 2011-08-24 12:31:11 +0000
254@@ -122,7 +122,7 @@
255 normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_NORMAL));
256 }
257
258- SetMinimumHeight(32);
259+ //SetMinimumHeight(32);
260 }
261
262 void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state)
263
264=== added file 'plugins/unityshell/src/FontSettings.cpp'
265--- plugins/unityshell/src/FontSettings.cpp 1970-01-01 00:00:00 +0000
266+++ plugins/unityshell/src/FontSettings.cpp 2011-08-24 12:31:11 +0000
267@@ -0,0 +1,88 @@
268+/*
269+ * Copyright (C) 2011 Canonical Ltd
270+ *
271+ * This program is free software: you can redistribute it and/or modify
272+ * it under the terms of the GNU General Public License version 3 as
273+ * published by the Free Software Foundation.
274+ *
275+ * This program is distributed in the hope that it will be useful,
276+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
277+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
278+ * GNU General Public License for more details.
279+ *
280+ * You should have received a copy of the GNU General Public License
281+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
282+ *
283+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
284+ */
285+
286+#include "FontSettings.h"
287+
288+#include <cairo/cairo.h>
289+
290+#include <UnityCore/GLibWrapper.h>
291+
292+namespace unity
293+{
294+
295+FontSettings::FontSettings()
296+{
297+ GtkSettings* settings = gtk_settings_get_default();
298+
299+ sig_man_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-hintstyle", sigc::mem_fun(this, &FontSettings::Refresh)));
300+ sig_man_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-rgba", sigc::mem_fun(this, &FontSettings::Refresh)));
301+
302+ Refresh();
303+}
304+
305+void FontSettings::Refresh(GtkSettings* unused0, GParamSpec* unused1)
306+{
307+ GtkSettings* settings = gtk_settings_get_default();
308+ cairo_font_options_t* font_options = cairo_font_options_create();
309+
310+ {
311+ cairo_subpixel_order_t order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
312+ glib::String value;
313+ g_object_get(settings, "gtk-xft-rgba", &value, NULL);
314+
315+ if (value.Str() == "rgb")
316+ order = CAIRO_SUBPIXEL_ORDER_RGB;
317+ else if (value.Str() == "bgr")
318+ order = CAIRO_SUBPIXEL_ORDER_BGR;
319+ else if (value.Str() == "vrgb")
320+ order = CAIRO_SUBPIXEL_ORDER_VRGB;
321+ else if (value.Str() == "vbgr")
322+ order = CAIRO_SUBPIXEL_ORDER_VBGR;
323+
324+ cairo_font_options_set_subpixel_order(font_options, order);
325+ cairo_font_options_set_antialias(font_options,
326+ value.Str() == "none" ? CAIRO_ANTIALIAS_NONE
327+ : CAIRO_ANTIALIAS_SUBPIXEL);
328+
329+ }
330+
331+ {
332+ cairo_hint_style_t style = CAIRO_HINT_STYLE_DEFAULT;
333+ glib::String value;
334+ g_object_get(settings, "gtk-xft-hintstyle", &value, NULL);
335+
336+ if (value.Str() == "hintnone")
337+ style = CAIRO_HINT_STYLE_NONE;
338+ else if (value.Str() == "hintslight")
339+ style = CAIRO_HINT_STYLE_SLIGHT;
340+ else if (value.Str() == "hintmedium")
341+ style = CAIRO_HINT_STYLE_MEDIUM;
342+ else if (value.Str() == "hintfull")
343+ style = CAIRO_HINT_STYLE_FULL;
344+
345+ cairo_font_options_set_hint_style(font_options, style);
346+ }
347+
348+ // FIXME: Where do we read this value from?
349+ cairo_font_options_set_hint_metrics(font_options, CAIRO_HINT_METRICS_ON);
350+
351+ gdk_screen_set_font_options(gdk_screen_get_default(), font_options);
352+ cairo_font_options_destroy(font_options);
353+}
354+
355+}
356
357=== added file 'plugins/unityshell/src/FontSettings.h'
358--- plugins/unityshell/src/FontSettings.h 1970-01-01 00:00:00 +0000
359+++ plugins/unityshell/src/FontSettings.h 2011-08-24 12:31:11 +0000
360@@ -0,0 +1,43 @@
361+/*
362+ * Copyright (C) 2011 Canonical Ltd
363+ *
364+ * This program is free software: you can redistribute it and/or modify
365+ * it under the terms of the GNU General Public License version 3 as
366+ * published by the Free Software Foundation.
367+ *
368+ * This program is distributed in the hope that it will be useful,
369+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
370+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
371+ * GNU General Public License for more details.
372+ *
373+ * You should have received a copy of the GNU General Public License
374+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
375+ *
376+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
377+ */
378+
379+#ifndef UNITY_FONT_SETTINGS_H_
380+#define UNITY_FONT_SETTINGS_H_
381+
382+#include <gtk/gtk.h>
383+
384+#include <UnityCore/GLibSignal.h>
385+
386+namespace unity
387+{
388+
389+class FontSettings
390+{
391+public:
392+ FontSettings();
393+
394+private:
395+ void Refresh(GtkSettings* unused0=nullptr, GParamSpec* unused1=nullptr);
396+
397+private:
398+ glib::SignalManager sig_man_;
399+};
400+
401+}
402+
403+#endif
404
405=== modified file 'plugins/unityshell/src/HomeView.cpp'
406--- plugins/unityshell/src/HomeView.cpp 2011-08-11 16:04:49 +0000
407+++ plugins/unityshell/src/HomeView.cpp 2011-08-24 12:31:11 +0000
408@@ -39,6 +39,7 @@
409 NUX_IMPLEMENT_OBJECT_TYPE(HomeView);
410
411 HomeView::HomeView()
412+ : fix_renderering_id_(0)
413 {
414 SetupViews();
415
416@@ -52,11 +53,17 @@
417 group->SetVisible(search != "" && counts_[group]);
418 }
419 home_view_->SetVisible(search == "");
420+ scroll_view_->SetVisible(search != "");
421+
422+ QueueDraw();
423 });
424 }
425
426 HomeView::~HomeView()
427-{}
428+{
429+ if (fix_renderering_id_)
430+ g_source_remove(fix_renderering_id_);
431+}
432
433 void HomeView::SetupViews()
434 {
435@@ -65,13 +72,14 @@
436 scroll_view_ = new nux::ScrollView();
437 scroll_view_->EnableVerticalScrollBar(true);
438 scroll_view_->EnableHorizontalScrollBar(false);
439+ scroll_view_->SetVisible(false);
440 layout_->AddView(scroll_view_);
441
442 scroll_layout_ = new nux::VLayout();
443 scroll_view_->SetLayout(scroll_layout_);
444
445 home_view_ = new PlacesHomeView();
446- scroll_layout_->AddView(home_view_);
447+ layout_->AddView(home_view_);
448
449 SetLayout(layout_);
450 }
451@@ -124,6 +132,8 @@
452 PlacesStyle* style = PlacesStyle::GetDefault();
453 group->SetCounts(style->GetDefaultNColumns(), counts_[group]);
454 group->SetVisible(counts_[group]);
455+
456+ QueueFixRenderering();
457 }
458
459 void HomeView::OnGroupExpanded(PlacesGroup* group)
460@@ -143,6 +153,34 @@
461 }
462 }
463
464+void HomeView::QueueFixRenderering()
465+{
466+ if (fix_renderering_id_)
467+ return;
468+
469+ fix_renderering_id_ = g_timeout_add(0, (GSourceFunc)FixRenderering, this);
470+}
471+
472+gboolean HomeView::FixRenderering(HomeView* self)
473+{
474+ std::list<Area*> children = self->scroll_layout_->GetChildren();
475+ std::list<Area*>::reverse_iterator rit;
476+ bool found_one = false;
477+
478+ for (rit = children.rbegin(); rit != children.rend(); ++rit)
479+ {
480+ PlacesGroup* group = static_cast<PlacesGroup*>(*rit);
481+
482+ if (group->IsVisible())
483+ group->SetDrawSeparator(found_one);
484+
485+ found_one = group->IsVisible();
486+ }
487+
488+ self->fix_renderering_id_ = 0;
489+ return FALSE;
490+}
491+
492 long HomeView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
493 {
494 return layout_->ProcessEvent(ievent, traverse_info, event_info);
495
496=== modified file 'plugins/unityshell/src/HomeView.h'
497--- plugins/unityshell/src/HomeView.h 2011-08-11 01:12:21 +0000
498+++ plugins/unityshell/src/HomeView.h 2011-08-24 12:31:11 +0000
499@@ -60,6 +60,9 @@
500 void UpdateCounts(PlacesGroup* group);
501 void OnGroupExpanded(PlacesGroup* group);
502 void OnColumnsChanged();
503+ void QueueFixRenderering();
504+
505+ static gboolean FixRenderering(HomeView* self);
506
507 long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
508 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
509@@ -80,6 +83,8 @@
510 nux::VLayout* scroll_layout_;
511
512 PlacesHomeView* home_view_;
513+
514+ guint fix_renderering_id_;
515 };
516
517
518
519=== modified file 'plugins/unityshell/src/IconTexture.cpp'
520--- plugins/unityshell/src/IconTexture.cpp 2011-08-02 13:37:01 +0000
521+++ plugins/unityshell/src/IconTexture.cpp 2011-08-24 12:31:11 +0000
522@@ -250,6 +250,11 @@
523 _texture_cached->Reference();
524 }
525
526+nux::BaseTexture* IconTexture::texture() const
527+{
528+ return _texture_cached;
529+}
530+
531 bool
532 IconTexture::DoCanFocus()
533 {
534
535=== modified file 'plugins/unityshell/src/IconTexture.h'
536--- plugins/unityshell/src/IconTexture.h 2011-07-21 14:59:25 +0000
537+++ plugins/unityshell/src/IconTexture.h 2011-08-24 12:31:11 +0000
538@@ -45,6 +45,8 @@
539
540 void SetAcceptKeyNavFocus(bool accept);
541
542+ nux::BaseTexture* texture() const;
543+
544 protected:
545 // Key navigation
546 virtual bool AcceptKeyNavFocus();
547@@ -54,9 +56,9 @@
548 void AddProperties(GVariantBuilder* builder);
549 virtual bool DoCanFocus();
550
551+protected:
552+ void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
553 private:
554- void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
555-
556 void CreateTextureCallback(const char* texid, int width, int height, nux::BaseTexture** texture);
557 void Refresh(GdkPixbuf* pixbuf);
558 void IconLoaded(const char* icon_name, guint size, GdkPixbuf* pixbuf);
559
560=== modified file 'plugins/unityshell/src/Launcher.cpp'
561--- plugins/unityshell/src/Launcher.cpp 2011-08-23 23:23:47 +0000
562+++ plugins/unityshell/src/Launcher.cpp 2011-08-24 12:31:11 +0000
563@@ -1385,7 +1385,9 @@
564
565 // it's a tap on super and we didn't use any shortcuts
566 if (TapOnSuper() && !_latest_shortcut)
567- ubus_server_send_message(ubus_server_get_default(), UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
568+ ubus_server_send_message(ubus_server_get_default(),
569+ UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
570+ g_variant_new("(sus)", "home.lens", 0, ""));
571
572 remaining_time_before_hide = BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION - CLAMP((int)(TimeDelta(&current, &_times[TIME_SUPER_PRESSED])), 0, BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION);
573
574
575=== modified file 'plugins/unityshell/src/LensBar.cpp'
576--- plugins/unityshell/src/LensBar.cpp 2011-08-18 15:42:39 +0000
577+++ plugins/unityshell/src/LensBar.cpp 2011-08-24 12:31:11 +0000
578@@ -38,24 +38,8 @@
579 : nux::View(NUX_TRACKER_LOCATION)
580 {
581 SetupBackground();
582-
583- layout_ = new nux::HLayout();
584- layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
585- layout_->SetHorizontalInternalMargin(24);
586- SetLayout(layout_);
587-
588- SetMinimumHeight(40);
589- SetMaximumHeight(40);
590-
591- {
592- std::string id = "home";
593- IconTexture* icon = new IconTexture(PKGDATADIR"/lens-nav-home.svg", 26);
594- icon->SetMinMaxSize(26, 26);
595- icon->SetVisible(true);
596- layout_->AddView(icon, 0, nux::eCenter, nux::eFix);
597-
598- icon->mouse_click.connect([&, id] (int x, int y, unsigned long button, unsigned long keyboard) { lens_activated.emit(id); });
599- }
600+ SetupLayout();
601+ SetupHomeLens();
602 }
603
604 LensBar::~LensBar()
605@@ -70,18 +54,49 @@
606 bg_layer_ = new nux::ColorLayer(nux::Color(0.0f, 0.0f, 0.0f, 0.2f), true, rop);
607 }
608
609+void LensBar::SetupLayout()
610+{
611+ layout_ = new nux::HLayout();
612+ layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
613+ layout_->SetHorizontalInternalMargin(32);
614+ SetLayout(layout_);
615+
616+ SetMinimumHeight(40);
617+ SetMaximumHeight(40);
618+}
619+
620+void LensBar::SetupHomeLens()
621+{
622+ LensBarIcon* icon = new LensBarIcon("home.lens", PKGDATADIR"/lens-nav-home.svg");
623+ icon->SetVisible(true);
624+ icon->active = true;
625+ icons_.push_back(icon);
626+ layout_->AddView(icon, 0, nux::eCenter, nux::MINOR_SIZE_FULL);
627+
628+ icon->mouse_click.connect([&, icon] (int x, int y, unsigned long button, unsigned long keyboard) { SetActive(icon); });
629+}
630+
631 void LensBar::AddLens(Lens::Ptr& lens)
632 {
633- std::string id = lens->id;
634- std::string icon_hint = lens->icon_hint;
635-
636- IconTexture* icon = new IconTexture(icon_hint.c_str(), 26);
637- icon->SetMinMaxSize(26, 26);
638+ LensBarIcon* icon = new LensBarIcon(lens->id, lens->icon_hint);
639 icon->SetVisible(lens->visible);
640 lens->visible.changed.connect([icon](bool visible) { icon->SetVisible(visible); } );
641+ icons_.push_back(icon);
642 layout_->AddView(icon, 0, nux::eCenter, nux::eFix);
643
644- icon->mouse_click.connect([&, id] (int x, int y, unsigned long button, unsigned long keyboard) { lens_activated.emit(id); });
645+ icon->mouse_click.connect([&, icon] (int x, int y, unsigned long button, unsigned long keyboard) { SetActive(icon); });
646+}
647+
648+void LensBar::Activate(std::string id)
649+{
650+ for (auto icon: icons_)
651+ {
652+ if (icon->id == id)
653+ {
654+ SetActive(icon);
655+ break;
656+ }
657+ }
658 }
659
660 long LensBar::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
661@@ -109,12 +124,20 @@
662 nux::GetPainter().PushLayer(gfx_context, bg_layer_->GetGeometry(), bg_layer_);
663
664 layout_->ProcessDraw(gfx_context, force_draw);
665-
666+
667 nux::GetPainter().PopBackground();
668
669 gfx_context.PopClippingRectangle();
670 }
671
672+void LensBar::SetActive(LensBarIcon* activated)
673+{
674+ for (auto icon: icons_)
675+ icon->active = icon == activated;
676+
677+ lens_activated.emit(activated->id);
678+}
679+
680 // Keyboard navigation
681 bool LensBar::AcceptKeyNavFocus()
682 {
683
684=== modified file 'plugins/unityshell/src/LensBar.h'
685--- plugins/unityshell/src/LensBar.h 2011-08-18 15:42:39 +0000
686+++ plugins/unityshell/src/LensBar.h 2011-08-24 12:31:11 +0000
687@@ -20,6 +20,7 @@
688 #define UNITY_LENS_BAR_H_
689
690 #include <string>
691+#include <vector>
692
693 #include <NuxGraphics/GraphicsEngine.h>
694 #include <Nux/Nux.h>
695@@ -29,36 +30,45 @@
696
697 #include "IconTexture.h"
698 #include "Introspectable.h"
699+#include "LensBarIcon.h"
700
701 namespace unity
702 {
703 namespace dash
704 {
705
706-class LensBar : public nux::View, public unity::Introspectable
707+ class LensBar : public nux::View, public unity::Introspectable
708 {
709 NUX_DECLARE_OBJECT_TYPE(LensBar, nux::View);
710+ typedef std::vector<LensBarIcon*> LensIcons;
711
712 public:
713 LensBar();
714 ~LensBar();
715
716 void AddLens(Lens::Ptr& lens);
717+ void Activate(std::string id);
718
719 sigc::signal<void, std::string const&> lens_activated;
720
721 private:
722 void SetupBackground();
723+ void SetupLayout();
724+ void SetupHomeLens();
725
726 long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
727 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
728 void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
729
730+ void SetActive(LensBarIcon* icon);
731+
732 bool AcceptKeyNavFocus();
733 const gchar* GetName();
734 void AddProperties(GVariantBuilder* builder);
735
736 private:
737+ LensIcons icons_;
738+
739 nux::ColorLayer* bg_layer_;
740 nux::HLayout* layout_;
741 };
742
743=== added file 'plugins/unityshell/src/LensBarIcon.cpp'
744--- plugins/unityshell/src/LensBarIcon.cpp 1970-01-01 00:00:00 +0000
745+++ plugins/unityshell/src/LensBarIcon.cpp 2011-08-24 12:31:11 +0000
746@@ -0,0 +1,101 @@
747+/*
748+ * Copyright (C) 2010 Canonical Ltd
749+ *
750+ * This program is free software: you can redistribute it and/or modify
751+ * it under the terms of the GNU General Public License version 3 as
752+ * published by the Free Software Foundation.
753+ *
754+ * This program is distributed in the hope that it will be useful,
755+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
756+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
757+ * GNU General Public License for more details.
758+ *
759+ * You should have received a copy of the GNU General Public License
760+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
761+ *
762+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
763+ */
764+
765+#include "LensBarIcon.h"
766+
767+#include "config.h"
768+
769+namespace unity
770+{
771+namespace dash
772+{
773+
774+NUX_IMPLEMENT_OBJECT_TYPE(LensBarIcon);
775+
776+LensBarIcon::LensBarIcon(std::string id_, std::string icon_hint)
777+ : IconTexture(icon_hint.c_str(), 26)
778+ , id(id_)
779+ , active(false)
780+ , inactive_opacity_(0.4f)
781+{
782+ SetMinimumWidth(26);
783+ SetMaximumWidth(26);
784+ SetMinimumHeight(40);
785+ SetMaximumHeight(40);
786+ SetOpacity(inactive_opacity_);
787+
788+ active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged));
789+ mouse_enter.connect([&]
790+(int, int, unsigned long, unsigned long) { QueueDraw(); });
791+ mouse_leave.connect([&](int, int, unsigned long, unsigned long) { QueueDraw(); });
792+}
793+
794+LensBarIcon::~LensBarIcon()
795+{}
796+
797+void LensBarIcon::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
798+{
799+ nux::Geometry geo = GetGeometry();
800+
801+ gfx_context.PushClippingRectangle(geo);
802+
803+ nux::GetPainter().PaintBackground(gfx_context, geo);
804+
805+ if (!texture())
806+ return;
807+
808+ float opacity = active || IsMouseInside() ? 1.0f : inactive_opacity_;
809+ int width = 0, height = 0;
810+ GetTextureSize(&width, &height);
811+
812+ nux::Color col(1.0f * opacity, 1.0f * opacity, 1.0f * opacity, opacity);
813+ nux::TexCoordXForm texxform;
814+ texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
815+ texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
816+
817+ gfx_context.QRP_1Tex(geo.x + ((geo.width - width) / 2),
818+ geo.y + ((geo.height - height) / 2),
819+ width,
820+ height,
821+ texture()->GetDeviceTexture(),
822+ texxform,
823+ col);
824+ if (active)
825+ {
826+ nux::Geometry geo = GetGeometry();
827+ int middle = geo.x + geo.width/2;
828+ int size = 4;
829+ int y = geo.y + 1;
830+
831+ nux::GetPainter().Draw2DTriangleColor(gfx_context,
832+ middle - size, y,
833+ middle, y + size,
834+ middle + size, y,
835+ nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
836+ }
837+
838+ gfx_context.PopClippingRectangle();
839+}
840+
841+void LensBarIcon::OnActiveChanged(bool is_active)
842+{
843+ QueueDraw();
844+}
845+
846+}
847+}
848
849=== added file 'plugins/unityshell/src/LensBarIcon.h'
850--- plugins/unityshell/src/LensBarIcon.h 1970-01-01 00:00:00 +0000
851+++ plugins/unityshell/src/LensBarIcon.h 2011-08-24 12:31:11 +0000
852@@ -0,0 +1,56 @@
853+/*
854+ * Copyright (C) 2011 Canonical Ltd
855+ *
856+ * This program is free software: you can redistribute it and/or modify
857+ * it under the terms of the GNU General Public License version 3 as
858+ * published by the Free Software Foundation.
859+ *
860+ * This program is distributed in the hope that it will be useful,
861+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
862+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
863+ * GNU General Public License for more details.
864+ *
865+ * You should have received a copy of the GNU General Public License
866+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
867+ *
868+ * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
869+ */
870+
871+#ifndef UNITY_LENS_BAR_ICON_H_
872+#define UNITY_LENS_BAR_ICON_H_
873+
874+#include <string>
875+
876+#include <NuxGraphics/GraphicsEngine.h>
877+#include <Nux/Nux.h>
878+#include <Nux/HLayout.h>
879+#include <Nux/View.h>
880+
881+#include "IconTexture.h"
882+
883+namespace unity
884+{
885+namespace dash
886+{
887+
888+class LensBarIcon : public IconTexture
889+{
890+ NUX_DECLARE_OBJECT_TYPE(LensBarIcon, IconTexture);
891+public:
892+ LensBarIcon(std::string id, std::string icon_hint);
893+ ~LensBarIcon();
894+
895+ nux::Property<std::string> id;
896+ nux::Property<bool> active;
897+
898+private:
899+ void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
900+ void OnActiveChanged(bool is_active);
901+
902+private:
903+ const float inactive_opacity_;
904+};
905+
906+}
907+}
908+#endif
909
910=== modified file 'plugins/unityshell/src/LensView.cpp'
911--- plugins/unityshell/src/LensView.cpp 2011-08-11 01:11:11 +0000
912+++ plugins/unityshell/src/LensView.cpp 2011-08-24 12:31:11 +0000
913@@ -42,6 +42,7 @@
914 : nux::View(NUX_TRACKER_LOCATION)
915 , search_string("")
916 , filters_expanded(false)
917+ , fix_renderering_id_(0)
918 {}
919
920 LensView::LensView(Lens::Ptr lens)
921@@ -49,28 +50,27 @@
922 , search_string("")
923 , filters_expanded(false)
924 , lens_(lens)
925+ , initial_activation_(true)
926+ , fix_renderering_id_(0)
927 {
928 SetupViews();
929-
930- Categories::Ptr categories = lens_->categories;
931- categories->category_added.connect(sigc::mem_fun(this, &LensView::OnCategoryAdded));
932-
933- Results::Ptr results = lens_->results;
934- results->result_added.connect(sigc::mem_fun(this, &LensView::OnResultAdded));
935- results->result_removed.connect(sigc::mem_fun(this, &LensView::OnResultRemoved));
936-
937- Filters::Ptr filters = lens_->filters;
938- filters->filter_added.connect(sigc::mem_fun(this, &LensView::OnFilterAdded));
939- filters->filter_removed.connect(sigc::mem_fun(this, &LensView::OnFilterRemoved));
940-
941- PlacesStyle::GetDefault()->columns_changed.connect(sigc::mem_fun(this, &LensView::OnColumnsChanged));
942-
943+ SetupCategories();
944+ SetupResults();
945+ SetupFilters();
946+
947+ PlacesStyle::GetDefault()->columns_changed.connect(sigc::mem_fun(this, &LensView::OnColumnsChanged));
948+
949+ lens_->connected.changed.connect([&](bool is_connected) { if (is_connected) initial_activation_ = true; });
950 search_string.changed.connect([&](std::string const& search) { lens_->Search(search); });
951- filters_expanded.changed.connect([&](bool expanded) { fscroll_view_->SetVisible(expanded); ubus_manager_.SendMessage(UBUS_PLACE_VIEW_QUEUE_DRAW); });
952+ filters_expanded.changed.connect([&](bool expanded) { fscroll_view_->SetVisible(expanded); QueueRelayout(); });
953+ active.changed.connect(sigc::mem_fun(this, &LensView::OnActiveChanged));
954 }
955
956 LensView::~LensView()
957-{}
958+{
959+ if (fix_renderering_id_)
960+ g_source_remove(fix_renderering_id_);
961+}
962
963 void LensView::SetupViews()
964 {
965@@ -100,6 +100,35 @@
966 SetLayout(layout_);
967 }
968
969+void LensView::SetupCategories()
970+{
971+ Categories::Ptr categories = lens_->categories;
972+ categories->category_added.connect(sigc::mem_fun(this, &LensView::OnCategoryAdded));
973+
974+ for (unsigned int i = 0; i < categories->count(); ++i)
975+ OnCategoryAdded(categories->RowAtIndex(i));
976+}
977+
978+void LensView::SetupResults()
979+{
980+ Results::Ptr results = lens_->results;
981+ results->result_added.connect(sigc::mem_fun(this, &LensView::OnResultAdded));
982+ results->result_removed.connect(sigc::mem_fun(this, &LensView::OnResultRemoved));
983+
984+ for (unsigned int i = 0; i < results->count(); ++i)
985+ OnResultAdded(results->RowAtIndex(i));
986+}
987+
988+void LensView::SetupFilters()
989+{
990+ Filters::Ptr filters = lens_->filters;
991+ filters->filter_added.connect(sigc::mem_fun(this, &LensView::OnFilterAdded));
992+ filters->filter_removed.connect(sigc::mem_fun(this, &LensView::OnFilterRemoved));
993+
994+ for (unsigned int i = 0; i < filters->count(); ++i)
995+ OnFilterAdded(filters->FilterAtIndex(i));
996+}
997+
998 void LensView::OnCategoryAdded(Category const& category)
999 {
1000 std::string name = category.name;
1001@@ -128,6 +157,13 @@
1002 group->SetChildView(grid);
1003
1004 scroll_layout_->AddView(group, 0);
1005+
1006+ Categories::Ptr categories = lens_->categories;
1007+ if (category.index + 1 == categories->count())
1008+ {
1009+ lens_->Search("---");
1010+ lens_->Search("");
1011+ }
1012 }
1013
1014 void LensView::OnResultAdded(Result const& result)
1015@@ -162,6 +198,36 @@
1016
1017 group->SetCounts(style->GetDefaultNColumns(), counts_[group]);
1018 group->SetVisible(counts_[group]);
1019+
1020+ QueueFixRenderering();
1021+}
1022+
1023+void LensView::QueueFixRenderering()
1024+{
1025+ if (fix_renderering_id_)
1026+ return;
1027+
1028+ fix_renderering_id_ = g_timeout_add(0, (GSourceFunc)FixRenderering, this);
1029+}
1030+
1031+gboolean LensView::FixRenderering(LensView* self)
1032+{
1033+ std::list<Area*> children = self->scroll_layout_->GetChildren();
1034+ std::list<Area*>::reverse_iterator rit;
1035+ bool found_one = false;
1036+
1037+ for (rit = children.rbegin(); rit != children.rend(); ++rit)
1038+ {
1039+ PlacesGroup* group = static_cast<PlacesGroup*>(*rit);
1040+
1041+ if (group->IsVisible())
1042+ group->SetDrawSeparator(found_one);
1043+
1044+ found_one = group->IsVisible();
1045+ }
1046+
1047+ self->fix_renderering_id_ = 0;
1048+ return FALSE;
1049 }
1050
1051 void LensView::OnGroupExpanded(PlacesGroup* group)
1052@@ -196,6 +262,18 @@
1053 filter_bar_->RemoveFilter(filter);
1054 }
1055
1056+void LensView::OnActiveChanged(bool is_active)
1057+{
1058+ if (is_active && initial_activation_)
1059+ {
1060+ /* We reset the lens for ourselves, in case this is a restart or something */
1061+ lens_->Search("");
1062+ initial_activation_ = false;
1063+ }
1064+
1065+ lens_->active = is_active;
1066+}
1067+
1068 long LensView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
1069 {
1070 return layout_->ProcessEvent(ievent, traverse_info, event_info);
1071
1072=== modified file 'plugins/unityshell/src/LensView.h'
1073--- plugins/unityshell/src/LensView.h 2011-08-11 00:56:53 +0000
1074+++ plugins/unityshell/src/LensView.h 2011-08-24 12:31:11 +0000
1075@@ -54,11 +54,15 @@
1076
1077 nux::Property<std::string> search_string;
1078 nux::Property<bool> filters_expanded;
1079+ nux::Property<bool> active;
1080
1081 sigc::signal<void, std::string const&> uri_activated;
1082
1083 private:
1084 void SetupViews();
1085+ void SetupCategories();
1086+ void SetupResults();
1087+ void SetupFilters();
1088
1089 void OnCategoryAdded(Category const& category);
1090 void OnResultAdded(Result const& result);
1091@@ -68,6 +72,10 @@
1092 void OnColumnsChanged();
1093 void OnFilterAdded(Filter::Ptr filter);
1094 void OnFilterRemoved(Filter::Ptr filter);
1095+ void OnActiveChanged(bool is_active);
1096+ void QueueFixRenderering();
1097+
1098+ static gboolean FixRenderering(LensView* self);
1099
1100 virtual long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
1101 virtual void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
1102@@ -82,6 +90,7 @@
1103 Lens::Ptr lens_;
1104 CategoryGroups categories_;
1105 ResultCounts counts_;
1106+ bool initial_activation_;
1107
1108 nux::HLayout* layout_;
1109 nux::ScrollView* scroll_view_;
1110@@ -89,6 +98,8 @@
1111 nux::ScrollView* fscroll_view_;
1112 nux::VLayout* fscroll_layout_;
1113 FilterBar* filter_bar_;
1114+
1115+ guint fix_renderering_id_;
1116 };
1117
1118
1119
1120=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
1121--- plugins/unityshell/src/PlacesGroup.cpp 2011-08-19 15:17:30 +0000
1122+++ plugins/unityshell/src/PlacesGroup.cpp 2011-08-24 12:31:11 +0000
1123@@ -144,7 +144,7 @@
1124 {
1125 // Spaces are on purpose, want padding to be proportional to the size of the text
1126 // Bear with me, I'm trying something different :)
1127- const gchar* temp = " <big>%s</big> ";
1128+ const gchar* temp = " <span font_size='larger'>%s</span> ";
1129 gchar* tmp = NULL;
1130 gchar* final = NULL;
1131 if (_cached_name != NULL)
1132
1133=== modified file 'plugins/unityshell/src/PlacesStyle.cpp'
1134--- plugins/unityshell/src/PlacesStyle.cpp 2011-08-09 17:27:39 +0000
1135+++ plugins/unityshell/src/PlacesStyle.cpp 2011-08-24 12:31:11 +0000
1136@@ -143,6 +143,10 @@
1137 return GetHomeTileIconSize() + (_text_height * 4);
1138 }
1139
1140+int PlacesStyle::GetTextLineHeight()
1141+{
1142+ return _text_height;
1143+}
1144
1145 nux::BaseTexture* PlacesStyle::GetDashBottomTile()
1146 {
1147
1148=== modified file 'plugins/unityshell/src/PlacesStyle.h'
1149--- plugins/unityshell/src/PlacesStyle.h 2011-08-09 17:27:39 +0000
1150+++ plugins/unityshell/src/PlacesStyle.h 2011-08-24 12:31:11 +0000
1151@@ -45,6 +45,8 @@
1152 int GetHomeTileWidth();
1153 int GetHomeTileHeight();
1154
1155+ int GetTextLineHeight();
1156+
1157 nux::BaseTexture* GetDashBottomTile();
1158 nux::BaseTexture* GetDashRightTile();
1159 nux::BaseTexture* GetDashCorner();
1160
1161=== modified file 'plugins/unityshell/src/ResultRendererTile.cpp'
1162--- plugins/unityshell/src/ResultRendererTile.cpp 2011-08-18 09:14:53 +0000
1163+++ plugins/unityshell/src/ResultRendererTile.cpp 2011-08-24 12:31:11 +0000
1164@@ -27,6 +27,8 @@
1165 #include <gdk/gdk.h>
1166 #include <gtk/gtk.h>
1167
1168+#include <UnityCore/GLibWrapper.h>
1169+
1170 #include "IconLoader.h"
1171 #include "IconTexture.h"
1172 #include "PlacesStyle.h"
1173@@ -410,26 +412,34 @@
1174
1175 PangoLayout* layout = NULL;
1176 PangoFontDescription* desc = NULL;
1177- PangoContext* pangoCtx = NULL;
1178+ PangoContext* pango_context = NULL;
1179 GdkScreen* screen = gdk_screen_get_default(); // not ref'ed
1180-
1181+ glib::String font;
1182+ int dpi = -1;
1183+
1184+ g_object_get(gtk_settings_get_default(), "gtk-font-name", &font, NULL);
1185+ g_object_get(gtk_settings_get_default(), "gtk-xft-dpi", &dpi, NULL);
1186
1187 cairo_set_font_options(cr, gdk_screen_get_font_options(screen));
1188 layout = pango_cairo_create_layout(cr);
1189- desc = pango_font_description_from_string("Ubuntu 10");
1190+ desc = pango_font_description_from_string(font.Value());
1191
1192 pango_layout_set_font_description(layout, desc);
1193-
1194 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
1195+
1196+ pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
1197+ pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_START);
1198+ pango_layout_set_width(layout, (style->GetTileWidth() - 12)* PANGO_SCALE);
1199+ pango_layout_set_height(layout, -2);
1200+
1201 pango_layout_set_markup(layout, text.c_str(), -1);
1202- pango_layout_set_width(layout, (style->GetTileWidth() - 12)* PANGO_SCALE);
1203-
1204- pango_layout_set_height(layout, 2);
1205- pangoCtx = pango_layout_get_context(layout); // is not ref'ed
1206- pango_cairo_context_set_font_options(pangoCtx,
1207+
1208+ pango_context = pango_layout_get_context(layout); // is not ref'ed
1209+ pango_cairo_context_set_font_options(pango_context,
1210 gdk_screen_get_font_options(screen));
1211- // use some default DPI-value
1212- pango_cairo_context_set_resolution(pangoCtx, 96.0f);
1213+ pango_cairo_context_set_resolution(pango_context,
1214+ dpi == -1 ? 96.0f : dpi/(float) PANGO_SCALE);
1215+ pango_layout_context_changed(layout);
1216
1217 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
1218 cairo_paint(cr);
1219@@ -437,8 +447,6 @@
1220 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1221 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f);
1222
1223- pango_layout_context_changed(layout);
1224-
1225 cairo_move_to(cr, 0.0f, 0.0f);
1226 pango_cairo_show_layout(cr, layout);
1227
1228
1229=== modified file 'plugins/unityshell/src/StaticCairoText.cpp'
1230--- plugins/unityshell/src/StaticCairoText.cpp 2011-08-05 15:17:12 +0000
1231+++ plugins/unityshell/src/StaticCairoText.cpp 2011-08-24 12:31:11 +0000
1232@@ -320,6 +320,7 @@
1233 surface = cairo_image_surface_create(CAIRO_FORMAT_A1, 1, 1);
1234 cr = cairo_create(surface);
1235 cairo_set_font_options(cr, gdk_screen_get_font_options(screen));
1236+
1237 layout = pango_cairo_create_layout(cr);
1238 desc = pango_font_description_from_string(font);
1239 pango_layout_set_font_description(layout, desc);
1240
1241=== modified file 'plugins/unityshell/src/unityshell.cpp'
1242--- plugins/unityshell/src/unityshell.cpp 2011-08-24 02:25:07 +0000
1243+++ plugins/unityshell/src/unityshell.cpp 2011-08-24 12:31:11 +0000
1244@@ -1371,6 +1371,7 @@
1245 gdk_screen_get_monitor_geometry (scr, primary_monitor, &rect);
1246 _primary_monitor = rect;
1247
1248+
1249 wt->SetWindowSize(rect.width, rect.height);
1250
1251 lCurGeom = launcherWindow->GetGeometry();
1252
1253=== modified file 'plugins/unityshell/src/unityshell.h'
1254--- plugins/unityshell/src/unityshell.h 2011-08-22 03:06:14 +0000
1255+++ plugins/unityshell/src/unityshell.h 2011-08-24 12:31:11 +0000
1256@@ -31,6 +31,7 @@
1257
1258 #include "Introspectable.h"
1259 #include "DashController.h"
1260+#include "FontSettings.h"
1261 #include "Launcher.h"
1262 #include "LauncherController.h"
1263 #include "PanelController.h"
1264@@ -77,6 +78,7 @@
1265
1266 #include <compiztoolbox/compiztoolbox.h>
1267
1268+using unity::FontSettings;
1269 using namespace unity::switcher;
1270 using namespace unity::dash;
1271 using unity::UBusManager;
1272@@ -208,6 +210,7 @@
1273 static void OnLauncherStartKeyNav(GVariant* data, void* value);
1274 static void OnLauncherEndKeyNav(GVariant* data, void* value);
1275
1276+ FontSettings font_settings_;
1277 Launcher* launcher;
1278 LauncherController* controller;
1279 DashController::Ptr dashController;
1280
1281=== modified file 'tests/CMakeLists.txt'
1282--- tests/CMakeLists.txt 2011-08-16 11:34:48 +0000
1283+++ tests/CMakeLists.txt 2011-08-24 12:31:11 +0000
1284@@ -95,6 +95,8 @@
1285 ${UNITY_SRC}/FilterGenreButton.cpp
1286 ${UNITY_SRC}/FilterGenreWidget.cpp
1287 ${UNITY_SRC}/FilterBar.cpp
1288+ ${UNITY_SRC}/FontSettings.cpp
1289+ ${UNITY_SRC}/FontSettings.h
1290 ${UNITY_SRC}/IMTextEntry.cpp
1291 ${UNITY_SRC}/IMTextEntry.h
1292 ${UNITY_SRC}/PlacesHomeView.cpp
1293@@ -122,6 +124,8 @@
1294 ${UNITY_SRC}/Introspectable.h
1295 ${UNITY_SRC}/LensBar.cpp
1296 ${UNITY_SRC}/LensBar.h
1297+ ${UNITY_SRC}/LensBarIcon.cpp
1298+ ${UNITY_SRC}/LensBarIcon.h
1299 ${UNITY_SRC}/LensView.cpp
1300 ${UNITY_SRC}/LensView.h
1301 ${UNITY_SRC}/PreviewApplications.cpp
1302@@ -270,6 +274,8 @@
1303 ${UNITY_SRC}/FilterMultiRangeButton.cpp
1304 ${UNITY_SRC}/FilterMultiRangeWidget.cpp
1305 ${UNITY_SRC}/DashStyle.cpp
1306+ ${UNITY_SRC}/PlacesStyle.cpp
1307+ ${UNITY_SRC}/PlacesStyle.h
1308 )
1309 add_dependencies(test-filters unity-core-${UNITY_API_VERSION})
1310
1311@@ -286,6 +292,8 @@
1312 ${UNITY_SRC}/FilterGenreWidget.cpp
1313 ${UNITY_SRC}/FilterBar.cpp
1314 ${UNITY_SRC}/DashStyle.cpp
1315+ ${UNITY_SRC}/PlacesStyle.cpp
1316+ ${UNITY_SRC}/PlacesStyle.h
1317 )
1318 add_dependencies(test-filter-bar unity-core-${UNITY_API_VERSION})
1319
1320
1321=== modified file 'tests/standalone_dash.cpp'
1322--- tests/standalone_dash.cpp 2011-08-22 13:48:47 +0000
1323+++ tests/standalone_dash.cpp 2011-08-24 12:31:11 +0000
1324@@ -27,6 +27,7 @@
1325 #include <NuxCore/Logger.h>
1326
1327 #include "BGHash.h"
1328+#include "FontSettings.h"
1329 #include "DashView.h"
1330 #include "PlacesSettings.h"
1331
1332@@ -91,6 +92,7 @@
1333 gtk_init (&argc, &argv);
1334
1335 unity::BGHash bghash;
1336+ unity::FontSettings font_settings;
1337
1338 nux::NuxInitialize(0);
1339 nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));