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
1=== modified file 'plugins/unityshell/src/Launcher.cpp'
2--- plugins/unityshell/src/Launcher.cpp 2011-07-29 03:09:49 +0000
3+++ plugins/unityshell/src/Launcher.cpp 2011-07-29 20:33:29 +0000
4@@ -219,6 +219,7 @@
5 _icon_glow_size = 62;
6 _icon_image_size_delta = 6;
7 _icon_size = _icon_image_size + _icon_image_size_delta;
8+ _background_alpha = 0.6667; // about 0xAA
9
10 _enter_y = 0;
11 _launcher_drag_delta = 0;
12@@ -2003,6 +2004,15 @@
13 icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons);
14 }
15
16+void Launcher::SetBackgroundAlpha(float background_alpha)
17+{
18+ if (_background_alpha == background_alpha)
19+ return;
20+
21+ _background_alpha = background_alpha;
22+ NeedRedraw();
23+}
24+
25 void Launcher::OnIconAdded(LauncherIcon* icon)
26 {
27 EnsureAnimation();
28@@ -2118,7 +2128,7 @@
29 }
30 else
31 {
32- gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0xAA000000));
33+ gPainter.Paint2DQuadColor(GfxContext, bkg_box, nux::Color(0.0, 0.0, 0.0, _background_alpha));
34 }
35
36 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
37
38=== modified file 'plugins/unityshell/src/Launcher.h'
39--- plugins/unityshell/src/Launcher.h 2011-07-29 03:09:49 +0000
40+++ plugins/unityshell/src/Launcher.h 2011-07-29 20:33:29 +0000
41@@ -112,6 +112,7 @@
42 LauncherIcon* GetSelectedMenuIcon();
43
44 void SetIconSize(int tile_size, int icon_size);
45+ void SetBackgroundAlpha(float background_alpha);
46
47 bool Hidden()
48 {
49@@ -421,6 +422,7 @@
50 int _last_button_press;
51 int _drag_out_id;
52 float _drag_out_delta_x;
53+ float _background_alpha;
54
55 int _bfb_width;
56 int _bfb_height;
57
58=== modified file 'plugins/unityshell/src/unityshell.cpp'
59--- plugins/unityshell/src/unityshell.cpp 2011-07-28 10:43:23 +0000
60+++ plugins/unityshell/src/unityshell.cpp 2011-07-29 20:33:29 +0000
61@@ -144,6 +144,7 @@
62 optionSetLaunchAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
63 optionSetUrgentAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
64 optionSetPanelOpacityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
65+ optionSetLauncherOpacityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
66 optionSetIconSizeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
67 optionSetAutohideAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
68 optionSetDashBlurExperimentalNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
69@@ -965,6 +966,9 @@
70 case UnityshellOptions::PanelOpacity:
71 panelController->SetOpacity(optionGetPanelOpacity());
72 break;
73+ case UnityshellOptions::LauncherOpacity:
74+ launcher->SetBackgroundAlpha(optionGetLauncherOpacity());
75+ break;
76 case UnityshellOptions::IconSize:
77 panelController->SetBFBSize(optionGetIconSize() + 18);
78 launcher->SetIconSize(optionGetIconSize() + 6, optionGetIconSize());
79
80=== modified file 'plugins/unityshell/unityshell.xml.in'
81--- plugins/unityshell/unityshell.xml.in 2011-07-26 12:33:23 +0000
82+++ plugins/unityshell/unityshell.xml.in 2011-07-29 20:33:29 +0000
83@@ -166,6 +166,14 @@
84 <max>1.0</max>
85 <precision>0.01</precision>
86 </option>
87+ <option type="float" name="launcher_opacity">
88+ <_short>Launcher Opacity</_short>
89+ <_long>The opacity of the Launcher background.</_long>
90+ <default>0.6667</default>
91+ <min>0.0</min>
92+ <max>1.0</max>
93+ <precision>0.0001</precision>
94+ </option>
95 <option name="icon_size" type="int">
96 <_short>Launcher icon size</_short>
97 <_long>The size of the launcher icons</_long>