diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-03-31 07:57:11 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-03-31 07:57:11 +0200 |
| commit | 3f9213dc3239e44ef2cf32d3ef959dcdd023522d (patch) | |
| tree | 8c0c59e7c138be5b1191b30771da18f7d848d13c | |
| parent | db418a2e5d5972b675c884df761d07863d5dcc3c (diff) | |
Launcher, Panel, TextInput: use cache texture_invalidated to reload textures
So we can remove we workaround in UnitySettings as the signal is always emitted after removing all the themed textures that we have. (bzr r4093.2.28)
| -rw-r--r-- | launcher/Launcher.cpp | 3 | ||||
| -rw-r--r-- | lockscreen/KylinUserPromptView.cpp | 1 | ||||
| -rw-r--r-- | panel/PanelView.cpp | 3 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 5 | ||||
| -rw-r--r-- | unity-shared/IconRenderer.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/TextInput.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/TextInput.h | 2 |
7 files changed, 7 insertions, 13 deletions
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp index 665ada1f1..5634ff552 100644 --- a/launcher/Launcher.cpp +++ b/launcher/Launcher.cpp @@ -35,7 +35,6 @@ #include "unity-shared/IconLoader.h" #include "unity-shared/PanelStyle.h" #include "unity-shared/TextureCache.h" -#include "unity-shared/ThemeSettings.h" #include "unity-shared/TimeUtil.h" #include "unity-shared/UScreen.h" #include "unity-shared/UBusMessages.h" @@ -186,7 +185,7 @@ Launcher::Launcher(MockableBaseWindow* parent, ubus_.RegisterInterest(UBUS_LAUNCHER_LOCK_HIDE, sigc::mem_fun(this, &Launcher::OnLockHideChanged)); LoadTextures(); - theme::Settings::Get()->theme.changed.connect(sigc::hide(sigc::mem_fun(this, &Launcher::LoadTextures))); + TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &Launcher::LoadTextures)); options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged)); diff --git a/lockscreen/KylinUserPromptView.cpp b/lockscreen/KylinUserPromptView.cpp index 81b2f025a..138287c3b 100644 --- a/lockscreen/KylinUserPromptView.cpp +++ b/lockscreen/KylinUserPromptView.cpp @@ -120,6 +120,7 @@ KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_ma UpdateSize(); ResetLayout(); + TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout)); user_authenticator_.AuthenticateStart(session_manager_->UserName(), sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb)); } diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp index eda5b99ce..632b45431 100644 --- a/panel/PanelView.cpp +++ b/panel/PanelView.cpp @@ -26,7 +26,6 @@ #include "unity-shared/PanelStyle.h" #include "unity-shared/RawPixel.h" #include "unity-shared/TextureCache.h" -#include "unity-shared/ThemeSettings.h" #include "unity-shared/WindowManager.h" #include "unity-shared/UBusMessages.h" #include "unity-shared/UnitySettings.h" @@ -129,7 +128,7 @@ PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus }); LoadTextures(); - theme::Settings::Get()->theme.changed.connect(sigc::hide(sigc::mem_fun(this, &PanelView::LoadTextures))); + TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &PanelView::LoadTextures)); } PanelView::~PanelView() diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 417269462..5070f37da 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -41,7 +41,6 @@ #include "PanelView.h" #include "PluginAdapter.h" #include "QuicklistManager.h" -#include "TextureCache.h" #include "ThemeSettings.h" #include "Timer.h" #include "XKeyboardUtil.h" @@ -4014,10 +4013,6 @@ void UnityScreen::InitUnityComponents() bghash_.reset(new BGHash()); LOG_INFO(logger) << "InitUnityComponents-BGHash " << timer.ElapsedSeconds() << "s"; - // Ugly hack to ensure that texture cache will connect promptly to theme changed signal - TextureCache::GetDefault(); - LOG_INFO(logger) << "InitUnityComponents-TextureCache " << timer.ElapsedSeconds() << "s"; - auto xdnd_collection_window = std::make_shared<XdndCollectionWindowImp>(); auto xdnd_start_stop_notifier = std::make_shared<XdndStartStopNotifierImp>(); auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window); diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp index a417ae792..446aa5925 100644 --- a/unity-shared/IconRenderer.cpp +++ b/unity-shared/IconRenderer.cpp @@ -251,7 +251,7 @@ struct IconRenderer::LocalTextures : parent_(parent) , textures_loaded_(false) { - connections_.Add(theme::Settings::Get()->theme.changed.connect([this] (std::string const&) { + connections_.Add(TextureCache::GetDefault().themed_invalidated.connect([this] { if (textures_loaded_) ReloadIconSizedTextures(parent_->icon_size, parent_->image_size); })); diff --git a/unity-shared/TextInput.cpp b/unity-shared/TextInput.cpp index e3bfd7b98..881691e0b 100644 --- a/unity-shared/TextInput.cpp +++ b/unity-shared/TextInput.cpp @@ -182,8 +182,8 @@ TextInput::TextInput(NUX_FILE_LINE_DECL) spinner_->scale = scale(); layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); + TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &TextInput::UpdateTextures)); theme::Settings::Get()->font.changed.connect(sigc::hide(sigc::mem_fun(this, &TextInput::UpdateFont))); - theme::Settings::Get()->theme.changed.connect(sigc::mem_fun(this, &TextInput::UpdateTheme)); sig_manager_.Add<void, GdkKeymap*>(gdk_keymap_get_default(), "state-changed", [this](GdkKeymap*) { CheckLocks(); }); input_string.SetGetterFunction(sigc::mem_fun(this, &TextInput::get_input_string)); @@ -239,7 +239,7 @@ void TextInput::UpdateScale(double scale) QueueDraw(); } -void TextInput::UpdateTheme(std::string const&) +void TextInput::UpdateTextures() { activator_->SetTexture(LoadActivatorIcon(activator_icon(), activator_icon_size().CP(scale))); QueueDraw(); diff --git a/unity-shared/TextInput.h b/unity-shared/TextInput.h index 654decc22..1df5f1862 100644 --- a/unity-shared/TextInput.h +++ b/unity-shared/TextInput.h @@ -83,7 +83,7 @@ private: void UpdateBackground(bool force); void UpdateScale(double); void UpdateSize(); - void UpdateTheme(std::string const&); + void UpdateTextures(); std::string GetName() const; void AddProperties(debug::IntrospectionData&); |
