Merge lp:~azzar1/unity/fix-978030-5.0 into lp:unity/5.0

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2351
Proposed branch: lp:~azzar1/unity/fix-978030-5.0
Merge into: lp:unity/5.0
Diff against target: 197 lines (+78/-2)
9 files modified
plugins/unityshell/src/AbstractLauncherIcon.h (+1/-0)
plugins/unityshell/src/BFBLauncherIcon.cpp (+1/-0)
plugins/unityshell/src/HudLauncherIcon.cpp (+1/-0)
plugins/unityshell/src/Launcher.cpp (+4/-1)
plugins/unityshell/src/LauncherIcon.cpp (+10/-1)
plugins/unityshell/src/LauncherIcon.h (+2/-0)
tests/autopilot/autopilot/emulators/unity/icons.py (+11/-0)
tests/autopilot/autopilot/emulators/unity/tooltip.py (+20/-0)
tests/autopilot/autopilot/tests/test_launcher.py (+28/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-978030-5.0
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Łukasz Zemczak Approve
Review via email: mp+106995@code.launchpad.net

Commit message

Backported fix from lp:unity/6.0 - Dash - search field is hidden by tooltips (LP: #978030).

Description of the change

Original MRQ:

== Problem ==
Dash - search field is hidden by tooltips

== Fix ==
Disable the bfb/hudlaunchericon tooltip when the dash/hud is open.
Hide a launcher icon tooltip as soon as the dash/hud is shown.

== Test ==
2 AP tests added. The tooltip class is empty for the moment.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

+1

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) :
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/AbstractLauncherIcon.h'
2--- plugins/unityshell/src/AbstractLauncherIcon.h 2012-04-25 00:32:14 +0000
3+++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-05-23 12:20:23 +0000
4@@ -119,6 +119,7 @@
5 virtual ~AbstractLauncherIcon() {}
6
7 nux::Property<std::string> tooltip_text;
8+ nux::Property<bool> tooltip_enabled;
9
10 virtual void HideTooltip() = 0;
11
12
13=== modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp'
14--- plugins/unityshell/src/BFBLauncherIcon.cpp 2012-04-19 22:46:07 +0000
15+++ plugins/unityshell/src/BFBLauncherIcon.cpp 2012-05-23 12:20:23 +0000
16@@ -65,6 +65,7 @@
17
18 if (overlay_identity.Str() == "dash" && IsVisibleOnMonitor(overlay_monitor))
19 {
20+ tooltip_enabled = !visible;
21 SetQuirk(QUIRK_ACTIVE, visible);
22 EmitNeedsRedraw();
23 }
24
25=== modified file 'plugins/unityshell/src/HudLauncherIcon.cpp'
26--- plugins/unityshell/src/HudLauncherIcon.cpp 2012-04-24 13:22:42 +0000
27+++ plugins/unityshell/src/HudLauncherIcon.cpp 2012-05-23 12:20:23 +0000
28@@ -101,6 +101,7 @@
29 SetMonitor(overlay_monitor);
30 SetQuirk(QUIRK_VISIBLE, visible);
31 SetQuirk(QUIRK_ACTIVE, visible);
32+ tooltip_enabled = !visible;
33 EmitNeedsRedraw();
34 }
35 }
36
37=== modified file 'plugins/unityshell/src/Launcher.cpp'
38--- plugins/unityshell/src/Launcher.cpp 2012-04-24 22:21:03 +0000
39+++ plugins/unityshell/src/Launcher.cpp 2012-05-23 12:20:23 +0000
40@@ -1340,7 +1340,7 @@
41 gint32 overlay_monitor = 0;
42 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
43 &overlay_identity, &can_maximise, &overlay_monitor);
44- std::string identity = overlay_identity.Str();
45+ std::string identity(overlay_identity.Str());
46
47 LOG_DEBUG(logger) << "Overlay shown: " << identity
48 << ", " << (can_maximise ? "can maximise" : "can't maximise")
49@@ -1366,6 +1366,9 @@
50 LOG_DEBUG(logger) << "Desaturate on monitor " << monitor();
51 DesaturateIcons();
52 }
53+
54+ if (_icon_under_mouse)
55+ _icon_under_mouse->HideTooltip();
56 }
57 EnsureAnimation();
58 }
59
60=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
61--- plugins/unityshell/src/LauncherIcon.cpp 2012-04-24 18:09:33 +0000
62+++ plugins/unityshell/src/LauncherIcon.cpp 2012-05-23 12:20:23 +0000
63@@ -99,6 +99,9 @@
64 for (int i = 0; i < max_num_monitors; ++i)
65 _is_visible_on_monitor[i] = true;
66
67+ tooltip_enabled = true;
68+ tooltip_enabled.changed.connect(sigc::mem_fun(this, &LauncherIcon::OnTooltipEnabledChanged));
69+
70 tooltip_text.SetSetterFunction(sigc::mem_fun(this, &LauncherIcon::SetTooltipText));
71 tooltip_text = "blank";
72
73@@ -481,6 +484,12 @@
74 return result;
75 }
76
77+void LauncherIcon::OnTooltipEnabledChanged(bool value)
78+{
79+ if (!value)
80+ HideTooltip();
81+}
82+
83 void
84 LauncherIcon::SetShortcut(guint64 shortcut)
85 {
86@@ -499,7 +508,7 @@
87 void
88 LauncherIcon::ShowTooltip()
89 {
90- if (_quicklist && _quicklist->IsVisible())
91+ if (!tooltip_enabled || (_quicklist && _quicklist->IsVisible()))
92 return;
93
94 int tip_x = 100;
95
96=== modified file 'plugins/unityshell/src/LauncherIcon.h'
97--- plugins/unityshell/src/LauncherIcon.h 2012-04-24 22:21:03 +0000
98+++ plugins/unityshell/src/LauncherIcon.h 2012-05-23 12:20:23 +0000
99@@ -324,6 +324,8 @@
100 void LoadTooltip();
101 void LoadQuicklist();
102
103+ void OnTooltipEnabledChanged(bool value);
104+
105 bool _remote_urgent;
106 float _present_urgency;
107 float _progress;
108
109=== modified file 'tests/autopilot/autopilot/emulators/unity/icons.py'
110--- tests/autopilot/autopilot/emulators/unity/icons.py 2012-05-21 15:29:34 +0000
111+++ tests/autopilot/autopilot/emulators/unity/icons.py 2012-05-23 12:20:23 +0000
112@@ -9,6 +9,7 @@
113
114 from autopilot.emulators.unity import UnityIntrospectionObject
115 from autopilot.emulators.unity.quicklist import Quicklist
116+from autopilot.emulators.unity.tooltip import ToolTip
117
118 class SimpleLauncherIcon(UnityIntrospectionObject):
119 """Holds information about a simple launcher icon.
120@@ -33,6 +34,16 @@
121 matches = self.get_children_by_type(Quicklist)
122 return matches[0] if matches else None
123
124+ def get_tooltip(self):
125+ """Get the tooltip for this launcher icon.
126+
127+ This may return None, if there is no tooltip associated with this
128+ launcher icon.
129+
130+ """
131+ matches = self.get_children_by_type(ToolTip)
132+ return matches[0] if matches else None
133+
134 def is_on_monitor(self, monitor):
135 """Returns True if the icon is available in the defined monitor."""
136 if monitor >= 0 and monitor < len(self.monitors_visibility):
137
138=== added file 'tests/autopilot/autopilot/emulators/unity/tooltip.py'
139--- tests/autopilot/autopilot/emulators/unity/tooltip.py 1970-01-01 00:00:00 +0000
140+++ tests/autopilot/autopilot/emulators/unity/tooltip.py 2012-05-23 12:20:23 +0000
141@@ -0,0 +1,20 @@
142+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
143+# Copyright 2012 Canonical
144+# Author: Andrea Azzarone
145+#
146+# This program is free software: you can redistribute it and/or modify it
147+# under the terms of the GNU General Public License version 3, as published
148+# by the Free Software Foundation.
149+#
150+
151+import logging
152+from time import sleep
153+
154+from autopilot.emulators.unity import UnityIntrospectionObject
155+
156+
157+logger = logging.getLogger(__name__)
158+
159+
160+class ToolTip(UnityIntrospectionObject):
161+ """Represents a tooltip."""
162
163=== modified file 'tests/autopilot/autopilot/tests/test_launcher.py'
164--- tests/autopilot/autopilot/tests/test_launcher.py 2012-05-21 15:30:30 +0000
165+++ tests/autopilot/autopilot/tests/test_launcher.py 2012-05-23 12:20:23 +0000
166@@ -779,3 +779,31 @@
167 x_fin, y_fin = self.mouse.position()
168 # The launcher should have held the mouse a little bit
169 self.assertThat(x_fin, LessThan(x + width * 1.5))
170+
171+
172+class LauncherTooltipTests(AutopilotTestCase):
173+ """Test the launcher tooltips"""
174+
175+ def setUp(self):
176+ super(LauncherTooltipTests, self).setUp()
177+ self.set_unity_option('launcher_hide_mode', 0)
178+
179+ def test_bfb_tooltip_disappear_when_dash_is_opened(self):
180+ """Tests that the bfb tooltip disappear when the dash is opened."""
181+ bfb = self.launcher.model.get_bfb_icon()
182+ self.mouse.move(bfb.center_x, bfb.center_y)
183+
184+ self.dash.ensure_visible()
185+ self.addCleanup(self.dash.ensure_hidden)
186+
187+ self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))
188+
189+ def test_bfb_tooltip_is_disabled_when_dash_is_open(self):
190+ """Tests the that bfb tooltip is disabled when the dash is open."""
191+ self.dash.ensure_visible()
192+ self.addCleanup(self.dash.ensure_hidden)
193+
194+ bfb = self.launcher.model.get_bfb_icon()
195+ self.mouse.move(bfb.center_x, bfb.center_y)
196+
197+ self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))

Subscribers

People subscribed via source and target branches

to all changes: