Merge lp:~hikiko/unity/unity.lowgfx-2017 into lp:unity

Proposed by Eleni Maria Stea
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4232
Proposed branch: lp:~hikiko/unity/unity.lowgfx-2017
Merge into: lp:unity
Diff against target: 276 lines (+60/-33)
9 files modified
data/com.canonical.Unity.gschema.xml (+5/-0)
decorations/DecorationsWindowButton.cpp (+2/-1)
plugins/unityshell/src/unityshell.cpp (+12/-16)
plugins/unityshell/unityshell.xml.in (+0/-6)
tools/compiz-profile-selector.in (+16/-1)
tools/unity.cmake (+6/-0)
unity-shared/BackgroundEffectHelper.cpp (+0/-4)
unity-shared/UnitySettings.cpp (+19/-4)
unity-shared/UnitySettings.h (+0/-1)
To merge this branch: bzr merge lp:~hikiko/unity/unity.lowgfx-2017
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+314695@code.launchpad.net

Commit message

removes lowgfx option from ccsm, reads the "lowgfx" gsetting (lp:~hikiko/unity-control-center/unity-control-center.lowgfx)

Description of the change

removes lowgfx option from ccsm, reads the "lowgfx" gsetting (lp:~hikiko/unity-control-center/unity-control-center.lowgfx)

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

As said in the UCC branch, please update the compiz profile selector script to use the dconf/gsettings value instead.

This method only relies on unity settings being changed by UCC, while having the check at pre-start script would make unity to use the whole new profile even if configured with just the gsetting key.

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Check the comments please

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Check inline comments

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Some style fixes as a start please...

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I've fixed some things here: lp:~3v1n0/unity/lowgfx-fixes

Please merge.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

This side is fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity.gschema.xml'
2--- data/com.canonical.Unity.gschema.xml 2017-01-25 16:40:35 +0000
3+++ data/com.canonical.Unity.gschema.xml 2017-04-05 07:48:49 +0000
4@@ -100,6 +100,11 @@
5 when authenticating. Only do this if you have account
6 configured properly on your system.</description>
7 </key>
8+ <key type="b" name="lowgfx">
9+ <default>false</default>
10+ <summary>Enable/Disable Low Graphics Mode</summary>
11+ <description>Whether Unity runs in Low Graphics Mode.</description>
12+ </key>
13 </schema>
14 <schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity">
15 <key type="d" name="text-scale-factor">
16
17=== modified file 'decorations/DecorationsWindowButton.cpp'
18--- decorations/DecorationsWindowButton.cpp 2016-08-04 08:53:20 +0000
19+++ decorations/DecorationsWindowButton.cpp 2017-04-05 07:48:49 +0000
20@@ -45,7 +45,8 @@
21
22 void WindowButton::UpdateTexture()
23 {
24- SetTexture(DataPool::Get()->ButtonTexture(scale(), type(), GetCurrentState()));
25+ if (auto tex = DataPool::Get()->ButtonTexture(scale(), type(), GetCurrentState()))
26+ SetTexture(tex);
27 }
28
29 WidgetState WindowButton::GetCurrentState() const
30
31=== modified file 'plugins/unityshell/src/unityshell.cpp'
32--- plugins/unityshell/src/unityshell.cpp 2017-02-27 13:47:32 +0000
33+++ plugins/unityshell/src/unityshell.cpp 2017-04-05 07:48:49 +0000
34@@ -292,23 +292,28 @@
35 }
36 }
37
38- //In case of software rendering then enable lowgfx mode.
39+ //In case of software rendering then enable lowgfx mode.
40 std::string renderer = ANSI_TO_TCHAR(NUX_REINTERPRET_CAST(const char *, glGetString(GL_RENDERER)));
41-
42 if (renderer.find("Software Rasterizer") != std::string::npos ||
43 renderer.find("Mesa X11") != std::string::npos ||
44 renderer.find("llvmpipe") != std::string::npos ||
45 renderer.find("softpipe") != std::string::npos ||
46- (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) ||
47- optionGetLowGraphicsMode())
48- {
49- unity_settings_.low_gfx = true;
50- }
51+ (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1))
52+ {
53+ unity_settings_.low_gfx = true;
54+ }
55
56 if (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 0)
57 {
58 unity_settings_.low_gfx = false;
59 }
60+
61+ if (unity_settings_.low_gfx())
62+ BackgroundEffectHelper::blur_type = BLUR_NONE;
63+
64+ Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
65+ BackgroundEffectHelper::blur_type = low_gfx ? BLUR_NONE : (unity::BlurType) optionGetDashBlurExperimental();
66+ }, *this));
67 #endif
68
69 if (!failed)
70@@ -384,7 +389,6 @@
71 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
72 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
73 optionSetShortcutOverlayNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
74- optionSetLowGraphicsModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
75 optionSetShowLauncherInitiate(boost::bind(&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
76 optionSetShowLauncherTerminate(boost::bind(&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
77 optionSetKeyboardFocusInitiate(boost::bind(&UnityScreen::setKeyboardFocusKeyInitiate, this, _1, _2, _3));
78@@ -3751,14 +3755,6 @@
79 case UnityshellOptions::ShortcutOverlay:
80 shortcut_controller_->SetEnabled(optionGetShortcutOverlay());
81 break;
82- case UnityshellOptions::LowGraphicsMode:
83- if (optionGetLowGraphicsMode())
84- BackgroundEffectHelper::blur_type = BLUR_NONE;
85- else
86- BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
87-
88- unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode();
89- break;
90 case UnityshellOptions::DecayRate:
91 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
92 break;
93
94=== modified file 'plugins/unityshell/unityshell.xml.in'
95--- plugins/unityshell/unityshell.xml.in 2016-07-18 17:20:07 +0000
96+++ plugins/unityshell/unityshell.xml.in 2017-04-05 07:48:49 +0000
97@@ -160,12 +160,6 @@
98 <_long>Enables possibility to display an overlay showing available mouse and keyboard shortcuts.</_long>
99 <default>true</default>
100 </option>
101-
102- <option name="low_graphics_mode" type="bool">
103- <_short>Enable Low Graphics Mode</_short>
104- <_long>Enables low graphics mode regardless of hardware in the system</_long>
105- <default>false</default>
106- </option>
107 </group>
108
109 <group>
110
111=== modified file 'tools/compiz-profile-selector.in'
112--- tools/compiz-profile-selector.in 2016-09-05 10:46:49 +0000
113+++ tools/compiz-profile-selector.in 2017-04-05 07:48:49 +0000
114@@ -1,12 +1,27 @@
115 #!/bin/bash
116-
117 set -e
118+
119+config_dir="$XDG_CONFIG_HOME"
120+if [ -z "$config_dir" ]; then
121+ config_dir="$HOME/.config"
122+fi
123+
124+default_ini="$config_dir/compiz-1/compizconfig/Default.ini"
125+
126+if [ -f "$default_ini" ]; then
127+ rm "$default_ini"
128+fi
129+
130 compiz_profile="ubuntu"
131
132 if ! /usr/lib/nux/unity_support_test -p; then
133 compiz_profile="ubuntu-lowgfx"
134 fi
135
136+if [ "$(gsettings get com.canonical.Unity lowgfx)" == "true" ]; then
137+ compiz_profile="ubuntu-lowgfx"
138+fi
139+
140 echo "Using compiz profile '$compiz_profile'"
141
142 if [ -n "$UPSTART_SESSION" ]; then
143
144=== modified file 'tools/unity.cmake'
145--- tools/unity.cmake 2016-09-01 18:55:15 +0000
146+++ tools/unity.cmake 2017-04-05 07:48:49 +0000
147@@ -66,6 +66,12 @@
148 except:
149 pass
150
151+ try:
152+ if subprocess.check_output('gsettings get com.canonical.Unity lowgfx'.split()) == b'true\n':
153+ os.environ['COMPIZ_CONFIG_PROFILE'] = 'ubuntu-lowgfx'
154+ except:
155+ pass
156+
157 if not 'DISPLAY' in os.environ:
158 # take an optimistic chance and warn about it :)
159 print("WARNING: no DISPLAY variable set, setting it to :0")
160
161=== modified file 'unity-shared/BackgroundEffectHelper.cpp'
162--- unity-shared/BackgroundEffectHelper.cpp 2016-12-12 08:27:16 +0000
163+++ unity-shared/BackgroundEffectHelper.cpp 2017-04-05 07:48:49 +0000
164@@ -21,7 +21,6 @@
165 #include "BackgroundEffectHelper.h"
166
167 #include "TextureCache.h"
168-#include "UnitySettings.h"
169
170 namespace
171 {
172@@ -50,9 +49,6 @@
173 owner.changed.connect(sigc::mem_fun(this, &BackgroundEffectHelper::OnOwnerChanged));
174 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &BackgroundEffectHelper::LoadTextures));
175 LoadTextures();
176-
177- if (Settings::Instance().low_gfx())
178- blur_type = BLUR_NONE;
179 }
180
181 BackgroundEffectHelper::BackgroundEffectHelper()
182
183=== modified file 'unity-shared/UnitySettings.cpp'
184--- unity-shared/UnitySettings.cpp 2016-12-20 16:32:03 +0000
185+++ unity-shared/UnitySettings.cpp 2017-04-05 07:48:49 +0000
186@@ -40,6 +40,7 @@
187 const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";
188 const std::string DESKTOP_TYPE = "desktop-type";
189 const std::string PAM_CHECK_ACCOUNT_TYPE = "pam-check-account-type";
190+const std::string LOWGFX = "lowgfx";
191
192 const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";
193 const std::string LAUNCHER_POSITION = "launcher-position";
194@@ -116,6 +117,10 @@
195 for (unsigned i = 0; i < monitors::MAX; ++i)
196 em_converters_.emplace_back(std::make_shared<EMConverter>());
197
198+ signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + LOWGFX, [this] (GSettings*, const gchar *) {
199+ UpdateLowGfx();
200+ });
201+
202 signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + FORM_FACTOR, [this] (GSettings*, const gchar*) {
203 CacheFormFactor();
204 });
205@@ -180,6 +185,7 @@
206 UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateDPI))));
207
208 // The order is important here, DPI is the last thing to be updated
209+ UpdateLowGfx();
210 UpdateLimSetting();
211 UpdateGesturesSetting();
212 UpdateTextScaleFactor();
213@@ -229,6 +235,11 @@
214 cached_launcher_position_ = static_cast<LauncherPosition>(g_settings_get_enum(launcher_settings_, LAUNCHER_POSITION.c_str()));
215 }
216
217+ void UpdateLowGfx()
218+ {
219+ parent_->low_gfx = GetLowGfx();
220+ }
221+
222 void UpdateLimSetting()
223 {
224 parent_->lim_movement_thresold = g_settings_get_uint(lim_settings_, CLICK_MOVEMENT_THRESHOLD.c_str());
225@@ -281,6 +292,11 @@
226 return g_settings_get_boolean(usettings_, PAM_CHECK_ACCOUNT_TYPE.c_str());
227 }
228
229+ bool GetLowGfx() const
230+ {
231+ return g_settings_get_boolean(usettings_, LOWGFX.c_str());
232+ }
233+
234 int GetFontSize() const
235 {
236 gint font_size;
237@@ -329,7 +345,7 @@
238 auto const& geo = uscreen->GetMonitorGeometry(monitor);
239 auto const& size = uscreen->GetMonitorPhysicalSize(monitor);
240 auto scale = DPI_SCALING_STEP;
241-
242+
243 if ((size.width == 160 && size.height == 90) ||
244 (size.width == 160 && size.height == 100) ||
245 (size.width == 16 && size.height == 9) ||
246@@ -340,7 +356,7 @@
247
248 if (size.width > 0 && size.height > 0)
249 {
250- const double dpi_x = static_cast<double>(geo.width) / (size.width / 25.4);
251+ const double dpi_x = static_cast<double>(geo.width) / (size.width / 25.4);
252 const double dpi_y = static_cast<double>(geo.height) / (size.height / 25.4);
253
254 const auto dpi = std::max(dpi_x, dpi_y);
255@@ -481,8 +497,7 @@
256 //
257
258 Settings::Settings()
259- : low_gfx(false)
260- , is_standalone(false)
261+ : is_standalone(false)
262 , pimpl(new Impl(this))
263 {
264 if (settings_instance)
265
266=== modified file 'unity-shared/UnitySettings.h'
267--- unity-shared/UnitySettings.h 2016-07-04 14:21:00 +0000
268+++ unity-shared/UnitySettings.h 2017-04-05 07:48:49 +0000
269@@ -76,7 +76,6 @@
270 nux::Property<bool> gestures_windows_drag_pinch;
271
272 sigc::signal<void> dpi_changed;
273- sigc::signal<void> low_gfx_changed;
274 sigc::signal<void> gestures_changed;
275
276 private: