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
=== modified file 'manual-tests/Launcher.txt'
--- manual-tests/Launcher.txt 2012-03-21 18:19:34 +0000
+++ manual-tests/Launcher.txt 2012-03-23 02:37:26 +0000
@@ -188,3 +188,19 @@
188Outcome:188Outcome:
189 * Only the primary monitor should show a launcher. Changing the primary monitor189 * Only the primary monitor should show a launcher. Changing the primary monitor
190 from gnome-control-center -> Monitor should update the launcher position.190 from gnome-control-center -> Monitor should update the launcher position.
191
192
193Panel appearance with overlays
194------------------------------
195Setup:
196 Have a secondary monitor plugged in and working.
197 Have the launchers on each monitor
198 Make sure the launcher setting is to never hide.
199
200Actions:
201#. Press <super> to bring up the dash
202#. Press <super> to close the dash
203
204Expected Result:
205 The launchers on each monitor have saturated icons (normal looking, not the
206 desaturated look that there is while the dash is open).
191207
=== modified file 'manual-tests/Panel.txt'
--- manual-tests/Panel.txt 2012-03-14 06:24:18 +0000
+++ manual-tests/Panel.txt 2012-03-23 02:37:26 +0000
@@ -60,3 +60,17 @@
60 of the panel should change inline with changes in alt-tab focus.60 of the panel should change inline with changes in alt-tab focus.
61 Also the menus shouldn't ever show. Even if the mouse has been left over61 Also the menus shouldn't ever show. Even if the mouse has been left over
62 the panel when starting the Alt+Tab.62 the panel when starting the Alt+Tab.
63
64
65Panel appearance with overlays
66------------------------------
67Actions:
68#. Press <super> to bring up the dash
69
70Expected Result:
71 The panel should be translucent matching the dash background
72
73#. Press <alt> to bring up the hud without closing the dash
74
75Expected Result:
76 The panel should stay translucent
6377
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-03-21 14:44:41 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-03-23 02:37:26 +0000
@@ -1321,9 +1321,14 @@
1321 gint32 overlay_monitor = 0;1321 gint32 overlay_monitor = 0;
1322 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,1322 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
1323 &overlay_identity, &can_maximise, &overlay_monitor);1323 &overlay_identity, &can_maximise, &overlay_monitor);
1324
1325 std::string identity = overlay_identity.Str();1324 std::string identity = overlay_identity.Str();
1326 if (overlay_monitor == monitor)1325
1326 LOG_DEBUG(logger) << "Overlay shown: " << identity
1327 << ", " << (can_maximise ? "can maximise" : "can't maximise")
1328 << ", on monitor " << overlay_monitor
1329 << " (for monitor " << monitor() << ")";
1330
1331 if (overlay_monitor == monitor())
1327 {1332 {
1328 if (identity == "dash")1333 if (identity == "dash")
1329 {1334 {
@@ -1337,8 +1342,10 @@
1337 }1342 }
13381343
1339 bg_effect_helper_.enabled = true;1344 bg_effect_helper_.enabled = true;
1345 LOG_DEBUG(logger) << "Desaturate on monitor " << monitor();
1340 DesaturateIcons();1346 DesaturateIcons();
1341 }1347 }
1348 EnsureAnimation();
1342}1349}
13431350
1344void Launcher::OnOverlayHidden(GVariant* data)1351void Launcher::OnOverlayHidden(GVariant* data)
@@ -1351,7 +1358,13 @@
1351 &overlay_identity, &can_maximise, &overlay_monitor);1358 &overlay_identity, &can_maximise, &overlay_monitor);
13521359
1353 std::string identity = overlay_identity.Str();1360 std::string identity = overlay_identity.Str();
1354 if (overlay_monitor == monitor)1361
1362 LOG_DEBUG(logger) << "Overlay hidden: " << identity
1363 << ", " << (can_maximise ? "can maximise" : "can't maximise")
1364 << ", on monitor " << overlay_monitor
1365 << " (for monitor" << monitor() << ")";
1366
1367 if (overlay_monitor == monitor())
1355 {1368 {
1356 if (identity == "dash")1369 if (identity == "dash")
1357 {1370 {
@@ -1365,12 +1378,14 @@
1365 }1378 }
13661379
1367 // If they are both now shut, then disable the effect helper and saturate the icons.1380 // If they are both now shut, then disable the effect helper and saturate the icons.
1368 if (!_dash_is_open and !_hud_is_open)1381 if (!IsOverlayOpen())
1369 {1382 {
1370 bg_effect_helper_.enabled = false;1383 bg_effect_helper_.enabled = false;
1384 LOG_DEBUG(logger) << "Saturate on monitor " << monitor();
1371 SaturateIcons();1385 SaturateIcons();
1372 }1386 }
1373 }1387 }
1388 EnsureAnimation();
13741389
1375 // as the leave event is no more received when the place is opened1390 // as the leave event is no more received when the place is opened
1376 // FIXME: remove when we change the mouse grab strategy in nux1391 // FIXME: remove when we change the mouse grab strategy in nux
13771392
=== modified file 'plugins/unityshell/src/PanelView.cpp'
--- plugins/unityshell/src/PanelView.cpp 2012-03-22 19:33:10 +0000
+++ plugins/unityshell/src/PanelView.cpp 2012-03-23 02:37:26 +0000
@@ -61,7 +61,7 @@
61 _opacity_maximized_toggle(false),61 _opacity_maximized_toggle(false),
62 _is_primary(false),62 _is_primary(false),
63 _monitor(0),63 _monitor(0),
64 _dash_is_open(false)64 _overlay_is_open(false)
65{65{
66 _needs_geo_sync = false;66 _needs_geo_sync = false;
67 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));67 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
@@ -173,11 +173,22 @@
173173
174void PanelView::OnDashHidden(GVariant* data, PanelView* self)174void PanelView::OnDashHidden(GVariant* data, PanelView* self)
175{175{
176 if (self->_opacity >= 1.0f)176 unity::glib::String overlay_identity;
177 self->bg_effect_helper_.enabled = false;177 gboolean can_maximise = FALSE;
178 self->_dash_is_open = false;178 gint32 overlay_monitor = 0;
179 self->_indicators->DashHidden();179 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
180 self->ForceUpdateBackground();180 &overlay_identity, &can_maximise, &overlay_monitor);
181
182 if (self->_monitor == overlay_monitor &&
183 overlay_identity.Str() == self->_active_overlay)
184 {
185 if (self->_opacity >= 1.0f)
186 self->bg_effect_helper_.enabled = false;
187 self->_overlay_is_open = false;
188 self->_active_overlay = "";
189 self->_indicators->DashHidden();
190 self->ForceUpdateBackground();
191 }
181}192}
182193
183void PanelView::OnDashShown(GVariant* data, PanelView* self)194void PanelView::OnDashShown(GVariant* data, PanelView* self)
@@ -185,13 +196,14 @@
185 unity::glib::String overlay_identity;196 unity::glib::String overlay_identity;
186 gboolean can_maximise = FALSE;197 gboolean can_maximise = FALSE;
187 gint32 overlay_monitor = 0;198 gint32 overlay_monitor = 0;
188 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, 199 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
189 &overlay_identity, &can_maximise, &overlay_monitor);200 &overlay_identity, &can_maximise, &overlay_monitor);
190201
191 if (self->_monitor == overlay_monitor)202 if (self->_monitor == overlay_monitor)
192 {203 {
193 self->bg_effect_helper_.enabled = true;204 self->bg_effect_helper_.enabled = true;
194 self->_dash_is_open = true;205 self->_overlay_is_open = true;
206 self->_active_overlay = overlay_identity.Str();
195 self->_indicators->DashShown();207 self->_indicators->DashShown();
196 self->ForceUpdateBackground();208 self->ForceUpdateBackground();
197 }209 }
@@ -227,12 +239,12 @@
227239
228 GfxContext.PushClippingRectangle(GetGeometry());240 GfxContext.PushClippingRectangle(GetGeometry());
229241
230 if (BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || (_opacity != 1.0f && _opacity != 0.0f)))242 if (BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
231 {243 {
232 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, geo.width, geo.height);244 nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, geo.width, geo.height);
233 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);245 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(blur_geo);
234246
235 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || _opacity != 1.0f))247 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || _opacity != 1.0f))
236 {248 {
237 nux::TexCoordXForm texxform_blur_bg;249 nux::TexCoordXForm texxform_blur_bg;
238 texxform_blur_bg.flip_v_coord = true;250 texxform_blur_bg.flip_v_coord = true;
@@ -277,7 +289,7 @@
277 GfxContext.PopClippingRectangle();289 GfxContext.PopClippingRectangle();
278 }290 }
279291
280 if (_dash_is_open)292 if (_overlay_is_open)
281 {293 {
282 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_darken_layer_);294 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_darken_layer_);
283 }295 }
@@ -285,7 +297,7 @@
285297
286298
287299
288 if (_dash_is_open == false)300 if (_overlay_is_open == false)
289 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_layer);301 nux::GetPainter().RenderSinglePaintLayer(GfxContext, GetGeometry(), _bg_layer);
290302
291 GfxContext.PopClippingRectangle();303 GfxContext.PopClippingRectangle();
@@ -308,7 +320,7 @@
308 GfxContext.GetRenderStates().SetBlend(true);320 GfxContext.GetRenderStates().SetBlend(true);
309 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);321 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
310322
311 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_dash_is_open || (_opacity != 1.0f && _opacity != 0.0f)))323 if (bg_blur_texture_.IsValid() && BackgroundEffectHelper::blur_type != BLUR_NONE && (_overlay_is_open || (_opacity != 1.0f && _opacity != 0.0f)))
312 {324 {
313 nux::Geometry geo_absolute = GetAbsoluteGeometry ();325 nux::Geometry geo_absolute = GetAbsoluteGeometry ();
314 nux::TexCoordXForm texxform_blur_bg;326 nux::TexCoordXForm texxform_blur_bg;
@@ -352,17 +364,17 @@
352#endif364#endif
353 bgs++;365 bgs++;
354366
355 if (_dash_is_open)367 if (_overlay_is_open)
356 {368 {
357 nux::GetPainter().PushLayer(GfxContext, GetGeometry(), _bg_darken_layer_);369 nux::GetPainter().PushLayer(GfxContext, GetGeometry(), _bg_darken_layer_);
358 bgs++;370 bgs++;
359 }371 }
360 }372 }
361373
362 if (_dash_is_open == FALSE)374 if (_overlay_is_open == FALSE)
363 gPainter.PushLayer(GfxContext, GetGeometry(), _bg_layer);375 gPainter.PushLayer(GfxContext, GetGeometry(), _bg_layer);
364376
365 if (_dash_is_open)377 if (_overlay_is_open)
366 {378 {
367 // apply the shine379 // apply the shine
368 nux::TexCoordXForm texxform;380 nux::TexCoordXForm texxform;
@@ -414,7 +426,7 @@
414 426
415 guint32 maximized_win = _menu_view->GetMaximizedWindow();427 guint32 maximized_win = _menu_view->GetMaximizedWindow();
416428
417 if (_dash_is_open)429 if (_overlay_is_open)
418 {430 {
419 if (_bg_layer)431 if (_bg_layer)
420 delete _bg_layer;432 delete _bg_layer;
@@ -658,7 +670,7 @@
658670
659 _opacity = opacity;671 _opacity = opacity;
660672
661 bg_effect_helper_.enabled = (_opacity < 1.0f || _dash_is_open);673 bg_effect_helper_.enabled = (_opacity < 1.0f || _overlay_is_open);
662674
663 ForceUpdateBackground();675 ForceUpdateBackground();
664}676}
665677
=== modified file 'plugins/unityshell/src/PanelView.h'
--- plugins/unityshell/src/PanelView.h 2012-03-22 19:33:10 +0000
+++ plugins/unityshell/src/PanelView.h 2012-03-23 02:37:26 +0000
@@ -116,7 +116,8 @@
116 bool _is_primary;116 bool _is_primary;
117 int _monitor;117 int _monitor;
118118
119 bool _dash_is_open;119 bool _overlay_is_open;
120 std::string _active_overlay;
120 guint _handle_dash_hidden;121 guint _handle_dash_hidden;
121 guint _handle_dash_shown;122 guint _handle_dash_shown;
122 guint _handle_bg_color_update;123 guint _handle_bg_color_update;