diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-03-31 05:59:33 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-03-31 05:59:33 +0200 |
| commit | e38d767ec0f43e20457b7622fd5f37f4434fc68d (patch) | |
| tree | fcab77d2ab3ba631f0905f9a9a8f78bfb22a0dd9 /plugins/unityshell | |
| parent | 8a6d2880444c3e5e3e65394c208e2ab1c706e806 (diff) | |
UnityScreen: Load the panel shadow from theme and properly scale it
(bzr r4093.2.20)
Diffstat (limited to 'plugins/unityshell')
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 23 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 1 |
2 files changed, 16 insertions, 8 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index de308d819..417269462 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -42,6 +42,7 @@ #include "PluginAdapter.h" #include "QuicklistManager.h" #include "TextureCache.h" +#include "ThemeSettings.h" #include "Timer.h" #include "XKeyboardUtil.h" #include "unityshell.h" @@ -447,10 +448,8 @@ UnityScreen::UnityScreen(CompScreen* screen) InitGesturesSupport(); - CompString name(PKGDATADIR"/panel-shadow.png"); - CompString pname("unityshell"); - CompSize size(1, 20); - _shadow_texture = GLTexture::readImageToTexture(name, pname, size); + LoadPanelShadowTexture(); + theme::Settings::Get()->theme.changed.connect(sigc::hide(sigc::mem_fun(this, &UnityScreen::LoadPanelShadowTexture))); ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [this](GVariant * data) { @@ -708,6 +707,14 @@ void UnityScreen::nuxEpilogue() glDisable(GL_SCISSOR_TEST); } +void UnityScreen::LoadPanelShadowTexture() +{ + CompString name(theme::Settings::Get()->ThemedFilePath("panel_shadow", {PKGDATADIR})); + CompString pname; + CompSize size; + _shadow_texture = GLTexture::readImageToTexture(name, pname, size); +} + void UnityScreen::setPanelShadowMatrix(GLMatrix const& matrix) { panel_shadow_matrix_ = matrix; @@ -715,15 +722,15 @@ void UnityScreen::setPanelShadowMatrix(GLMatrix const& matrix) void UnityScreen::FillShadowRectForOutput(CompRect& shadowRect, CompOutput const& output) { - if (_shadow_texture.empty ()) + if (_shadow_texture.empty()) return; - int monitor = PluginAdapter::Default().MonitorGeometryIn(NuxGeometryFromCompRect(output)); - float panel_h = static_cast<float>(panel_style_.PanelHeight(monitor)); + int monitor = WM.MonitorGeometryIn(NuxGeometryFromCompRect(output)); + float panel_h = panel_style_.PanelHeight(monitor); float shadowX = output.x(); float shadowY = output.y() + panel_h; float shadowWidth = output.width(); - float shadowHeight = _shadow_texture[0]->height(); + float shadowHeight = _shadow_texture[0]->height() * unity_settings_.em(monitor)->DPIScale(); shadowRect.setGeometry(shadowX, shadowY, shadowWidth, shadowHeight); } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 7235ac118..cc714b37d 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -292,6 +292,7 @@ private: void OnInitiateSpread(); void OnTerminateSpread(); + void LoadPanelShadowTexture(); void DamagePanelShadow(); void OnViewHidden(nux::BaseWindow *bw); |
