Merge lp:~azzar1/unity/fix-687956-682787 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Merged at revision: 1215
Proposed branch: lp:~azzar1/unity/fix-687956-682787
Merge into: lp:unity
Diff against target: 158 lines (+58/-11)
3 files modified
src/Launcher.cpp (+1/-0)
src/LauncherIcon.cpp (+52/-11)
src/LauncherIcon.h (+5/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-687956-682787
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+62729@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2011-05-26 13:11:05 +0000
3+++ src/Launcher.cpp 2011-05-27 20:08:24 +0000
4@@ -3130,6 +3130,7 @@
5 {
6 SetMousePosition (x, y);
7 SetStateMouseOverLauncher (false);
8+ LauncherIcon::SetSkipTooltipDelay (false);
9
10 EventLogic ();
11 EnsureAnimation ();
12
13=== modified file 'src/LauncherIcon.cpp'
14--- src/LauncherIcon.cpp 2011-05-23 09:51:57 +0000
15+++ src/LauncherIcon.cpp 2011-05-27 20:08:24 +0000
16@@ -54,6 +54,7 @@
17
18 int LauncherIcon::_current_theme_is_mono = -1;
19 GtkIconTheme *LauncherIcon::_unity_theme = NULL;
20+gboolean LauncherIcon::_skip_tooltip_delay = false;
21
22 LauncherIcon::LauncherIcon(Launcher* launcher)
23 {
24@@ -92,6 +93,7 @@
25 _present_time_handle = 0;
26 _center_stabilize_handle = 0;
27 _time_delay_handle = 0;
28+ _tooltip_delay_handle = 0;
29
30
31 // FIXME: the abstraction is already broken, should be fixed for O
32@@ -129,6 +131,10 @@
33 if (_time_delay_handle)
34 g_source_remove (_time_delay_handle);
35 _time_delay_handle = 0;
36+
37+ if (_tooltip_delay_handle)
38+ g_source_remove (_tooltip_delay_handle);
39+ _tooltip_delay_handle = 0;
40
41 if (_superkey_label)
42 _superkey_label->UnReference ();
43@@ -471,6 +477,33 @@
44 }
45
46 void
47+LauncherIcon::SetSkipTooltipDelay (gboolean skip_tooltip_delay)
48+{
49+ _skip_tooltip_delay = skip_tooltip_delay;
50+}
51+
52+gboolean
53+LauncherIcon::OnTooltipTimeout (gpointer data)
54+{
55+ LauncherIcon *self = (LauncherIcon *) data;
56+
57+ nux::Geometry geo = self->_launcher->GetAbsoluteGeometry ();
58+ int tip_x = geo.x + geo.width + 1;
59+ int tip_y = geo.y + self->_center.y;
60+
61+ self->_tooltip->ShowTooltipWithTipAt (tip_x, tip_y);
62+
63+ if (!self->_quicklist->IsVisible ())
64+ {
65+ self->_tooltip->ShowWindow (!self->m_TooltipText.IsEmpty ());
66+ _skip_tooltip_delay = true;
67+ }
68+
69+ self->_tooltip_delay_handle = 0;
70+ return false;
71+}
72+
73+void
74 LauncherIcon::RecvMouseEnter ()
75 {
76 if (QuicklistManager::Default ()->Current ())
77@@ -479,25 +512,28 @@
78 return;
79 }
80
81- nux::Geometry geo = _launcher->GetAbsoluteGeometry ();
82- int tip_x = geo.x + geo.width + 1;
83- int tip_y = geo.y + _center.y;
84-
85- _tooltip->ShowTooltipWithTipAt (tip_x, tip_y);
86-
87- if (!_quicklist->IsVisible ())
88- {
89- _tooltip->ShowWindow (true);
90- }
91+ if (!_skip_tooltip_delay)
92+ _tooltip_delay_handle = g_timeout_add (1000, &LauncherIcon::OnTooltipTimeout, this);
93+ else
94+ OnTooltipTimeout (this);
95 }
96
97 void LauncherIcon::RecvMouseLeave ()
98-{
99+{
100+ if (_tooltip_delay_handle)
101+ g_source_remove (_tooltip_delay_handle);
102+ _tooltip_delay_handle = 0;
103+
104 _tooltip->ShowWindow (false);
105 }
106
107 gboolean LauncherIcon::OpenQuicklist (bool default_to_first_item)
108 {
109+ if (_tooltip_delay_handle)
110+ g_source_remove (_tooltip_delay_handle);
111+ _tooltip_delay_handle = 0;
112+ _skip_tooltip_delay = false;
113+
114 _tooltip->ShowWindow (false);
115 _quicklist->RemoveAllMenuItem ();
116
117@@ -579,6 +615,11 @@
118
119 void LauncherIcon::HideTooltip ()
120 {
121+ if (_tooltip_delay_handle)
122+ g_source_remove (_tooltip_delay_handle);
123+ _tooltip_delay_handle = 0;
124+ _skip_tooltip_delay = false;
125+
126 _tooltip->ShowWindow (false);
127 }
128
129
130=== modified file 'src/LauncherIcon.h'
131--- src/LauncherIcon.h 2011-04-20 09:40:45 +0000
132+++ src/LauncherIcon.h 2011-05-27 20:08:24 +0000
133@@ -149,6 +149,8 @@
134 void SendDndEnter () { OnDndEnter (); }
135 void SendDndLeave () { OnDndLeave (); }
136
137+ static void SetSkipTooltipDelay (gboolean skip_tooltip_delay);
138+
139 sigc::signal<void, int> MouseDown;
140 sigc::signal<void, int> MouseUp;
141 sigc::signal<void> MouseEnter;
142@@ -258,6 +260,7 @@
143 static gboolean OnPresentTimeout (gpointer data);
144 static gboolean OnCenterTimeout (gpointer data);
145 static gboolean OnDelayedUpdateTimeout (gpointer data);
146+ static gboolean OnTooltipTimeout (gpointer data);
147
148 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);
149
150@@ -270,6 +273,8 @@
151 guint _present_time_handle;
152 guint _center_stabilize_handle;
153 guint _time_delay_handle;
154+ guint _tooltip_delay_handle;
155+ static gboolean _skip_tooltip_delay;
156 bool _quicklist_is_initialized;
157 bool _has_visible_window;
158 bool _remote_urgent;