Merge lp:~townsend/unity/low-gfx-mode-option into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3962
Proposed branch: lp:~townsend/unity/low-gfx-mode-option
Merge into: lp:unity
Diff against target: 151 lines (+45/-2)
7 files modified
panel/PanelView.cpp (+18/-0)
panel/PanelView.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+11/-1)
plugins/unityshell/unityshell.xml.in (+6/-0)
unity-shared/OverlayRenderer.cpp (+2/-0)
unity-shared/UnitySettings.cpp (+6/-1)
unity-shared/UnitySettings.h (+1/-0)
To merge this branch: bzr merge lp:~townsend/unity/low-gfx-mode-option
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+256957@code.launchpad.net

Commit message

Add option to enable and disable Unity low graphics mode on the fly in ccsm or via gsettings.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, see just minor comment

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'panel/PanelView.cpp'
--- panel/PanelView.cpp 2015-02-03 10:47:59 +0000
+++ panel/PanelView.cpp 2015-04-21 20:18:17 +0000
@@ -61,6 +61,7 @@
61 auto& wm = WindowManager::Default();61 auto& wm = WindowManager::Default();
62 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));62 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
63 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize));63 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize));
64 Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &PanelView::OnLowGfxChanged));
6465
65 wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));66 wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));
66 wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate));67 wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate));
@@ -249,6 +250,22 @@
249 EnableOverlayMode(false);250 EnableOverlayMode(false);
250}251}
251252
253void PanelView::OnLowGfxChanged()
254{
255 if (!Settings::Instance().GetLowGfxMode())
256 {
257 nux::ROPConfig rop;
258
259 rop.Blend = true;
260 rop.SrcBlend = GL_ZERO;
261 rop.DstBlend = GL_SRC_COLOR;
262 nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f);
263 bg_darken_layer_.reset(new nux::ColorLayer(darken_colour, false, rop));
264 }
265
266 ForceUpdateBackground();
267}
268
252void PanelView::AddPanelView(PanelIndicatorsView* child,269void PanelView::AddPanelView(PanelIndicatorsView* child,
253 unsigned int stretchFactor)270 unsigned int stretchFactor)
254{271{
@@ -537,6 +554,7 @@
537 is_dirty_ = true;554 is_dirty_ = true;
538 UpdateBackground();555 UpdateBackground();
539556
557 QueueRelayout();
540 QueueDraw();558 QueueDraw();
541}559}
542560
543561
=== modified file 'panel/PanelView.h'
--- panel/PanelView.h 2014-12-12 22:33:24 +0000
+++ panel/PanelView.h 2015-04-21 20:18:17 +0000
@@ -98,6 +98,7 @@
98 void OnOverlayHidden(GVariant *data);98 void OnOverlayHidden(GVariant *data);
99 void OnSpreadInitiate();99 void OnSpreadInitiate();
100 void OnSpreadTerminate();100 void OnSpreadTerminate();
101 void OnLowGfxChanged();
101 void EnableOverlayMode(bool);102 void EnableOverlayMode(bool);
102103
103 bool ActivateFirstSensitive();104 bool ActivateFirstSensitive();
104105
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2015-04-10 21:59:05 +0000
+++ plugins/unityshell/src/unityshell.cpp 2015-04-21 20:18:17 +0000
@@ -261,7 +261,8 @@
261 renderer.find("Mesa X11") != std::string::npos ||261 renderer.find("Mesa X11") != std::string::npos ||
262 renderer.find("LLVM") != std::string::npos ||262 renderer.find("LLVM") != std::string::npos ||
263 renderer.find("on softpipe") != std::string::npos ||263 renderer.find("on softpipe") != std::string::npos ||
264 (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1))264 (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) ||
265 optionGetLowGraphicsMode())
265 {266 {
266 unity_settings_.SetLowGfxMode(true);267 unity_settings_.SetLowGfxMode(true);
267 }268 }
@@ -337,6 +338,7 @@
337 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));338 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
338 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));339 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
339 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));340 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
341 optionSetLowGraphicsModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
340 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));342 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
341 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));343 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
342 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));344 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
@@ -3596,6 +3598,14 @@
3596 case UnityshellOptions::ShortcutOverlay:3598 case UnityshellOptions::ShortcutOverlay:
3597 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());3599 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());
3598 break;3600 break;
3601 case UnityshellOptions::LowGraphicsMode:
3602 if (optionGetLowGraphicsMode())
3603 BackgroundEffectHelper::blur_type = BLUR_NONE;
3604 else
3605 BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
3606
3607 unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode());
3608 break;
3599 case UnityshellOptions::DecayRate:3609 case UnityshellOptions::DecayRate:
3600 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;3610 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
3601 break;3611 break;
36023612
=== modified file 'plugins/unityshell/unityshell.xml.in'
--- plugins/unityshell/unityshell.xml.in 2015-02-04 08:20:43 +0000
+++ plugins/unityshell/unityshell.xml.in 2015-04-21 20:18:17 +0000
@@ -146,6 +146,12 @@
146 <_long>Enables possibility to display an overlay showing available mouse and keyboard shortcuts.</_long>146 <_long>Enables possibility to display an overlay showing available mouse and keyboard shortcuts.</_long>
147 <default>true</default>147 <default>true</default>
148 </option>148 </option>
149
150 <option name="low_graphics_mode" type="bool">
151 <_short>Enable Low Graphics Mode</_short>
152 <_long>Enables low graphics mode regardless of hardware in the system</_long>
153 <default>false</default>
154 </option>
149 </group>155 </group>
150156
151 <group>157 <group>
152158
=== modified file 'unity-shared/OverlayRenderer.cpp'
--- unity-shared/OverlayRenderer.cpp 2014-07-10 20:32:06 +0000
+++ unity-shared/OverlayRenderer.cpp 2015-04-21 20:18:17 +0000
@@ -116,6 +116,8 @@
116{116{
117 parent->scale = Settings::Instance().em()->DPIScale();117 parent->scale = Settings::Instance().em()->DPIScale();
118 parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));118 parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));
119 Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures));
120
119 UpdateTextures();121 UpdateTextures();
120 LoadScaledTextures();122 LoadScaledTextures();
121}123}
122124
=== modified file 'unity-shared/UnitySettings.cpp'
--- unity-shared/UnitySettings.cpp 2015-02-19 19:33:36 +0000
+++ unity-shared/UnitySettings.cpp 2015-04-21 20:18:17 +0000
@@ -373,7 +373,12 @@
373373
374void Settings::SetLowGfxMode(const bool low_gfx)374void Settings::SetLowGfxMode(const bool low_gfx)
375{375{
376 pimpl->lowGfx_ = low_gfx;376 if (pimpl->lowGfx_ != low_gfx)
377 {
378 pimpl->lowGfx_ = low_gfx;
379
380 low_gfx_changed.emit();
381 }
377}382}
378383
379EMConverter::Ptr const& Settings::em(int monitor) const384EMConverter::Ptr const& Settings::em(int monitor) const
380385
=== modified file 'unity-shared/UnitySettings.h'
--- unity-shared/UnitySettings.h 2015-02-03 12:31:32 +0000
+++ unity-shared/UnitySettings.h 2015-04-21 20:18:17 +0000
@@ -58,6 +58,7 @@
58 nux::Property<double> font_scaling;58 nux::Property<double> font_scaling;
5959
60 sigc::signal<void> dpi_changed;60 sigc::signal<void> dpi_changed;
61 sigc::signal<void> low_gfx_changed;
6162
62private:63private:
63 class Impl;64 class Impl;