Merge lp:~aacid/unity-2d/DoNotHideLauncherImmediatellyOnIconRemoval_884410 into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 790
Merged at revision: 803
Proposed branch: lp:~aacid/unity-2d/DoNotHideLauncherImmediatellyOnIconRemoval_884410
Merge into: lp:unity-2d
Diff against target: 68 lines (+23/-4)
2 files modified
launcher/app/visibilitycontroller.cpp (+16/-3)
launcher/app/visibilitycontroller.h (+7/-1)
To merge this branch: bzr merge lp:~aacid/unity-2d/DoNotHideLauncherImmediatellyOnIconRemoval_884410
Reviewer Review Type Date Requested Status
Gerry Boland (community) functional Approve
Tiago Salem Herrmann (community) Approve
Review via email: mp+83312@code.launchpad.net

Commit message

[launcher] Do not hide the launcher immediately after removing an icon

Description of the change

This is a tricky one. this is my observation of the issue:
 * User clicks RMB in a tile
 * User gets the menu
 * We call VisibilityController::beginForceVisible
 * User goes to the menu (i.e. outside of the launcher)
 * User clicks remove from launcher
 * Menu closes
 * We call VisibilityController::endForceVisible
 * This recreates the IntelliHideBehavior that then sees there is something under the panel and hides it

My fix is, after recreating the IntelliHideBehavior if we are coming from the situation that the visibility forcing ended and the mouse cursor is outside the panel, we show the panel and start the 1 second timer, to achieve the same effect on removing items that Unity3D has.

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Until we get automated testing going, I need to ask you to write unit test to test this fix, and place them in https://wiki.ubuntu.com/Unity2DRegressionTests

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks like a good solution, and the patch looks clean to me.

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

> Until we get automated testing going, I need to ask you to write unit test to
> test this fix, and place them in
> https://wiki.ubuntu.com/Unity2DRegressionTests

Text added to https://wiki.ubuntu.com/Unity2DRegressionTests

Revision history for this message
Gerry Boland (gerboland) wrote :

Works real nice, I approve

review: Approve (functional)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/app/visibilitycontroller.cpp'
2--- launcher/app/visibilitycontroller.cpp 2011-11-18 10:15:49 +0000
3+++ launcher/app/visibilitycontroller.cpp 2011-11-24 15:36:26 +0000
4@@ -54,7 +54,7 @@
5 {
6 }
7
8-void VisibilityController::update()
9+void VisibilityController::update(UpdateReason reason)
10 {
11 if (!m_forceVisibleCountHash.isEmpty()) {
12 return;
13@@ -76,6 +76,19 @@
14 break;
15 case IntelliHide:
16 setBehavior(new IntelliHideBehavior(m_panel));
17+ if (reason == UpdateFromForceVisibilityEnded && !m_panel->geometry().contains(QCursor::pos())) {
18+ // The first thing IntelliHideBehavior does is checking if there is
19+ // a window behind the panel, and if there is one, hide the panel immediately
20+ // This is correct for some cases, but in the case we come from an update because the
21+ // panel is not forced visible anymore and the mouse is not in the panel,
22+ // i.e. the launcher was visible and the user clicked in an action of the tile menu,
23+ // we should still give the user the wait 1 second before hiding behaviour.
24+ // To achieve this we tell the behaviour controller to show the panel
25+ // and simulate a mouse leave on the panel to start the hiding timer
26+ QMetaObject::invokeMethod(m_behavior.data(), "showPanel");
27+ QEvent e(QEvent::Leave);
28+ QCoreApplication::sendEvent(m_panel, &e);
29+ }
30 break;
31 }
32 }
33@@ -110,7 +123,7 @@
34 UQ_WARNING << "Application" << service << "called endForceVisible() more than beginForceVisible().";
35 }
36 if (m_forceVisibleCountHash.isEmpty()) {
37- update();
38+ update(UpdateFromForceVisibilityEnded);
39 }
40 }
41
42@@ -145,6 +158,6 @@
43 m_forceVisibleCountHash.remove(service);
44 m_dbusWatcher->removeWatchedService(service);
45 if (m_forceVisibleCountHash.isEmpty()) {
46- update();
47+ update(UpdateFromForceVisibilityEnded);
48 }
49 }
50
51=== modified file 'launcher/app/visibilitycontroller.h'
52--- launcher/app/visibilitycontroller.h 2011-11-18 10:15:49 +0000
53+++ launcher/app/visibilitycontroller.h 2011-11-24 15:36:26 +0000
54@@ -62,8 +62,14 @@
55 Q_INVOKABLE void beginForceVisible(const QString& service = QString());
56 Q_INVOKABLE void endForceVisible(const QString& service = QString());
57
58+private:
59+ enum UpdateReason {
60+ RegularUpdate,
61+ UpdateFromForceVisibilityEnded
62+ };
63+
64 private Q_SLOTS:
65- void update();
66+ void update(UpdateReason reason = RegularUpdate);
67 void slotServiceUnregistered(const QString&);
68 void updatePanelVisibility(bool);
69

Subscribers

People subscribed via source and target branches