Merge lp:~azzar1/unity/fix-815032 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Neil J. Patel
Approved revision: no longer in the source branch.
Merged at revision: 1327
Proposed branch: lp:~azzar1/unity/fix-815032
Merge into: lp:unity
Diff against target: 97 lines (+25/-1)
4 files modified
plugins/unityshell/src/Launcher.cpp (+11/-1)
plugins/unityshell/src/Launcher.h (+2/-0)
plugins/unityshell/src/unityshell.cpp (+4/-0)
plugins/unityshell/unityshell.xml.in (+8/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-815032
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Marco Trevisan (Treviño) Approve
Marco Biscaro (community) Approve
Review via email: mp+69855@code.launchpad.net

Description of the change

Add a ccsm option to change launcher opacity. the default value is 0.6667, about 0xAA (current default value).

To post a comment you must log in.
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

Everything looks good.

Just one comment: an option in cssm with default value 0.6667 looks strange for me.

I think it would be better if the value was between 0 and 255 (with default value = 170). Then, the code in UnityScreen::optionChanged would be something like:

case UnityshellOptions::LauncherOpacity:
  launcher->SetBackgroundAlpha(optionGetLauncherOpacity() / 255.0);
  break;

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Everything looks good.
>
> Just one comment: an option in cssm with default value 0.6667 looks strange
> for me.
>
> I think it would be better if the value was between 0 and 255 (with default
> value = 170). Then, the code in UnityScreen::optionChanged would be something
> like:
>
> case UnityshellOptions::LauncherOpacity:
> launcher->SetBackgroundAlpha(optionGetLauncherOpacity() / 255.0);
> break;

I have your same opinion, but panel opacity has the same scale of values. So it may appear inconsistent.

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

It seems fine to me.

review: Approve
Revision history for this message
Neil J. Patel (njpatel) wrote :

Sweet!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2011-07-29 03:09:49 +0000
+++ plugins/unityshell/src/Launcher.cpp 2011-07-29 20:33:29 +0000
@@ -219,6 +219,7 @@
219 _icon_glow_size = 62;219 _icon_glow_size = 62;
220 _icon_image_size_delta = 6;220 _icon_image_size_delta = 6;
221 _icon_size = _icon_image_size + _icon_image_size_delta;221 _icon_size = _icon_image_size + _icon_image_size_delta;
222 _background_alpha = 0.6667; // about 0xAA
222223
223 _enter_y = 0;224 _enter_y = 0;
224 _launcher_drag_delta = 0;225 _launcher_drag_delta = 0;
@@ -2003,6 +2004,15 @@
2003 icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons);2004 icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons);
2004}2005}
20052006
2007void Launcher::SetBackgroundAlpha(float background_alpha)
2008{
2009 if (_background_alpha == background_alpha)
2010 return;
2011
2012 _background_alpha = background_alpha;
2013 NeedRedraw();
2014}
2015
2006void Launcher::OnIconAdded(LauncherIcon* icon)2016void Launcher::OnIconAdded(LauncherIcon* icon)
2007{2017{
2008 EnsureAnimation();2018 EnsureAnimation();
@@ -2118,7 +2128,7 @@
2118 }2128 }
2119 else2129 else
2120 {2130 {
2121 gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0xAA000000));2131 gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0.0, 0.0, 0.0, _background_alpha));
2122 }2132 }
2123 2133
2124 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);2134 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
21252135
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2011-07-29 03:09:49 +0000
+++ plugins/unityshell/src/Launcher.h 2011-07-29 20:33:29 +0000
@@ -112,6 +112,7 @@
112 LauncherIcon* GetSelectedMenuIcon();112 LauncherIcon* GetSelectedMenuIcon();
113113
114 void SetIconSize(int tile_size, int icon_size);114 void SetIconSize(int tile_size, int icon_size);
115 void SetBackgroundAlpha(float background_alpha);
115116
116 bool Hidden()117 bool Hidden()
117 {118 {
@@ -421,6 +422,7 @@
421 int _last_button_press;422 int _last_button_press;
422 int _drag_out_id;423 int _drag_out_id;
423 float _drag_out_delta_x;424 float _drag_out_delta_x;
425 float _background_alpha;
424426
425 int _bfb_width;427 int _bfb_width;
426 int _bfb_height;428 int _bfb_height;
427429
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-07-28 10:43:23 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-07-29 20:33:29 +0000
@@ -144,6 +144,7 @@
144 optionSetLaunchAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));144 optionSetLaunchAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
145 optionSetUrgentAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));145 optionSetUrgentAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
146 optionSetPanelOpacityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));146 optionSetPanelOpacityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
147 optionSetLauncherOpacityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
147 optionSetIconSizeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));148 optionSetIconSizeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
148 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));149 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
149 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));150 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
@@ -965,6 +966,9 @@
965 case UnityshellOptions::PanelOpacity:966 case UnityshellOptions::PanelOpacity:
966 panelController->SetOpacity(optionGetPanelOpacity());967 panelController->SetOpacity(optionGetPanelOpacity());
967 break;968 break;
969 case UnityshellOptions::LauncherOpacity:
970 launcher->SetBackgroundAlpha(optionGetLauncherOpacity());
971 break;
968 case UnityshellOptions::IconSize:972 case UnityshellOptions::IconSize:
969 panelController->SetBFBSize(optionGetIconSize() + 18);973 panelController->SetBFBSize(optionGetIconSize() + 18);
970 launcher->SetIconSize(optionGetIconSize() + 6, optionGetIconSize());974 launcher->SetIconSize(optionGetIconSize() + 6, optionGetIconSize());
971975
=== modified file 'plugins/unityshell/unityshell.xml.in'
--- plugins/unityshell/unityshell.xml.in 2011-07-26 12:33:23 +0000
+++ plugins/unityshell/unityshell.xml.in 2011-07-29 20:33:29 +0000
@@ -166,6 +166,14 @@
166 <max>1.0</max>166 <max>1.0</max>
167 <precision>0.01</precision>167 <precision>0.01</precision>
168 </option>168 </option>
169 <option type="float" name="launcher_opacity">
170 <_short>Launcher Opacity</_short>
171 <_long>The opacity of the Launcher background.</_long>
172 <default>0.6667</default>
173 <min>0.0</min>
174 <max>1.0</max>
175 <precision>0.0001</precision>
176 </option>
169 <option name="icon_size" type="int">177 <option name="icon_size" type="int">
170 <_short>Launcher icon size</_short>178 <_short>Launcher icon size</_short>
171 <_long>The size of the launcher icons</_long>179 <_long>The size of the launcher icons</_long>