Merge lp:~thumper/unity/fix-launcher-multimonitor-resaturate into lp:unity

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2164
Proposed branch: lp:~thumper/unity/fix-launcher-multimonitor-resaturate
Merge into: lp:unity
Diff against target: 261 lines (+81/-23)
5 files modified
manual-tests/Launcher.txt (+16/-0)
manual-tests/Panel.txt (+14/-0)
plugins/unityshell/src/Launcher.cpp (+19/-4)
plugins/unityshell/src/PanelView.cpp (+30/-18)
plugins/unityshell/src/PanelView.h (+2/-1)
To merge this branch: bzr merge lp:~thumper/unity/fix-launcher-multimonitor-resaturate
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+98957@code.launchpad.net

Commit message

Make the panel more aware of open overlays, and make sure that all launchers resaturate the icons when overlays (the dash or hud) are closed.

Description of the change

== The problem ==

1. With multiple monitors, closing the hud or dash on one monitor would cause the launcher on one monitor to stay with desaturated icons.

2. The panel would go solid if switching from the hud to the dash (or vice versa) without closing the open overlay first.

== The solution ==

1. A little brutal, but request a redraw when an overlay closes.
2. Remember which overlay last opened, and only go solid if the close matches the last open.

== Tests ==

Manual I'm afraid.

UNBLOCK

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Pity about the manual tests, but looks good otherwise.

review: Approve
Revision history for this message
Tim Penhey (thumper) wrote :

Yeah, I'd like to expose the state of the panel in autopilot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Launcher.txt'
2--- manual-tests/Launcher.txt 2012-03-21 18:19:34 +0000
3+++ manual-tests/Launcher.txt 2012-03-23 02:37:26 +0000
4@@ -188,3 +188,19 @@
5 Outcome:
6 * Only the primary monitor should show a launcher. Changing the primary monitor
7 from gnome-control-center -> Monitor should update the launcher position.
8+
9+
10+Panel appearance with overlays
11+------------------------------
12+Setup:
13+ Have a secondary monitor plugged in and working.
14+ Have the launchers on each monitor
15+ Make sure the launcher setting is to never hide.
16+
17+Actions:
18+#. Press <super> to bring up the dash
19+#. Press <super> to close the dash
20+
21+Expected Result:
22+ The launchers on each monitor have saturated icons (normal looking, not the
23+ desaturated look that there is while the dash is open).
24
25=== modified file 'manual-tests/Panel.txt'
26--- manual-tests/Panel.txt 2012-03-14 06:24:18 +0000
27+++ manual-tests/Panel.txt 2012-03-23 02:37:26 +0000
28@@ -60,3 +60,17 @@
29 of the panel should change inline with changes in alt-tab focus.
30 Also the menus shouldn't ever show. Even if the mouse has been left over
31 the panel when starting the Alt+Tab.
32+
33+
34+Panel appearance with overlays
35+------------------------------
36+Actions:
37+#. Press <super> to bring up the dash
38+
39+Expected Result:
40+ The panel should be translucent matching the dash background
41+
42+#. Press <alt> to bring up the hud without closing the dash
43+
44+Expected Result:
45+ The panel should stay translucent
46
47=== modified file 'plugins/unityshell/src/Launcher.cpp'
48--- plugins/unityshell/src/Launcher.cpp 2012-03-21 14:44:41 +0000
49+++ plugins/unityshell/src/Launcher.cpp 2012-03-23 02:37:26 +0000
50@@ -1321,9 +1321,14 @@
51 gint32 overlay_monitor = 0;
52 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
53 &overlay_identity, &can_maximise, &overlay_monitor);
54-
55 std::string identity = overlay_identity.Str();
56- if (overlay_monitor == monitor)
57+
58+ LOG_DEBUG(logger) << "Overlay shown: " << identity
59+ << ", " << (can_maximise ? "can maximise" : "can't maximise")
60+ << ", on monitor " << overlay_monitor
61+ << " (for monitor " << monitor() << ")";
62+
63+ if (overlay_monitor == monitor())
64 {
65 if (identity == "dash")
66 {
67@@ -1337,8 +1342,10 @@
68 }
69
70 bg_effect_helper_.enabled = true;
71+ LOG_DEBUG(logger) << "Desaturate on monitor " << monitor();
72 DesaturateIcons();
73 }
74+ EnsureAnimation();
75 }
76
77 void Launcher::OnOverlayHidden(GVariant* data)
78@@ -1351,7 +1358,13 @@
79 &overlay_identity, &can_maximise, &overlay_monitor);
80
81 std::string identity = overlay_identity.Str();
82- if (overlay_monitor == monitor)
83+
84+ LOG_DEBUG(logger) << "Overlay hidden: " << identity
85+ << ", " << (can_maximise ? "can maximise" : "can't maximise")
86+ << ", on monitor " << overlay_monitor
87+ << " (for monitor" << monitor() << ")";
88+
89+ if (overlay_monitor == monitor())
90 {
91 if (identity == "dash")
92 {
93@@ -1365,12 +1378,14 @@
94 }
95
96 // If they are both now shut, then disable the effect helper and saturate the icons.
97- if (!_dash_is_open and !_hud_is_open)
98+ if (!IsOverlayOpen())
99 {
100 bg_effect_helper_.enabled = false;
101+ LOG_DEBUG(logger) << "Saturate on monitor " << monitor();
102 SaturateIcons();
103 }
104 }
105+ EnsureAnimation();
106
107 // as the leave event is no more received when the place is opened
108 // FIXME: remove when we change the mouse grab strategy in nux
109
110=== modified file 'plugins/unityshell/src/PanelView.cpp'
111--- plugins/unityshell/src/PanelView.cpp 2012-03-22 19:33:10 +0000
112+++ plugins/unityshell/src/PanelView.cpp 2012-03-23 02:37:26 +0000
113@@ -61,7 +61,7 @@
114 _opacity_maximized_toggle(false),
115 _is_primary(false),
116 _monitor(0),
117- _dash_is_open(false)
118+ _overlay_is_open(false)
119 {
120 _needs_geo_sync = false;
121 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
122@@ -173,11 +173,22 @@
123
124 void PanelView::OnDashHidden(GVariant* data, PanelView* self)
125 {
126- if (self->_opacity >= 1.0f)
127- self->bg_effect_helper_.enabled = false;
128- self->_dash_is_open = false;
129- self->_indicators->DashHidden();
130- self->ForceUpdateBackground();
131+ unity::glib::String overlay_identity;
132+ gboolean can_maximise = FALSE;
133+ gint32 overlay_monitor = 0;
134+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
135+ &overlay_identity, &can_maximise, &overlay_monitor);
136+
137+ if (self->_monitor == overlay_monitor &&
138+ overlay_identity.Str() == self->_active_overlay)
139+ {
140+ if (self->_opacity >= 1.0f)
141+ self->bg_effect_helper_.enabled = false;
142+ self->_overlay_is_open = false;
143+ self->_active_overlay = "";
144+ self->_indicators->DashHidden();
145+ self->ForceUpdateBackground();
146+ }
147 }
148
149 void PanelView::OnDashShown(GVariant* data, PanelView* self)
150@@ -185,13 +196,14 @@
151 unity::glib::String overlay_identity;
152 gboolean can_maximise = FALSE;
153 gint32 overlay_monitor = 0;
154- g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
155+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
156 &overlay_identity, &can_maximise, &overlay_monitor);
157
158 if (self->_monitor == overlay_monitor)
159 {
160 self->bg_effect_helper_.enabled = true;
161- self->_dash_is_open = true;
162+ self->_overlay_is_open = true;
163+ self->_active_overlay = overlay_identity.Str();
164 self->_indicators->DashShown();
165 self->ForceUpdateBackground();
166 }
167@@ -227,12 +239,12 @@
168
169 GfxContext.PushClippingRectangle(GetGeometry());
170
171- if (BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
172+ if (BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
173 {
174 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, geo.width, geo.height);
175 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);
176
177- if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || _opacity != 1.0f))
178+ if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || _opacity != 1.0f))
179 {
180 nux::TexCoordXForm texxform_blur_bg;
181 texxform_blur_bg.flip_v_coord = true;
182@@ -277,7 +289,7 @@
183 GfxContext.PopClippingRectangle();
184 }
185
186- if (_dash_is_open)
187+ if (_overlay_is_open)
188 {
189 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_darken_layer_);
190 }
191@@ -285,7 +297,7 @@
192
193
194
195- if (_dash_is_open == false)
196+ if (_overlay_is_open == false)
197 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_layer);
198
199 GfxContext.PopClippingRectangle();
200@@ -308,7 +320,7 @@
201 GfxContext.GetRenderStates().SetBlend(true);
202 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
203
204- if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
205+ if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
206 {
207 nux::Geometry geo_absolute = GetAbsoluteGeometry ();
208 nux::TexCoordXForm texxform_blur_bg;
209@@ -352,17 +364,17 @@
210 #endif
211 bgs++;
212
213- if (_dash_is_open)
214+ if (_overlay_is_open)
215 {
216 nux::GetPainter().PushLayer(GfxContext, GetGeometry(), _bg_darken_layer_);
217 bgs++;
218 }
219 }
220
221- if (_dash_is_open == FALSE)
222+ if (_overlay_is_open == FALSE)
223 gPainter.PushLayer(GfxContext, GetGeometry(), _bg_layer);
224
225- if (_dash_is_open)
226+ if (_overlay_is_open)
227 {
228 // apply the shine
229 nux::TexCoordXForm texxform;
230@@ -414,7 +426,7 @@
231
232 guint32 maximized_win = _menu_view->GetMaximizedWindow();
233
234- if (_dash_is_open)
235+ if (_overlay_is_open)
236 {
237 if (_bg_layer)
238 delete _bg_layer;
239@@ -658,7 +670,7 @@
240
241 _opacity = opacity;
242
243- bg_effect_helper_.enabled = (_opacity < 1.0f || _dash_is_open);
244+ bg_effect_helper_.enabled = (_opacity < 1.0f || _overlay_is_open);
245
246 ForceUpdateBackground();
247 }
248
249=== modified file 'plugins/unityshell/src/PanelView.h'
250--- plugins/unityshell/src/PanelView.h 2012-03-22 19:33:10 +0000
251+++ plugins/unityshell/src/PanelView.h 2012-03-23 02:37:26 +0000
252@@ -116,7 +116,8 @@
253 bool _is_primary;
254 int _monitor;
255
256- bool _dash_is_open;
257+ bool _overlay_is_open;
258+ std::string _active_overlay;
259 guint _handle_dash_hidden;
260 guint _handle_dash_shown;
261 guint _handle_bg_color_update;