From 3420338776e4d47c18e62505f8d7a6ba8c12c64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 9 Feb 2016 19:16:51 +0100 Subject: Unity: use theme::Settings' font around (bzr r4068.4.6) --- dash/ResultRendererTile.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'dash') diff --git a/dash/ResultRendererTile.cpp b/dash/ResultRendererTile.cpp index 83abd127e..602c85057 100644 --- a/dash/ResultRendererTile.cpp +++ b/dash/ResultRendererTile.cpp @@ -32,6 +32,7 @@ #include "unity-shared/DashStyle.h" #include "unity-shared/TextureCache.h" #include "unity-shared/UnitySettings.h" +#include "unity-shared/ThemeSettings.h" namespace unity { @@ -465,13 +466,10 @@ void ResultRendererTile::LoadText(Result const& row) PangoFontDescription* desc = NULL; PangoContext* pango_context = NULL; GdkScreen* screen = gdk_screen_get_default(); // not ref'ed - glib::String font; - - g_object_get(gtk_settings_get_default(), "gtk-font-name", &font, NULL); cairo_set_font_options(cr, gdk_screen_get_font_options(screen)); layout = pango_cairo_create_layout(cr); - desc = pango_font_description_from_string(font.Value()); + desc = pango_font_description_from_string(theme::Settings::Get()->font().c_str()); pango_font_description_set_size (desc, FONT_SIZE * FONT_MULTIPLIER); pango_layout_set_font_description(layout, desc); -- cgit v1.2.3 From 67fad26f4ed0fcacb73cb2d2854d0dd2e72940d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 17 Feb 2016 14:40:40 +0100 Subject: FilterBasicButton: regenerate texture on theme change (bzr r4068.4.28) --- dash/FilterBasicButton.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'dash') diff --git a/dash/FilterBasicButton.cpp b/dash/FilterBasicButton.cpp index 727be89dc..a1466a6ac 100644 --- a/dash/FilterBasicButton.cpp +++ b/dash/FilterBasicButton.cpp @@ -72,6 +72,7 @@ FilterBasicButton::FilterBasicButton(std::string const& label, nux::TextureArea* scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale)); Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &FilterBasicButton::InitTheme))); + Style::Instance().changed.connect(sigc::mem_fun(this, &FilterBasicButton::InitTheme)); } void FilterBasicButton::InitTheme() -- cgit v1.2.3 From 7bfba75999adde6fcb6d4198d0b1c1a4954276a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 17 Feb 2016 19:40:53 +0100 Subject: DashView: ensure that we update scaling when monitor changes And also use better names for dash border sizes in DashStyle (bzr r4068.5.1) --- dash/DashController.cpp | 39 ++++++++++++++++++++++-------------- dash/DashController.h | 4 +++- dash/DashView.cpp | 53 ++++++++++++++++++++----------------------------- dash/DashView.h | 4 ++-- dash/StandaloneDash.cpp | 2 +- 5 files changed, 51 insertions(+), 51 deletions(-) (limited to 'dash') diff --git a/dash/DashController.cpp b/dash/DashController.cpp index 55519d28b..26042fc97 100644 --- a/dash/DashController.cpp +++ b/dash/DashController.cpp @@ -89,7 +89,7 @@ Controller::Controller(Controller::WindowCreator const& create_window) } SetupWindow(); - UScreen::GetDefault()->changed.connect([this] (int, std::vector const&) { Relayout(true); }); + UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &Controller::OnMonitorChanged)); form_factor_changed_ = Settings::Instance().form_factor.changed.connect([this] (FormFactor) { @@ -177,7 +177,6 @@ void Controller::RegisterUBusInterests() HideDash(); } }); - } void Controller::EnsureDash() @@ -242,19 +241,30 @@ nux::Geometry Controller::GetIdealWindowGeometry() monitor_geo.height); } -void Controller::Relayout(bool check_monitor) +void Controller::OnMonitorChanged(int primary, std::vector const& monitors) { - EnsureDash(); + if (!visible_ || !window_ || !view_) + return; - if (check_monitor) - monitor_ = CLAMP(GetIdealMonitor(), 0, static_cast(UScreen::GetDefault()->GetMonitors().size()-1)); + monitor_ = std::min(GetIdealMonitor(), monitors.size()-1); + view_->SetMonitor(monitor_); + Relayout(); +} - int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); - nux::Geometry geo = GetIdealWindowGeometry(); +void Controller::Relayout() +{ + EnsureDash(); view_->Relayout(); - window_->SetGeometry(geo); - view_->SetMonitorOffset(launcher_width, panel::Style::Instance().PanelHeight(monitor_)); + window_->SetGeometry(GetIdealWindowGeometry()); + UpdateDashPosition(); +} + +void Controller::UpdateDashPosition() +{ + int top_offset = panel::Style::Instance().PanelHeight(monitor_); + int left_offset = unity::Settings::Instance().LauncherWidth(monitor_); + view_->SetMonitorOffset(left_offset, top_offset); } void Controller::OnMouseDownOutsideWindow(int x, int y, @@ -308,18 +318,17 @@ bool Controller::ShowDash() return false; } + screen_ungrabbed_slot_->disconnect(); wm.SaveInputFocus(); EnsureDash(); monitor_ = GetIdealMonitor(); - screen_ungrabbed_slot_->disconnect(); - int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); - view_->SetMonitorOffset(launcher_width, panel::Style::Instance().PanelHeight(monitor_)); - view_->AboutToShow(monitor_); + view_->SetMonitor(monitor_); + view_->AboutToShow(); + UpdateDashPosition(); FocusWindow(); visible_ = true; - StartShowHideTimeline(); nux::Geometry const& view_content_geo = view_->GetContentGeometry(); diff --git a/dash/DashController.h b/dash/DashController.h index 6228a458e..686871d50 100644 --- a/dash/DashController.h +++ b/dash/DashController.h @@ -82,7 +82,9 @@ private: nux::Geometry GetIdealWindowGeometry(); int GetIdealMonitor(); - void Relayout(bool check_monitor =false); + void OnMonitorChanged(int primary, std::vector const&); + void UpdateDashPosition(); + void Relayout(); void OnMouseDownOutsideWindow(int x, int y, unsigned long bflags, unsigned long kflags); void OnExternalShowDash(GVariant* variant); diff --git a/dash/DashView.cpp b/dash/DashView.cpp index 391ffe625..848ca5fdf 100644 --- a/dash/DashView.cpp +++ b/dash/DashView.cpp @@ -139,10 +139,8 @@ DashView::DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& app SetupViews(); SetupUBusConnections(); - AddChild(overlay_window_buttons_.GetPointer()); - mouse_down.connect(sigc::mem_fun(this, &DashView::OnMouseButtonDown)); preview_state_machine_.PreviewActivated.connect(sigc::mem_fun(this, &DashView::BuildPreview)); if (scopes_) @@ -169,6 +167,15 @@ DashView::~DashView() RemoveLayout(); } +void DashView::SetMonitor(int monitor) +{ + if (monitor_== monitor) + return; + + monitor_ = monitor; + scale = Settings::Instance().em(monitor_)->DPIScale(); +} + void DashView::SetMonitorOffset(int x, int y) { renderer_.x_offset = x; @@ -460,17 +467,11 @@ void DashView::OnPreviewAnimationFinished() content_view_->SetPresentRedirectedView(true); } -void DashView::AboutToShow(int monitor) +void DashView::AboutToShow() { visible_ = true; search_bar_->text_entry()->SelectAll(); - if (monitor_ != monitor) - { - monitor_ = monitor; - scale = Settings::Instance().em(monitor_)->DPIScale(); - } - /* Give the scopes a chance to prep data before we map them */ if (active_scope_view_) { @@ -614,7 +615,7 @@ void DashView::SetupUBusConnections() sigc::mem_fun(this, &DashView::OnActivateRequest)); } -long DashView::PostLayoutManagement (long LayoutResult) +long DashView::PostLayoutManagement(long LayoutResult) { Relayout(); return LayoutResult; @@ -662,7 +663,12 @@ void DashView::Relayout() nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo) { dash::Style& style = dash::Style::Instance(); - int panel_height = renderer_.y_offset; + int vertical_offset = renderer_.y_offset; + + if (style.always_maximised) + { + return nux::Geometry(0, vertical_offset, for_geo.width, for_geo.height - vertical_offset); + } int width = 0, height = 0; int tile_width = style.GetTileWidth().CP(scale); @@ -689,14 +695,9 @@ nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo) // width/height shouldn't be bigger than the geo available. width = std::min(width, for_geo.width); // launcher width is taken into account in for_geo. - height = std::min(height, for_geo.height - panel_height); // panel height is not taken into account in for_geo. + height = std::min(height, for_geo.height - vertical_offset); // panel height is not taken into account in for_geo. - if (style.always_maximised) - { - width = std::max(0, for_geo.width); - height = std::max(0, for_geo.height - panel_height); - } - return nux::Geometry(0, panel_height, width, height); + return nux::Geometry(0, vertical_offset, width, height); } void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) @@ -1119,18 +1120,6 @@ void DashView::DrawPreview(nux::GraphicsEngine& graphics_engine, bool force_draw } } -void DashView::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) -{ - nux::Geometry geo(content_geo_); - - if (Settings::Instance().form_factor() == FormFactor::DESKTOP) - { - dash::Style& style = dash::Style::Instance(); - geo.width += style.GetDashRightTileWidth().CP(scale); - geo.height += style.GetDashBottomTileHeight().CP(scale); - } -} - void DashView::OnActivateRequest(GVariant* args) { glib::String uri; @@ -1508,8 +1497,8 @@ void DashView::AddProperties(debug::IntrospectionData& introspection) introspection.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height)) .add("num_rows", num_rows) .add("form_factor", form_factor) - .add("right-border-width", style.GetDashRightTileWidth().CP(scale)) - .add("bottom-border-height", style.GetDashBottomTileHeight().CP(scale)) + .add("vertical-border-width", style.GetDashVerticalBorderWidth().CP(scale)) + .add("horizontal-border-height", style.GetDashHorizontalBorderHeight().CP(scale)) .add("preview_displaying", preview_displaying_) .add("preview_animation", animate_split_value_ * animate_preview_container_value_ * animate_preview_value_) .add("dash_maximized", style.always_maximised()) diff --git a/dash/DashView.h b/dash/DashView.h index cdcf70767..95f485157 100644 --- a/dash/DashView.h +++ b/dash/DashView.h @@ -64,11 +64,12 @@ public: nux::Property scale; - void AboutToShow(int monitor); + void AboutToShow(); void AboutToHide(); void Relayout(); void DisableBlur(); void OnActivateRequest(GVariant* args); + void SetMonitor(int monitor); void SetMonitorOffset(int x, int y); bool IsCommandLensOpen() const; @@ -108,7 +109,6 @@ private: void BuildPreview(Preview::Ptr model); void ClosePreview(); void OnPreviewAnimationFinished(); - void OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key); void OnBackgroundColorChanged(GVariant* args); void OnSearchChanged(std::string const& search_string); void OnLiveSearchReached(std::string const& search_string); diff --git a/dash/StandaloneDash.cpp b/dash/StandaloneDash.cpp index 81b0a6aa1..4f0a03d76 100644 --- a/dash/StandaloneDash.cpp +++ b/dash/StandaloneDash.cpp @@ -74,7 +74,7 @@ void TestRunner::Init () layout->AddView (view, 1, nux::MINOR_POSITION_CENTER); layout->SetMinMaxSize(WIDTH.CP(scale_), HEIGHT.CP(scale_)); - view->AboutToShow(0); + view->AboutToShow(); nux::GetWindowThread()->SetLayout (layout); nux::GetWindowCompositor().SetKeyFocusArea(view->default_focus()); -- cgit v1.2.3 From 89dc39a144983e244f8f9480c66440d66c545dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 17 Feb 2016 19:47:09 +0100 Subject: DashController: don't increase the input area by border sizes when maximized Fixes LP: #1546690 (bzr r4068.5.2) --- dash/DashController.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dash') diff --git a/dash/DashController.cpp b/dash/DashController.cpp index 26042fc97..09783e149 100644 --- a/dash/DashController.cpp +++ b/dash/DashController.cpp @@ -479,8 +479,13 @@ nux::Geometry Controller::GetInputWindowGeometry() nux::Geometry const& view_content_geo(view_->GetContentGeometry()); nux::Geometry geo(window_geo.x, window_geo.y, view_content_geo.width, view_content_geo.height); - geo.width += style.GetDashRightTileWidth().CP(view_->scale()); - geo.height += style.GetDashBottomTileHeight().CP(view_->scale()); + + if (Settings::Instance().form_factor() == FormFactor::DESKTOP) + { + geo.width += style.GetDashVerticalBorderWidth().CP(view_->scale()); + geo.height += style.GetDashHorizontalBorderHeight().CP(view_->scale()); + } + return geo; } -- cgit v1.2.3