diff options
| author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-08-17 10:03:32 +0100 |
|---|---|---|
| committer | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-08-17 10:03:32 +0100 |
| commit | 03c032a92715dde6c00b405843739081ca3065ea (patch) | |
| tree | 48960a2b10a2616740b816b3e76a7c83884e2e00 /unity-shared | |
| parent | 52650fe6763f618c6dadff4dd8abc2b70908be46 (diff) | |
| parent | 0b591dcaa00488e00c4618d58a62ed6e326349b2 (diff) | |
Merge with trunk
(bzr r2419.4.74)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/DashStyle.cpp | 7 | ||||
| -rw-r--r-- | unity-shared/FontSettings.cpp | 6 | ||||
| -rw-r--r-- | unity-shared/SearchBar.cpp | 6 | ||||
| -rw-r--r-- | unity-shared/StaticCairoText.cpp | 41 | ||||
| -rw-r--r-- | unity-shared/StaticCairoText.h | 3 | ||||
| -rw-r--r-- | unity-shared/UBusMessages.h | 12 |
6 files changed, 56 insertions, 19 deletions
diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp index 31d997f0f..8ac12c7d7 100644 --- a/unity-shared/DashStyle.cpp +++ b/unity-shared/DashStyle.cpp @@ -123,7 +123,7 @@ public: void Text(cairo_t* cr, nux::Color const& color, std::string const& label, - int font_size = -1, + int font_size, double horizMargin = 4.0, Alignment alignment = Alignment::CENTER); @@ -1355,6 +1355,10 @@ void Style::Impl::Text(cairo_t* cr, { pango_font_description_set_absolute_size(desc, text_size * PANGO_SCALE); } + else if (desc) + { + text_size = pango_font_description_get_size(desc) / PANGO_SCALE; + } PangoWeight weight; switch (regular_text_weight_) @@ -1627,7 +1631,6 @@ bool Style::SquareButton(cairo_t* cr, nux::ButtonVisualState state, int font_size, Alignment alignment, bool zeromargin) { - // sanity checks if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) return false; diff --git a/unity-shared/FontSettings.cpp b/unity-shared/FontSettings.cpp index 1b115f8e1..4da0e9679 100644 --- a/unity-shared/FontSettings.cpp +++ b/unity-shared/FontSettings.cpp @@ -30,9 +30,9 @@ FontSettings::FontSettings() { GtkSettings* settings = gtk_settings_get_default(); - sig_man_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-hintstyle", sigc::mem_fun(this, &FontSettings::Refresh))); - sig_man_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-rgba", sigc::mem_fun(this, &FontSettings::Refresh))); - sig_man_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-antialias", sigc::mem_fun(this, &FontSettings::Refresh))); + sig_man_.Add<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-hintstyle", sigc::mem_fun(this, &FontSettings::Refresh)); + sig_man_.Add<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-rgba", sigc::mem_fun(this, &FontSettings::Refresh)); + sig_man_.Add<void, GtkSettings*, GParamSpec*>(settings, "notify::gtk-xft-antialias", sigc::mem_fun(this, &FontSettings::Refresh)); Refresh(); } diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp index 31f69f100..0be1c8361 100644 --- a/unity-shared/SearchBar.cpp +++ b/unity-shared/SearchBar.cpp @@ -251,10 +251,8 @@ void SearchBar::Init() expand_icon_->mouse_click.connect(mouse_expand); } - sig_manager_.Add(new glib::Signal<void, GtkSettings*, GParamSpec*> - (gtk_settings_get_default(), - "notify::gtk-font-name", - sigc::mem_fun(this, &SearchBar::OnFontChanged))); + sig_manager_.Add<void, GtkSettings*, GParamSpec*>(gtk_settings_get_default(), "notify::gtk-font-name", + sigc::mem_fun(this, &SearchBar::OnFontChanged)); OnFontChanged(gtk_settings_get_default()); search_hint.changed.connect([&](std::string const& s) { OnSearchHintChanged(); }); diff --git a/unity-shared/StaticCairoText.cpp b/unity-shared/StaticCairoText.cpp index 8f055cbd7..0f51dfb14 100644 --- a/unity-shared/StaticCairoText.cpp +++ b/unity-shared/StaticCairoText.cpp @@ -67,7 +67,7 @@ struct StaticCairoText::Impl StaticCairoText* parent_; bool accept_key_nav_focus_; - bool need_new_extent_cache_; + mutable bool need_new_extent_cache_; // The three following are all set in get text extents. mutable Size cached_extent_; mutable Size cached_base_; @@ -309,6 +309,29 @@ void StaticCairoText::SetText(std::string const& text) } } +void StaticCairoText::SetMaximumSize(int w, int h) +{ + if (w != GetMaximumWidth()) + { + pimpl->need_new_extent_cache_ = true; + View::SetMaximumSize(w, h); + pimpl->UpdateTexture(); + return; + } + + View::SetMaximumSize(w, h); +} + +void StaticCairoText::SetMaximumWidth(int w) +{ + if (w != GetMaximumWidth()) + { + pimpl->need_new_extent_cache_ = true; + View::SetMaximumWidth(w); + pimpl->UpdateTexture(); + } +} + std::string StaticCairoText::GetText() const { return pimpl->text_; @@ -333,12 +356,15 @@ void StaticCairoText::SetTextColor(Color const& textColor) void StaticCairoText::SetFont(std::string const& font) { - pimpl->font_ = font; - pimpl->need_new_extent_cache_ = true; - Size s = GetTextExtents(); - SetMinimumHeight(s.height); - NeedRedraw(); - sigFontChanged.emit(this); + if (pimpl->font_ != font) + { + pimpl->font_ = font; + pimpl->need_new_extent_cache_ = true; + Size s = GetTextExtents(); + SetMinimumHeight(s.height); + NeedRedraw(); + sigFontChanged.emit(this); + } } int StaticCairoText::GetLineCount() const @@ -440,6 +466,7 @@ Size StaticCairoText::Impl::GetTextExtents() const result.height = std::ceil(static_cast<float>(logRect.height) / PANGO_SCALE); cached_extent_ = result; baseline_ = pango_layout_get_baseline(layout) / PANGO_SCALE; + need_new_extent_cache_ = false; // clean up pango_font_description_free(desc); diff --git a/unity-shared/StaticCairoText.h b/unity-shared/StaticCairoText.h index 9fba1fe9d..d3ddf1a8f 100644 --- a/unity-shared/StaticCairoText.h +++ b/unity-shared/StaticCairoText.h @@ -92,6 +92,9 @@ public: void SetAcceptKeyNavFocus(bool accept); + void SetMaximumSize(int w, int h); + void SetMaximumWidth(int w); + protected: // Key navigation virtual bool AcceptKeyNavFocus(); diff --git a/unity-shared/UBusMessages.h b/unity-shared/UBusMessages.h index 603baa19f..c83c92ea3 100644 --- a/unity-shared/UBusMessages.h +++ b/unity-shared/UBusMessages.h @@ -59,9 +59,6 @@ #define UBUS_LAUNCHER_ICON_START_DND "LAUNCHER_ICON_START_DND" #define UBUS_LAUNCHER_ICON_END_DND "LAUNCHER_ICON_END_DND" -// Signal to send on icon action and that you want to request hiding the launcher -#define UBUS_LAUNCHER_ACTION_DONE "LAUNCHER_ACTION_DONE" - // Signal to force the launcher into locked mode, (b) #define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE" @@ -82,6 +79,15 @@ // FIXME - fix the nux focus api so we don't need this #define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED" +// for communicating positions to the preview state machine (iii) +// (split y coord in absolute geometry, results to the left, results to the right) +#define UBUS_DASH_PREVIEW_INFO_PAYLOAD "DASH_PREVIEW_INFO_PAYLOAD" + +// called when previews wish to navigate left/right or close (is) +// -1 = left, 0 = close, 1 = right, +// string is the uri string that last result activated was +#define UBUS_DASH_PREVIEW_NAVIGATION_REQUEST "DASH_PREVIEW_NAVIGATION_REQUEST" + // Sends a string datatype containing the new icon name #define UBUS_HUD_ICON_CHANGED "HUD_ICON_CHANGED" #define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST" |
