Merge lp:~3v1n0/unity/refresh-panel+launcher-on-screen-unlock into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Rejected
Rejected by: Sam Spilsbury
Proposed branch: lp:~3v1n0/unity/refresh-panel+launcher-on-screen-unlock
Merge into: lp:unity
Prerequisite: lp:~smspillaz/unity/unity.half_fix_883836
Diff against target: 170 lines (+80/-0)
5 files modified
manual-tests/ScreenSaverHandler.txt (+34/-0)
plugins/unityshell/src/Launcher.cpp (+21/-0)
plugins/unityshell/src/Launcher.h (+5/-0)
plugins/unityshell/src/PanelMenuView.cpp (+15/-0)
plugins/unityshell/src/PanelMenuView.h (+5/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/refresh-panel+launcher-on-screen-unlock
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) Disapprove
Alex Launi (community) test review Needs Fixing
Review via email: mp+85976@code.launchpad.net

Commit message

Make Panel and Launcher be aware of the ScreenSaver unlocking.

Description of the change

Fixed the bug #893647 using the new utility ScreenSaverHandler class by Sam.

To post a comment you must log in.
1787. By Marco Trevisan (Treviño)

Merging with new Sam's changes.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

We discussed doing this on general mouse grab / ungrab with fullscreen windows but apparantly the screensaver is doing something else as well, so this is an adequate solution in the meantime.

review: Approve
Revision history for this message
Alex Launi (alexlauni) wrote :

I'm guessing this is only relevant when the launcher is in autohide mode? Could you please update the tests so that's clear?

It should also be very easy to automate these tests.

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

For the launcher is relevant only on that case, for the menus is always relevant.

By the way. Yes testing is not hard, I only wait the parent branch to be merged, or I'll just move to the ungrab events (but since they are emitted more frequently, that would cause a lot of unneeded redraws).

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Rejecting now that we have code in trunk that does the same on UPower events.

review: Disapprove
Revision history for this message
Michal Hruby (mhr3) wrote :

I actually think this patch could have been better approach than UPower - although you don't really get "corruption", but if you switch to a guest account and back unity is often transparent, or you see unity as it was in the guest account until it's forced to redraw.

Still, the switches and handled also by lightdm these days, so we'd need to check its signals as well.

Unmerged revisions

1787. By Marco Trevisan (Treviño)

Merging with new Sam's changes.

1786. By Marco Trevisan (Treviño)

manual-tests: Added manual tests for ScreenSaver interaction.

1785. By Marco Trevisan (Treviño)

Launcher: use ScreenSaverHandler to hide (if needed) the launcher on screensaver end

Properly fixes bug #893647

1784. By Marco Trevisan (Treviño)

ScreenSaverHandler: add header guard, and extend sigc::trackable

1783. By Marco Trevisan (Treviño)

PanelMenuView: use ScreenSaverHandler to hide/show menus when screensaver is closed

When the ScreenSaver/LockScreen is closed, we need to check again the current
mouse position to check if showing the menus or not.

Partly Fixes bug #893647

1782. By Sam Spilsbury

  Added a small ScreenSaverHandler class to monitor changes in screensaver
  state. Note that at the moment it doesn't work because gnome-screensaver
  doesn't emit the ActiveChanged signal until it gets the grab, and the whole
  purpose of this is to watch for ActiveChanged in order to release the grabs.

  Tests included show that the detection code works.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'manual-tests/ScreenSaverHandler.txt'
2--- manual-tests/ScreenSaverHandler.txt 1970-01-01 00:00:00 +0000
3+++ manual-tests/ScreenSaverHandler.txt 2011-12-20 01:44:25 +0000
4@@ -0,0 +1,34 @@
5+Launcher Hide after Screen Saver / Screen Lock
6+----------------------------------------------
7+This test shows the interaction between the screensaver and the Launcher.
8+
9+#. Start on a clean screen
10+#. Move the mouse pointer over a launcher icon
11+#. Make the screen lock (use Ctrl+Alt+L or use the proper dbus call like
12+ gdbus call -e -d org.gnome.ScreenSaver -o / -m org.gnome.ScreenSaver.Lock )
13+#. When the screen locking is active, move the mouse cursor on the center of the
14+ screen
15+
16+Outcome
17+ When unlocking the screen, the launcher should hide as the mouse is not any
18+ more over it.
19+ Performing the same action, leaving the mouse pointer over the launcher area
20+ should make the menus to show on unlock.
21+
22+
23+Panel Menus Hide after Screen Saver / Screen Lock
24+-------------------------------------------------
25+This test shows the interaction between the GlobalMenu and the Launcher.
26+
27+#. Start on a clean screen
28+#. Start an application that has menus and focus it
29+#. Move the mouse pointer over the top panel to make the menus show
30+#. Make the screen lock (use Ctrl+Alt+L or use the proper dbus call like
31+ gdbus call -e -d org.gnome.ScreenSaver -o / -m org.gnome.ScreenSaver.Lock )
32+#. When the screen locking is active, move the mouse cursor on the center of the
33+ screen
34+
35+Outcome
36+ When unlocking the screen, the menus should be hidden.
37+ Performing the same action, leaving the mouse pointer over the global menu
38+ area should make the menus to show on unlock.
39
40=== modified file 'plugins/unityshell/src/Launcher.cpp'
41--- plugins/unityshell/src/Launcher.cpp 2011-12-14 16:18:41 +0000
42+++ plugins/unityshell/src/Launcher.cpp 2011-12-20 01:44:25 +0000
43@@ -199,6 +199,9 @@
44
45 display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
46
47+ ss_handler_ = ScreenSaverHandler::Default();
48+ ss_handler_->state_change.connect(sigc::mem_fun(this, &Launcher::OnScreenSaverStateChanged));
49+
50 _current_icon = NULL;
51 _current_icon_index = -1;
52 _last_icon_index = -1;
53@@ -3202,6 +3205,24 @@
54 return NULL;
55 }
56
57+void
58+Launcher::OnScreenSaverStateChanged(bool active)
59+{
60+ if (!active)
61+ {
62+ nux::Point pt = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
63+ SetMousePosition(pt.x, pt.y);
64+
65+ if (!GetAbsoluteGeometry().IsInside(pt))
66+ {
67+ SetStateMouseOverLauncher(false);
68+ SetHover(false);
69+ EnsureAnimation();
70+ }
71+ }
72+}
73+
74+
75 /* dbus handlers */
76
77 void
78
79=== modified file 'plugins/unityshell/src/Launcher.h'
80--- plugins/unityshell/src/Launcher.h 2011-12-08 01:23:11 +0000
81+++ plugins/unityshell/src/Launcher.h 2011-12-20 01:44:25 +0000
82@@ -37,6 +37,7 @@
83 #include "LauncherDragWindow.h"
84 #include "LauncherHideMachine.h"
85 #include "LauncherHoverMachine.h"
86+#include "ScreenSaverHandler.h"
87
88 #define ANIM_DURATION_SHORT_SHORT 100
89 #define ANIM_DURATION_SHORT 125
90@@ -376,6 +377,8 @@
91
92 void OnDisplayChanged(Display* display);
93 void OnDNDDataCollected(const std::list<char*>& mimes);
94+
95+ void OnScreenSaverStateChanged(bool active);
96
97 void DndReset();
98 void DndHoveredIconReset();
99@@ -501,6 +504,8 @@
100
101 ui::AbstractIconRenderer::Ptr icon_renderer;
102 BackgroundEffectHelper bg_effect_helper_;
103+
104+ ScreenSaverHandler::Ptr ss_handler_;
105 };
106
107 }
108
109=== modified file 'plugins/unityshell/src/PanelMenuView.cpp'
110--- plugins/unityshell/src/PanelMenuView.cpp 2011-12-14 20:04:23 +0000
111+++ plugins/unityshell/src/PanelMenuView.cpp 2011-12-20 01:44:25 +0000
112@@ -173,6 +173,9 @@
113 SetOpacity(0.0f);
114 _window_buttons->SetOpacity(0.0f);
115
116+ _ss_handler = ScreenSaverHandler::Default();
117+ _ss_handler->state_change.connect(sigc::mem_fun(this, &PanelMenuView::OnScreenSaverStateChanged));
118+
119 Refresh();
120 FullRedraw();
121 }
122@@ -347,6 +350,18 @@
123 NeedRedraw();
124 }
125
126+void
127+PanelMenuView::OnScreenSaverStateChanged(bool active)
128+{
129+ if (!active)
130+ {
131+ auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
132+ _is_inside = GetAbsoluteGeometry().IsPointInside(mouse.x, mouse.y);
133+ _is_grabbed = false;
134+ FullRedraw();
135+ }
136+}
137+
138 bool
139 PanelMenuView::DrawMenus()
140 {
141
142=== modified file 'plugins/unityshell/src/PanelMenuView.h'
143--- plugins/unityshell/src/PanelMenuView.h 2011-12-14 20:04:23 +0000
144+++ plugins/unityshell/src/PanelMenuView.h 2011-12-20 01:44:25 +0000
145@@ -29,6 +29,7 @@
146 #include "WindowButtons.h"
147 #include "PanelTitlebarGrabAreaView.h"
148 #include "PluginAdapter.h"
149+#include "ScreenSaverHandler.h"
150 #include "Animator.h"
151
152 #include <UnityCore/GLibWrapper.h>
153@@ -138,6 +139,8 @@
154 void OnFadeInChanged(double);
155 void OnFadeOutChanged(double);
156
157+ void OnScreenSaverStateChanged(bool);
158+
159 private:
160 glib::Object<BamfMatcher> _matcher;
161
162@@ -194,6 +197,8 @@
163
164 Animator* _fade_in_animator;
165 Animator* _fade_out_animator;
166+
167+ ScreenSaverHandler::Ptr _ss_handler;
168 };
169
170 }