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
1=== modified file 'panel/PanelView.cpp'
2--- panel/PanelView.cpp 2015-02-03 10:47:59 +0000
3+++ panel/PanelView.cpp 2015-04-21 20:18:17 +0000
4@@ -61,6 +61,7 @@
5 auto& wm = WindowManager::Default();
6 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
7 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize));
8+ Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &PanelView::OnLowGfxChanged));
9
10 wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));
11 wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate));
12@@ -249,6 +250,22 @@
13 EnableOverlayMode(false);
14 }
15
16+void PanelView::OnLowGfxChanged()
17+{
18+ if (!Settings::Instance().GetLowGfxMode())
19+ {
20+ nux::ROPConfig rop;
21+
22+ rop.Blend = true;
23+ rop.SrcBlend = GL_ZERO;
24+ rop.DstBlend = GL_SRC_COLOR;
25+ nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f);
26+ bg_darken_layer_.reset(new nux::ColorLayer(darken_colour, false, rop));
27+ }
28+
29+ ForceUpdateBackground();
30+}
31+
32 void PanelView::AddPanelView(PanelIndicatorsView* child,
33 unsigned int stretchFactor)
34 {
35@@ -537,6 +554,7 @@
36 is_dirty_ = true;
37 UpdateBackground();
38
39+ QueueRelayout();
40 QueueDraw();
41 }
42
43
44=== modified file 'panel/PanelView.h'
45--- panel/PanelView.h 2014-12-12 22:33:24 +0000
46+++ panel/PanelView.h 2015-04-21 20:18:17 +0000
47@@ -98,6 +98,7 @@
48 void OnOverlayHidden(GVariant *data);
49 void OnSpreadInitiate();
50 void OnSpreadTerminate();
51+ void OnLowGfxChanged();
52 void EnableOverlayMode(bool);
53
54 bool ActivateFirstSensitive();
55
56=== modified file 'plugins/unityshell/src/unityshell.cpp'
57--- plugins/unityshell/src/unityshell.cpp 2015-04-10 21:59:05 +0000
58+++ plugins/unityshell/src/unityshell.cpp 2015-04-21 20:18:17 +0000
59@@ -261,7 +261,8 @@
60 renderer.find("Mesa X11") != std::string::npos ||
61 renderer.find("LLVM") != std::string::npos ||
62 renderer.find("on softpipe") != std::string::npos ||
63- (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1))
64+ (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) ||
65+ optionGetLowGraphicsMode())
66 {
67 unity_settings_.SetLowGfxMode(true);
68 }
69@@ -337,6 +338,7 @@
70 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
71 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
72 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
73+ optionSetLowGraphicsModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
74 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
75 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
76 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
77@@ -3596,6 +3598,14 @@
78 case UnityshellOptions::ShortcutOverlay:
79 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());
80 break;
81+ case UnityshellOptions::LowGraphicsMode:
82+ if (optionGetLowGraphicsMode())
83+ BackgroundEffectHelper::blur_type = BLUR_NONE;
84+ else
85+ BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
86+
87+ unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode());
88+ break;
89 case UnityshellOptions::DecayRate:
90 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
91 break;
92
93=== modified file 'plugins/unityshell/unityshell.xml.in'
94--- plugins/unityshell/unityshell.xml.in 2015-02-04 08:20:43 +0000
95+++ plugins/unityshell/unityshell.xml.in 2015-04-21 20:18:17 +0000
96@@ -146,6 +146,12 @@
97 <_long>Enables possibility to display an overlay showing available mouse and keyboard shortcuts.</_long>
98 <default>true</default>
99 </option>
100+
101+ <option name="low_graphics_mode" type="bool">
102+ <_short>Enable Low Graphics Mode</_short>
103+ <_long>Enables low graphics mode regardless of hardware in the system</_long>
104+ <default>false</default>
105+ </option>
106 </group>
107
108 <group>
109
110=== modified file 'unity-shared/OverlayRenderer.cpp'
111--- unity-shared/OverlayRenderer.cpp 2014-07-10 20:32:06 +0000
112+++ unity-shared/OverlayRenderer.cpp 2015-04-21 20:18:17 +0000
113@@ -116,6 +116,8 @@
114 {
115 parent->scale = Settings::Instance().em()->DPIScale();
116 parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)));
117+ Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures));
118+
119 UpdateTextures();
120 LoadScaledTextures();
121 }
122
123=== modified file 'unity-shared/UnitySettings.cpp'
124--- unity-shared/UnitySettings.cpp 2015-02-19 19:33:36 +0000
125+++ unity-shared/UnitySettings.cpp 2015-04-21 20:18:17 +0000
126@@ -373,7 +373,12 @@
127
128 void Settings::SetLowGfxMode(const bool low_gfx)
129 {
130- pimpl->lowGfx_ = low_gfx;
131+ if (pimpl->lowGfx_ != low_gfx)
132+ {
133+ pimpl->lowGfx_ = low_gfx;
134+
135+ low_gfx_changed.emit();
136+ }
137 }
138
139 EMConverter::Ptr const& Settings::em(int monitor) const
140
141=== modified file 'unity-shared/UnitySettings.h'
142--- unity-shared/UnitySettings.h 2015-02-03 12:31:32 +0000
143+++ unity-shared/UnitySettings.h 2015-04-21 20:18:17 +0000
144@@ -58,6 +58,7 @@
145 nux::Property<double> font_scaling;
146
147 sigc::signal<void> dpi_changed;
148+ sigc::signal<void> low_gfx_changed;
149
150 private:
151 class Impl;