diff options
| author | Rudra Saraswat <rs2009@ubuntu.com> | 2023-02-13 20:12:27 +0530 |
|---|---|---|
| committer | Rudra Saraswat <rs2009@ubuntu.com> | 2023-02-13 20:17:38 +0530 |
| commit | 539ff3fb821427e2a037599c3320fe4519750d52 (patch) | |
| tree | e8d56332a570047ac91ac065b691db7e2981a7b2 /unity-shared | |
| parent | cd0e7d8f64a348def9f05853921f76737157db78 (diff) | |
Make Unity 7.7 changes
* Increased panel size to 30 from 24 * Moved scope bar to top of dash * Added UWidgets, based on Blighty * Reduced default launcher icon size to 44 * Made dash vertical (temporarily removed previews) * Added indicator-notifications to Recommends
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/BackgroundEffectHelper.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/CMakeLists.txt | 2 | ||||
| -rwxr-xr-x | unity-shared/DashStyle.cpp | 56 | ||||
| -rwxr-xr-x | unity-shared/DashStyle.h | 2 | ||||
| -rw-r--r-- | unity-shared/FileManager.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/FileManager.h | 2 | ||||
| -rw-r--r-- | unity-shared/GnomeFileManager.h | 2 | ||||
| -rw-r--r-- | unity-shared/NemoFileManager.cpp | 66 | ||||
| -rw-r--r-- | unity-shared/NemoFileManager.h | 2 | ||||
| -rw-r--r-- | unity-shared/OverlayRenderer.cpp | 52 | ||||
| -rw-r--r-- | unity-shared/OverlayWindowButtons.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/PanelStyle.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/SearchBar.cpp | 66 | ||||
| -rw-r--r-- | unity-shared/SearchBar.h | 1 |
14 files changed, 99 insertions, 162 deletions
diff --git a/unity-shared/BackgroundEffectHelper.cpp b/unity-shared/BackgroundEffectHelper.cpp index 507c3eacc..274f184c2 100644 --- a/unity-shared/BackgroundEffectHelper.cpp +++ b/unity-shared/BackgroundEffectHelper.cpp @@ -27,7 +27,7 @@ namespace DECLARE_LOGGER(logger, "unity.background_effect_helper"); const int BLUR_RADIUS = 3; -const float sigma_high = 5.0f; +const float sigma_high = 10.0f; const float sigma_med = 3.0f; const float sigma_low = 1.0f; } diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt index eddc80766..673c7ddb3 100644 --- a/unity-shared/CMakeLists.txt +++ b/unity-shared/CMakeLists.txt @@ -30,9 +30,9 @@ set (UNITY_SHARED_SOURCES DesktopApplicationManager.cpp EMConverter.cpp ExpanderView.cpp - FileManager.cpp GnomeFileManager.cpp FontSettings.cpp + FileManager.cpp GraphicsUtils.cpp IMTextEntry.cpp IconLoader.cpp diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp index 66ed48c5b..b0c3eac45 100755 --- a/unity-shared/DashStyle.cpp +++ b/unity-shared/DashStyle.cpp @@ -374,35 +374,8 @@ Style::Impl::~Impl() void Style::Impl::Refresh() { - const char* const SAMPLE_MAX_TEXT = "Chromium Web Browser"; - - nux::CairoGraphics util_cg(CAIRO_FORMAT_ARGB32, 1, 1); - cairo_t* cr = util_cg.GetInternalContext(); - - auto const& font = theme::Settings::Get()->font(); - PangoFontDescription* desc = ::pango_font_description_from_string(font.c_str()); - ::pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL); - ::pango_font_description_set_size(desc, 9 * PANGO_SCALE); - - glib::Object<PangoLayout> layout(::pango_cairo_create_layout(cr)); - ::pango_layout_set_font_description(layout, desc); - ::pango_layout_set_text(layout, SAMPLE_MAX_TEXT, -1); - - PangoContext* cxt = ::pango_layout_get_context(layout); - - GdkScreen* screen = ::gdk_screen_get_default(); - ::pango_cairo_context_set_font_options(cxt, ::gdk_screen_get_font_options(screen)); - ::pango_cairo_context_set_resolution(cxt, 96.0 * Settings::Instance().font_scaling()); - ::pango_layout_context_changed(layout); - - PangoRectangle log_rect; - ::pango_layout_get_pixel_extents(layout, NULL, &log_rect); - text_width_ = log_rect.width; - text_height_ = log_rect.height; - - owner_->changed.emit(); - - pango_font_description_free(desc); + text_width_ = 56; + text_height_ = 12; } void Style::Impl::UpdateFormFactor(FormFactor form_factor) @@ -2186,6 +2159,11 @@ BaseTexturePtr Style::GetDashRightCornerMask(double scale) const return pimpl->LoadScaledTexture("dash_top_right_corner_mask", scale); } +BaseTexturePtr Style::GetEmpty(double scale) const +{ + return pimpl->LoadScaledTexture("empty", scale); +} + BaseTexturePtr Style::GetSearchMagnifyIcon(double scale) const { return pimpl->LoadScaledTexture("search_magnify", scale); @@ -2236,33 +2214,33 @@ nux::Color const& Style::GetTextColor() const RawPixel Style::GetTileGIconSize() const { - return 64; + return 48; } RawPixel Style::GetTileImageSize() const { - return 96; + return 48; } RawPixel Style::GetTileWidth() const { - return std::max(pimpl->text_width_, 150); + return std::max(pimpl->text_width_, 106); } RawPixel Style::GetTileHeight() const { return std::max(GetTileImageSize() + (pimpl->text_height_ * 2) + 15, - GetTileImageSize() + 32); // magic design numbers. + GetTileImageSize() + 80); // magic design numbers. } RawPixel Style::GetTileIconHightlightHeight() const { - return 106; + return 48; } RawPixel Style::GetTileIconHightlightWidth() const { - return 106; + return 48; } RawPixel Style::GetHomeTileIconSize() const @@ -2363,7 +2341,7 @@ RawPixel Style::GetHSeparatorSize() const RawPixel Style::GetFilterBarWidth() const { - return 300; + return 250; } RawPixel Style::GetFilterBarLeftPadding() const @@ -2418,7 +2396,7 @@ RawPixel Style::GetFilterHighlightPadding() const RawPixel Style::GetSpaceBetweenFilterWidgets() const { - return 12; + return 6; } RawPixel Style::GetAllButtonHeight() const @@ -2498,12 +2476,12 @@ RawPixel Style::GetPlacesGroupTopSpace() const RawPixel Style::GetPlacesGroupResultTopPadding() const { - return 2; + return 19; } RawPixel Style::GetPlacesGroupResultLeftPadding() const { - return 25; + return 19; } RawPixel Style::GetCategoryHeaderLeftPadding() const diff --git a/unity-shared/DashStyle.h b/unity-shared/DashStyle.h index f080297a9..dd127c421 100755 --- a/unity-shared/DashStyle.h +++ b/unity-shared/DashStyle.h @@ -178,6 +178,8 @@ public: BaseTexturePtr GetDashLeftTile(double scale) const; BaseTexturePtr GetDashTopTile(double scale) const; + BaseTexturePtr GetEmpty(double scale) const; + BaseTexturePtr GetDashCorner(double scale) const; BaseTexturePtr GetDashCornerMask(double scale) const; BaseTexturePtr GetDashLeftCorner(double scale) const; diff --git a/unity-shared/FileManager.cpp b/unity-shared/FileManager.cpp index c48a466bb..6fc574e01 100644 --- a/unity-shared/FileManager.cpp +++ b/unity-shared/FileManager.cpp @@ -24,7 +24,7 @@ #include "GnomeFileManager.h" #include "NemoFileManager.h" -#include <gio/gdesktopappinfo.h> +#include <gio/gio.h> namespace unity { diff --git a/unity-shared/FileManager.h b/unity-shared/FileManager.h index bb636d411..6b802c677 100644 --- a/unity-shared/FileManager.h +++ b/unity-shared/FileManager.h @@ -61,4 +61,4 @@ private: } // namespace unity -#endif +#endif \ No newline at end of file diff --git a/unity-shared/GnomeFileManager.h b/unity-shared/GnomeFileManager.h index b9c3dd80f..6fa53a69e 100644 --- a/unity-shared/GnomeFileManager.h +++ b/unity-shared/GnomeFileManager.h @@ -51,4 +51,4 @@ private: } -#endif +#endif \ No newline at end of file diff --git a/unity-shared/NemoFileManager.cpp b/unity-shared/NemoFileManager.cpp index 81432cf42..e8889e6a0 100644 --- a/unity-shared/NemoFileManager.cpp +++ b/unity-shared/NemoFileManager.cpp @@ -19,12 +19,12 @@ #include "NemoFileManager.h" #include <NuxCore/Logger.h> - +#include <UnityCore/DesktopUtilities.h> #include <UnityCore/GLibDBusProxy.h> #include <UnityCore/GLibWrapper.h> -#include <gio/gdesktopappinfo.h> #include <gdk/gdk.h> #include <gio/gio.h> +#include <gio/gdesktopappinfo.h> namespace unity { @@ -38,30 +38,48 @@ const std::string FILE_SCHEMA = "file://"; const std::string NEMO_DESKTOP_ID = "nemo.desktop"; const std::string NEMO_NAME = "org.Nemo"; -const std::string NEMO_PATH = "/org/Nemo"; +const std::string NEMO_FILE_OPS_PATH = "/org/Nemo"; } struct NemoFileManager::Impl { Impl(NemoFileManager* parent) : parent_(parent) - , app_info_(g_desktop_app_info_new(NEMO_DESKTOP_ID.c_str())) { } glib::DBusProxy::Ptr NemoOperationsProxy() const { auto flags = static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES|G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS); - return std::make_shared<glib::DBusProxy>(NEMO_NAME, NEMO_PATH, + return std::make_shared<glib::DBusProxy>(NEMO_NAME, NEMO_FILE_OPS_PATH, "org.Nemo.FileOperations", G_BUS_TYPE_SESSION, flags); } - void Activate(uint64_t timestamp) - { - if (!app_info_) - return; + NemoFileManager* parent_; +}; + + +FileManager::Ptr NemoFileManager::Get() +{ + static FileManager::Ptr instance(new NemoFileManager()); + return instance; +} + +NemoFileManager::NemoFileManager() + : impl_(new Impl(this)) +{} + +NemoFileManager::~NemoFileManager() +{} +void Activate(uint64_t timestamp) +{ + glib::Cancellable cancellable; + glib::Object<GAppInfo> app_info(G_APP_INFO (g_desktop_app_info_new(NEMO_DESKTOP_ID.c_str()))); + + if (app_info) + { GdkDisplay* display = gdk_display_get_default(); glib::Object<GdkAppLaunchContext> context(gdk_display_get_app_launch_context(display)); @@ -69,11 +87,10 @@ struct NemoFileManager::Impl gdk_app_launch_context_set_timestamp(context, timestamp); auto const& gcontext = glib::object_cast<GAppLaunchContext>(context); - auto proxy = std::make_shared<glib::DBusProxy>(NEMO_NAME, NEMO_PATH, - "org.freedesktop.Application"); + auto proxy = std::make_shared<glib::DBusProxy>(NEMO_NAME, NEMO_FILE_OPS_PATH, + "org.freedesktop.Application"); - glib::String context_string(g_app_launch_context_get_startup_notify_id( - gcontext, glib::object_cast<GAppInfo>(app_info_), nullptr)); + glib::String context_string(g_app_launch_context_get_startup_notify_id(gcontext, app_info, nullptr)); if (context_string && g_utf8_validate(context_string, -1, nullptr)) { @@ -86,25 +103,8 @@ struct NemoFileManager::Impl proxy->CallBegin("Activate", param, [proxy] (GVariant*, glib::Error const&) {}); } } - - glib::Object<GDesktopAppInfo> app_info_; - NemoFileManager* parent_; -}; - - -FileManager::Ptr NemoFileManager::Get() -{ - static FileManager::Ptr instance(new NemoFileManager()); - return instance; } -NemoFileManager::NemoFileManager() - : impl_(new Impl(this)) -{} - -NemoFileManager::~NemoFileManager() -{} - void NemoFileManager::Open(std::string const& uri, uint64_t timestamp) { if (uri.empty()) @@ -152,7 +152,7 @@ void NemoFileManager::EmptyTrash(uint64_t timestamp, Window parent_xid) auto const& proxy = impl_->NemoOperationsProxy(); // Passing the proxy to the lambda we ensure that it will be destroyed when needed - impl_->Activate(timestamp); + Activate(timestamp); proxy->CallBegin("EmptyTrash", nullptr, [proxy] (GVariant*, glib::Error const&) {}); } @@ -184,7 +184,7 @@ void NemoFileManager::CopyFiles(std::set<std::string> const& uris, std::string c // Passing the proxy to the lambda we ensure that it will be destroyed when needed auto const& proxy = impl_->NemoOperationsProxy(); proxy->CallBegin("CopyURIs", parameters, [proxy] (GVariant*, glib::Error const&) {}); - impl_->Activate(timestamp); + Activate(timestamp); } } @@ -199,4 +199,4 @@ std::string NemoFileManager::LocationForWindow(ApplicationWindowPtr const& win) return std::string(); } -} // namespace unity +} // namespace unity \ No newline at end of file diff --git a/unity-shared/NemoFileManager.h b/unity-shared/NemoFileManager.h index aaa4e91d9..94321a93f 100644 --- a/unity-shared/NemoFileManager.h +++ b/unity-shared/NemoFileManager.h @@ -47,4 +47,4 @@ private: std::unique_ptr<Impl> impl_; }; -} // namespace unity +} diff --git a/unity-shared/OverlayRenderer.cpp b/unity-shared/OverlayRenderer.cpp index 475ad5e9c..e35a3e8e0 100644 --- a/unity-shared/OverlayRenderer.cpp +++ b/unity-shared/OverlayRenderer.cpp @@ -99,6 +99,8 @@ public: nux::ObjectPtr<nux::BaseTexture> right_corner_; nux::ObjectPtr<nux::BaseTexture> right_corner_mask_; + OverlayPosition dash_position = OverlayPosition::LEFT; + // temporary variable that stores the number of backgrounds we have rendered int bgs; bool visible; @@ -140,20 +142,37 @@ void OverlayRendererImpl::LoadScaledTextures() double scale = parent->scale; auto& style = dash::Style::Instance(); - horizontal_texture_ = style.GetDashHorizontalTile(scale); - horizontal_texture_mask_ = style.GetDashHorizontalTileMask(scale); - right_texture_ = style.GetDashRightTile(scale); - right_texture_mask_ = style.GetDashRightTileMask(scale); - top_left_texture_ = style.GetDashTopLeftTile(scale); - left_texture_ = style.GetDashLeftTile(scale); - top_texture_ = style.GetDashTopTile(scale); - - corner_ = style.GetDashCorner(scale); - corner_mask_ = style.GetDashCornerMask(scale); - left_corner_ = style.GetDashLeftCorner(scale); - left_corner_mask_ = style.GetDashLeftCornerMask(scale); - right_corner_ = style.GetDashRightCorner(scale); - right_corner_mask_ = style.GetDashRightCornerMask(scale); + if (parent->owner_type == OverlayOwner::Hud) { + horizontal_texture_ = style.GetDashHorizontalTile(scale); + horizontal_texture_mask_ = style.GetDashHorizontalTileMask(scale); + right_texture_ = style.GetDashRightTile(scale); + right_texture_mask_ = style.GetDashRightTileMask(scale); + top_left_texture_ = style.GetDashTopLeftTile(scale); + left_texture_ = style.GetDashLeftTile(scale); + top_texture_ = style.GetDashTopTile(scale); + + corner_ = style.GetDashCorner(scale); + corner_mask_ = style.GetDashCornerMask(scale); + left_corner_ = style.GetDashLeftCorner(scale); + left_corner_mask_ = style.GetDashLeftCornerMask(scale); + right_corner_ = style.GetDashRightCorner(scale); + right_corner_mask_ = style.GetDashRightCornerMask(scale); + } else { + horizontal_texture_ = style.GetEmpty(scale); + horizontal_texture_mask_ = style.GetEmpty(scale); + right_texture_ = style.GetEmpty(scale); + right_texture_mask_ = style.GetEmpty(scale); + top_left_texture_ = style.GetEmpty(scale); + left_texture_ = style.GetEmpty(scale); + top_texture_ = style.GetEmpty(scale); + + corner_ = style.GetEmpty(scale); + corner_mask_ = style.GetEmpty(scale); + left_corner_ = style.GetEmpty(scale); + left_corner_mask_ = style.GetEmpty(scale); + right_corner_ = style.GetEmpty(scale); + right_corner_mask_ = style.GetEmpty(scale); + } } void OverlayRendererImpl::OnBgColorChanged(nux::Color const& new_color) @@ -186,7 +205,7 @@ void OverlayRendererImpl::UpdateTextures() rop.Blend = true; rop.SrcBlend = GL_ZERO; rop.DstBlend = GL_SRC_COLOR; - nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); + nux::Color darken_colour = nux::Color(1.0f, 1.0f, 1.0f, 1.0f); //When we are in low gfx mode then our darken layer will act as a background. if (Settings::Instance().low_gfx()) @@ -198,7 +217,7 @@ void OverlayRendererImpl::UpdateTextures() } bg_darken_layer_ = std::make_shared<nux::ColorLayer>(darken_colour, false, rop); - bg_shine_texture_ = dash::Style::Instance().GetDashShine()->GetDeviceTexture(); + // bg_shine_texture_ = dash::Style::Instance().GetDashShine()->GetDeviceTexture(); auto const& bg_refine_tex = dash::Style::Instance().GetRefineTextureDash(); @@ -619,7 +638,6 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c int launcher_size = Settings::Instance().LauncherSize(monitor); int panel_height = panel::Style::Instance().PanelHeight(monitor); - auto dash_position = OverlayPosition::LEFT; int border_y = content_geo.y; int border_height = larger_absolute_geo.height; if (parent->owner_type() == OverlayOwner::Dash && settings.launcher_position() == LauncherPosition::BOTTOM) diff --git a/unity-shared/OverlayWindowButtons.cpp b/unity-shared/OverlayWindowButtons.cpp index c373ad191..6b17182ee 100644 --- a/unity-shared/OverlayWindowButtons.cpp +++ b/unity-shared/OverlayWindowButtons.cpp @@ -23,7 +23,7 @@ namespace { - const int MAIN_LEFT_PADDING = 4; + const int MAIN_LEFT_PADDING = 6; const int MENUBAR_PADDING = 4; } diff --git a/unity-shared/PanelStyle.cpp b/unity-shared/PanelStyle.cpp index e2fb22d2e..92d675164 100644 --- a/unity-shared/PanelStyle.cpp +++ b/unity-shared/PanelStyle.cpp @@ -41,8 +41,8 @@ Style* style_instance = nullptr; DECLARE_LOGGER(logger, "unity.panel.style"); const int BUTTONS_SIZE = 16; -const int BUTTONS_PADDING = 1; -const int BASE_PANEL_HEIGHT = 24; +const int BUTTONS_PADDING = 9; +const int BASE_PANEL_HEIGHT = 30; const std::string PANEL_STYLE_CSS_NAME = "UnityPanelWidget"; inline std::string button_id(std::string const& prefix, double scale, WindowButtonType type, WindowState ws) diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp index 9c3741f86..8e90c58a5 100644 --- a/unity-shared/SearchBar.cpp +++ b/unity-shared/SearchBar.cpp @@ -74,11 +74,11 @@ const RawPixel FILTER_HORIZONTAL_MARGIN = 8_em; // Fonts const std::string HINT_LABEL_FONT_SIZE = "15"; // == 20px -const std::string HINT_LABEL_FONT_STYLE = "Italic"; +const std::string HINT_LABEL_FONT_STYLE = "Light"; const std::string HINT_LABEL_DEFAULT_FONT = "Ubuntu " + HINT_LABEL_FONT_STYLE + " " + HINT_LABEL_FONT_SIZE; -const std::string PANGO_ENTRY_DEFAULT_FONT_FAMILY = "Ubuntu"; -const RawPixel PANGO_ENTRY_FONT_SIZE = 22_em; +const std::string PANGO_ENTRY_DEFAULT_FONT_FAMILY = "Ubuntu Light"; +const RawPixel PANGO_ENTRY_FONT_SIZE = 15_em; const std::string SHOW_FILTERS_LABEL_FONT_SIZE = "13"; const std::string SHOW_FILTERS_LABEL_FONT_STYLE = ""; @@ -403,8 +403,6 @@ void SearchBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) { nux::Geometry const& base = GetGeometry(); - UpdateBackground(false); - graphics_engine.PushClippingRectangle(base); if (RedirectedAncestor()) @@ -513,64 +511,6 @@ void SearchBar::SetSearchFinished() spinner_->SetState(is_empty ? STATE_READY : STATE_CLEAR); } -void SearchBar::UpdateBackground(bool force) -{ - nux::Geometry geo(GetGeometry()); - geo.width = layered_layout_->GetAbsoluteX() + - layered_layout_->GetAbsoluteWidth() - - GetAbsoluteX() + - SEARCH_ENTRY_RIGHT_BORDER.CP(scale()); - - LOG_TRACE(logger) << "height: " - << geo.height << " - " - << layered_layout_->GetGeometry().height << " - " - << pango_entry_->GetGeometry().height; - - if (!bg_layer_ && - geo.width == last_width_ - && geo.height == last_height_ - && force == false) - return; - - last_width_ = geo.width; - last_height_ = geo.height; - - nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, last_width_, last_height_); - cairo_t* cr = cairo_graphics.GetInternalContext(); - cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale); - - cairo_graphics.DrawRoundedRectangle(cr, - 1.0f, - 0.5, 0.5, - CORNER_RADIUS, - (last_width_/scale) - 1, (last_height_/scale) - 1, - false); - - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); - cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f); - cairo_fill_preserve(cr); - cairo_set_line_width(cr, 1); - cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f); - cairo_stroke(cr); - - auto texture2D = texture_ptr_from_cairo_graphics(cairo_graphics); - - nux::TexCoordXForm texxform; - texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); - texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); - - nux::ROPConfig rop; - rop.Blend = true; - rop.SrcBlend = GL_ONE; - rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; - - bg_layer_.reset(new nux::TextureLayer(texture2D->GetDeviceTexture(), - texxform, - nux::color::White, - true, - rop)); -} - void SearchBar::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) { hint_->SetVisible(false); diff --git a/unity-shared/SearchBar.h b/unity-shared/SearchBar.h index c9af1db11..fa2833272 100644 --- a/unity-shared/SearchBar.h +++ b/unity-shared/SearchBar.h @@ -82,7 +82,6 @@ private: void OnMouseButtonDown(int x, int y, unsigned long button_flags, unsigned long key_flags); void OnEndKeyFocus(); - void UpdateBackground(bool force); void OnSearchChanged(nux::TextEntry* text_entry); void OnClearClicked(int x, int y, unsigned long button_flags, unsigned long key_flags); void OnEntryActivated(); |
