diff options
| -rw-r--r-- | com.canonical.Unity.gschema.xml | 4 | ||||
| -rw-r--r-- | dash/DashController.cpp | 10 | ||||
| -rw-r--r-- | hud/HudController.cpp | 30 | ||||
| -rw-r--r-- | launcher/Launcher.cpp | 8 | ||||
| -rw-r--r-- | panel/PanelView.cpp | 6 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 22 | ||||
| -rw-r--r-- | unity-shared/SpreadFilter.cpp | 7 | ||||
| -rw-r--r-- | unity-shared/UnitySettings.cpp | 43 | ||||
| -rw-r--r-- | unity-shared/UnitySettings.h | 7 |
9 files changed, 61 insertions, 76 deletions
diff --git a/com.canonical.Unity.gschema.xml b/com.canonical.Unity.gschema.xml index a3044b484..8a467010a 100644 --- a/com.canonical.Unity.gschema.xml +++ b/com.canonical.Unity.gschema.xml @@ -27,8 +27,8 @@ </key> <key enum="launcher-position-enum" name="launcher-position"> <default>"Left"</default> - <summary>Bottom</summary> - <description>The launcher position.</description> + <summary>Set the launcher position(Left/Bottom).</summary> + <description>Set the launcher position(Left/Bottom).</description> </key> <key type="i" name="minimize-count"> <default>0</default> diff --git a/dash/DashController.cpp b/dash/DashController.cpp index 43d21f8db..ed50d39dd 100644 --- a/dash/DashController.cpp +++ b/dash/DashController.cpp @@ -235,8 +235,7 @@ nux::Geometry Controller::GetIdealWindowGeometry() if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) { - std::cout << "Launcher_widht: " << std::endl; - int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); + int launcher_width = unity::Settings::Instance().LauncherSize(monitor_); // We want to cover as much of the screen as possible to grab any mouse events outside // of our window @@ -247,8 +246,7 @@ nux::Geometry Controller::GetIdealWindowGeometry() } else { - int launcher_height = unity::Settings::Instance().LauncherHeight(monitor_); - std::cout << "launcher_heigth: " << launcher_height << std::endl; + int launcher_height = unity::Settings::Instance().LauncherSize(monitor_); return nux::Geometry (monitor_geo.x, monitor_geo.y, monitor_geo.width, @@ -270,7 +268,7 @@ void Controller::Relayout(bool check_monitor) window_->SetGeometry(geo); if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) { - int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); + int launcher_width = unity::Settings::Instance().LauncherSize(monitor_); view_->SetMonitorOffset(launcher_width, panel::Style::Instance().PanelHeight(monitor_)); } else @@ -335,7 +333,7 @@ bool Controller::ShowDash() screen_ungrabbed_slot_->disconnect(); if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) { - int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); + int launcher_width = unity::Settings::Instance().LauncherSize(monitor_); view_->SetMonitorOffset(launcher_width, panel::Style::Instance().PanelHeight(monitor_)); } else diff --git a/hud/HudController.cpp b/hud/HudController.cpp index b318af88a..e294d495b 100644 --- a/hud/HudController.cpp +++ b/hud/HudController.cpp @@ -207,13 +207,8 @@ void Controller::SetIcon(std::string const& icon_name) { LOG_DEBUG(logger) << "setting icon to - " << icon_name; - int launcher_size; - if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) - launcher_size = unity::Settings::Instance().LauncherWidth(monitor_index_); - else - launcher_size = unity::Settings::Instance().LauncherHeight(monitor_index_); + int launcher_size = unity::Settings::Instance().LauncherSize(monitor_index_); - std::cout << "HudController(216): " << unity::Settings::Instance().LauncherWidth(monitor_index_) << ":" << unity::Settings::Instance().LauncherHeight(monitor_index_) << std::endl; if (view_) { double scale = view_->scale(); @@ -259,10 +254,17 @@ nux::Geometry Controller::GetIdealWindowGeometry() if (IsLockedToLauncher(ideal_monitor)) { -// int launcher_width = unity::Settings::Instance().LauncherWidth(ideal_monitor); - int launcher_width = 20; - geo.x += launcher_width; - geo.width -= launcher_width; + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + { + int launcher_width = unity::Settings::Instance().LauncherSize(ideal_monitor); + geo.x += launcher_width; + geo.width -= launcher_width; + } + else + { + int launcher_height = unity::Settings::Instance().LauncherSize(ideal_monitor); + geo.height -= launcher_height; + } } return geo; @@ -276,13 +278,15 @@ void Controller::Relayout(bool check_monitor) monitor_index_ = CLAMP(GetIdealMonitor(), 0, static_cast<int>(UScreen::GetDefault()->GetMonitors().size()-1)); nux::Geometry const& geo = GetIdealWindowGeometry(); -// int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_index_); - int launcher_width = 20; + int launcher_width = unity::Settings::Instance().LauncherSize(monitor_index_); view_->QueueDraw(); window_->SetGeometry(geo); panel::Style &panel_style = panel::Style::Instance(); - view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_index_)); + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_index_)); + else + view_->SetMonitorOffset(0, panel_style.PanelHeight(monitor_index_)); } void Controller::OnMouseDownOutsideWindow(int x, int y, diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp index b595f8b08..04e6612b0 100644 --- a/launcher/Launcher.cpp +++ b/launcher/Launcher.cpp @@ -1343,10 +1343,9 @@ void Launcher::OnMonitorChanged(int new_monitor) auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); unity::panel::Style &panel_style = panel::Style::Instance(); int panel_height = panel_style.PanelHeight(new_monitor); - int launcher_height = unity::Settings::Instance().LauncherHeight(new_monitor); +// int launcher_height = unity::Settings::Instance().LauncherSize(new_monitor); + int launcher_height = icon_size_ + ICON_PADDING * 2 + RIGHT_LINE_WIDTH - 2; //Todo: Get wrong height , need investigate - std::cout << "Launcher.cpp 1348 launcherheight: " << launcher_height << ":"<< monitor_geo.y << ":" << monitor_geo.height << std::endl; - cv_ = unity::Settings::Instance().em(monitor); if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) @@ -1842,7 +1841,8 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) bool force_show_window; nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute, force_show_window); - bkg_box.width -= RIGHT_LINE_WIDTH.CP(cv_); + if (Settings::Instance().launcher_position == LauncherPosition::LEFT) + bkg_box.width -= RIGHT_LINE_WIDTH.CP(cv_); if (options()->hide_mode != LAUNCHER_HIDE_NEVER && bkg_box.x + bkg_box.width <= 0 && diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp index 52ccbb607..d3b9ce850 100644 --- a/panel/PanelView.cpp +++ b/panel/PanelView.cpp @@ -365,7 +365,8 @@ PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint); - refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_); GfxContext.QRP_1Tex(refine_x_pos, geo.y, bg_refine_tex_->GetWidth(), bg_refine_tex_->GetHeight(), @@ -462,7 +463,8 @@ PanelView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) nux::Geometry refine_geo = geo; int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint); - refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_); refine_geo.x = refine_x_pos; refine_geo.width = bg_refine_tex_->GetWidth(); diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 88fee50c2..dd861c5a2 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -78,6 +78,7 @@ #include "UScreen.h" #include "config.h" +#include "unity-shared/UnitySettings.h" /* FIXME: once we get a better method to add the toplevel windows to the accessible root object, this include would not be required */ @@ -3764,9 +3765,9 @@ bool UnityScreen::layoutSlotsAndAssignWindows() } auto max_bounds = NuxGeometryFromCompRect(output.workArea()); - if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) + if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER && Settings::Instance().launcher_position() == LauncherPosition::LEFT) { - int monitor_width = unity_settings_.LauncherWidth(monitor); + int monitor_width = unity_settings_.LauncherSize(monitor); max_bounds.x += monitor_width; max_bounds.width -= monitor_width; } @@ -4003,14 +4004,19 @@ void UnityScreen::initLauncher() * that must not be considered when drawing an overlay */ auto* launcher = static_cast<Launcher*>(area); - int launcher_width = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); - int launcher_height = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + int launcher_size = 0; + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + launcher_size = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + else + launcher_size = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); - unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor); - unity::Settings::Instance().SetLauncherHeight(launcher_height, launcher->monitor); - shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor)); + unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor); + if (Settings::Instance().launcher_position == LauncherPosition::LEFT) + shortcut_controller_->SetAdjustment(launcher_size, panel_style_.PanelHeight(launcher->monitor)); + else + shortcut_controller_->SetAdjustment(0, panel_style_.PanelHeight(launcher->monitor)); - CompOption::Value v(launcher_width); + CompOption::Value v(launcher_size); screen->setOptionForPlugin("expo", "x_offset", v); if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) diff --git a/unity-shared/SpreadFilter.cpp b/unity-shared/SpreadFilter.cpp index 14d8cb5ad..c5a915078 100644 --- a/unity-shared/SpreadFilter.cpp +++ b/unity-shared/SpreadFilter.cpp @@ -55,7 +55,7 @@ Filter::Filter() auto& settings = Settings::Instance(); auto const& work_area = wm.GetWorkAreaGeometry(0); int monitor = wm.MonitorGeometryIn(work_area); - int launcher_width = settings.LauncherWidth(monitor); + int launcher_width = settings.LauncherSize(monitor); auto const& cv = settings.em(monitor); search_bar_ = SearchBar::Ptr(new SearchBar()); @@ -81,7 +81,10 @@ Filter::Filter() view_window_->SetOpacity(0.0f); view_window_->SetEnterFocusInputArea(search_bar_.GetPointer()); view_window_->SetInputFocus(); - view_window_->SetXY(OFFSET_X.CP(cv) + std::max(work_area.x, launcher_width), OFFSET_Y.CP(cv) + work_area.y); + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + view_window_->SetXY(OFFSET_X.CP(cv) + std::max(work_area.x, launcher_width), OFFSET_Y.CP(cv) + work_area.y); + else + view_window_->SetXY(OFFSET_X.CP(cv) + work_area.x, OFFSET_Y.CP(cv) + work_area.y); fade_animator_.updated.connect([this] (double opacity) { view_window_->SetOpacity(opacity); }); nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry()); diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp index 28bbf0e37..12fff7625 100644 --- a/unity-shared/UnitySettings.cpp +++ b/unity-shared/UnitySettings.cpp @@ -63,8 +63,7 @@ const std::string GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor"; const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses"; const std::string REMOTE_CONTENT_KEY = "remote-content-search"; -const int DEFAULT_LAUNCHER_WIDTH = 64; -const int DEFAULT_LAUNCHER_HEIGHT = 64; +const int DEFAULT_LAUNCHER_SIZE = 64; const int MINIMUM_DESKTOP_HEIGHT = 800; const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1; const double DEFAULT_DPI = 96.0f; @@ -84,8 +83,7 @@ public: , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str())) , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str())) , remote_content_settings_(g_settings_new(REMOTE_CONTENT_SETTINGS.c_str())) - , launcher_widths_(monitors::MAX, DEFAULT_LAUNCHER_WIDTH) - , launcher_heights_(monitors::MAX, DEFAULT_LAUNCHER_HEIGHT) + , launcher_sizes_(monitors::MAX, DEFAULT_LAUNCHER_SIZE) , cached_launcher_position_(LauncherPosition::BOTTOM) , cached_form_factor_(FormFactor::DESKTOP) , cursor_scale_(1.0) @@ -116,6 +114,7 @@ public: signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + LAUNCHER_POSITION, [this] (GSettings*, const gchar*) { CacheLauncherPosition(); parent_->launcher_position.changed.emit(cached_launcher_position_); + std::cout << "Unitysettings position changed: " << static_cast<int>(Settings::Instance().launcher_position()) << std::endl; }); signals_.Add<void, GSettings*, const gchar*>(ubuntu_ui_settings_, "changed::" + SCALE_FACTOR, [this] (GSettings*, const gchar* t) { @@ -382,8 +381,7 @@ public: glib::Source::UniquePtr changing_gnome_settings_timeout_; glib::SignalManager signals_; std::vector<EMConverter::Ptr> em_converters_; - std::vector<int> launcher_widths_; - std::vector<int> launcher_heights_; + std::vector<int> launcher_sizes_; LauncherPosition cached_launcher_position_; FormFactor cached_form_factor_; double cursor_scale_; @@ -446,19 +444,19 @@ EMConverter::Ptr const& Settings::em(int monitor) const return pimpl->em(monitor); } -void Settings::SetLauncherWidth(int launcher_width, int monitor) +void Settings::SetLauncherSize(int launcher_size, int monitor) { if (monitor < 0 || monitor >= (int)monitors::MAX) { - LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating laucher width."; + LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating laucher size."; } else { - pimpl->launcher_widths_[monitor] = launcher_width; + pimpl->launcher_sizes_[monitor] = launcher_size; } } -int Settings::LauncherWidth(int monitor) const +int Settings::LauncherSize(int monitor) const { if (monitor < 0 || monitor >= (int)monitors::MAX) { @@ -466,30 +464,7 @@ int Settings::LauncherWidth(int monitor) const return 0; } - return pimpl->launcher_widths_[monitor]; -} - -void Settings::SetLauncherHeight(int launcher_height, int monitor) -{ - if (monitor < 0 || monitor >= (int)monitors::MAX) - { - LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating laucher width."; - } - else - { - pimpl->launcher_heights_[monitor] = launcher_height; - } -} - -int Settings::LauncherHeight(int monitor) const -{ - if (monitor < 0 || monitor >= (int)monitors::MAX) - { - LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Returning 0."; - return 0; - } - - return pimpl->launcher_heights_[monitor]; + return pimpl->launcher_sizes_[monitor]; } } // namespace unity diff --git a/unity-shared/UnitySettings.h b/unity-shared/UnitySettings.h index 701c8ff0b..1741d3bae 100644 --- a/unity-shared/UnitySettings.h +++ b/unity-shared/UnitySettings.h @@ -52,10 +52,8 @@ public: void SetLowGfxMode(const bool low_gfx); EMConverter::Ptr const& em(int monitor = 0) const; - void SetLauncherWidth(int launcher_width, int monitor); - int LauncherWidth(int monitor) const; - void SetLauncherHeight(int launcher_height, int monitor); - int LauncherHeight(int mointor) const; + void SetLauncherSize(int launcher_size, int monitor); + int LauncherSize(int mointor) const; nux::RWProperty<FormFactor> form_factor; nux::Property<bool> is_standalone; @@ -69,7 +67,6 @@ public: sigc::signal<void> dpi_changed; sigc::signal<void> low_gfx_changed; - sigc::signal<void> launcher_position_changed; private: class Impl; |
