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
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2011-05-26 13:11:05 +0000
+++ src/Launcher.cpp 2011-05-27 20:08:24 +0000
@@ -3130,6 +3130,7 @@
3130{3130{
3131 SetMousePosition (x, y);3131 SetMousePosition (x, y);
3132 SetStateMouseOverLauncher (false);3132 SetStateMouseOverLauncher (false);
3133 LauncherIcon::SetSkipTooltipDelay (false);
31333134
3134 EventLogic ();3135 EventLogic ();
3135 EnsureAnimation ();3136 EnsureAnimation ();
31363137
=== modified file 'src/LauncherIcon.cpp'
--- src/LauncherIcon.cpp 2011-05-23 09:51:57 +0000
+++ src/LauncherIcon.cpp 2011-05-27 20:08:24 +0000
@@ -54,6 +54,7 @@
5454
55int LauncherIcon::_current_theme_is_mono = -1;55int LauncherIcon::_current_theme_is_mono = -1;
56GtkIconTheme *LauncherIcon::_unity_theme = NULL;56GtkIconTheme *LauncherIcon::_unity_theme = NULL;
57gboolean LauncherIcon::_skip_tooltip_delay = false;
5758
58LauncherIcon::LauncherIcon(Launcher* launcher)59LauncherIcon::LauncherIcon(Launcher* launcher)
59{60{
@@ -92,6 +93,7 @@
92 _present_time_handle = 0;93 _present_time_handle = 0;
93 _center_stabilize_handle = 0;94 _center_stabilize_handle = 0;
94 _time_delay_handle = 0;95 _time_delay_handle = 0;
96 _tooltip_delay_handle = 0;
95 97
9698
97 // FIXME: the abstraction is already broken, should be fixed for O99 // FIXME: the abstraction is already broken, should be fixed for O
@@ -129,6 +131,10 @@
129 if (_time_delay_handle)131 if (_time_delay_handle)
130 g_source_remove (_time_delay_handle);132 g_source_remove (_time_delay_handle);
131 _time_delay_handle = 0;133 _time_delay_handle = 0;
134
135 if (_tooltip_delay_handle)
136 g_source_remove (_tooltip_delay_handle);
137 _tooltip_delay_handle = 0;
132138
133 if (_superkey_label)139 if (_superkey_label)
134 _superkey_label->UnReference ();140 _superkey_label->UnReference ();
@@ -471,6 +477,33 @@
471}477}
472478
473void479void
480LauncherIcon::SetSkipTooltipDelay (gboolean skip_tooltip_delay)
481{
482 _skip_tooltip_delay = skip_tooltip_delay;
483}
484
485gboolean
486LauncherIcon::OnTooltipTimeout (gpointer data)
487{
488 LauncherIcon *self = (LauncherIcon *) data;
489
490 nux::Geometry geo = self->_launcher->GetAbsoluteGeometry ();
491 int tip_x = geo.x + geo.width + 1;
492 int tip_y = geo.y + self->_center.y;
493
494 self->_tooltip->ShowTooltipWithTipAt (tip_x, tip_y);
495
496 if (!self->_quicklist->IsVisible ())
497 {
498 self->_tooltip->ShowWindow (!self->m_TooltipText.IsEmpty ());
499 _skip_tooltip_delay = true;
500 }
501
502 self->_tooltip_delay_handle = 0;
503 return false;
504}
505
506void
474LauncherIcon::RecvMouseEnter ()507LauncherIcon::RecvMouseEnter ()
475{508{
476 if (QuicklistManager::Default ()->Current ())509 if (QuicklistManager::Default ()->Current ())
@@ -479,25 +512,28 @@
479 return;512 return;
480 }513 }
481 514
482 nux::Geometry geo = _launcher->GetAbsoluteGeometry ();515 if (!_skip_tooltip_delay)
483 int tip_x = geo.x + geo.width + 1;516 _tooltip_delay_handle = g_timeout_add (1000, &LauncherIcon::OnTooltipTimeout, this);
484 int tip_y = geo.y + _center.y;517 else
485 518 OnTooltipTimeout (this);
486 _tooltip->ShowTooltipWithTipAt (tip_x, tip_y);
487
488 if (!_quicklist->IsVisible ())
489 {
490 _tooltip->ShowWindow (true);
491 }
492}519}
493520
494void LauncherIcon::RecvMouseLeave ()521void LauncherIcon::RecvMouseLeave ()
495{522{
523 if (_tooltip_delay_handle)
524 g_source_remove (_tooltip_delay_handle);
525 _tooltip_delay_handle = 0;
526
496 _tooltip->ShowWindow (false);527 _tooltip->ShowWindow (false);
497}528}
498529
499gboolean LauncherIcon::OpenQuicklist (bool default_to_first_item)530gboolean LauncherIcon::OpenQuicklist (bool default_to_first_item)
500{531{
532 if (_tooltip_delay_handle)
533 g_source_remove (_tooltip_delay_handle);
534 _tooltip_delay_handle = 0;
535 _skip_tooltip_delay = false;
536
501 _tooltip->ShowWindow (false); 537 _tooltip->ShowWindow (false);
502 _quicklist->RemoveAllMenuItem ();538 _quicklist->RemoveAllMenuItem ();
503539
@@ -579,6 +615,11 @@
579615
580void LauncherIcon::HideTooltip ()616void LauncherIcon::HideTooltip ()
581{617{
618 if (_tooltip_delay_handle)
619 g_source_remove (_tooltip_delay_handle);
620 _tooltip_delay_handle = 0;
621 _skip_tooltip_delay = false;
622
582 _tooltip->ShowWindow (false);623 _tooltip->ShowWindow (false);
583}624}
584625
585626
=== modified file 'src/LauncherIcon.h'
--- src/LauncherIcon.h 2011-04-20 09:40:45 +0000
+++ src/LauncherIcon.h 2011-05-27 20:08:24 +0000
@@ -149,6 +149,8 @@
149 void SendDndEnter () { OnDndEnter (); }149 void SendDndEnter () { OnDndEnter (); }
150 void SendDndLeave () { OnDndLeave (); }150 void SendDndLeave () { OnDndLeave (); }
151 151
152 static void SetSkipTooltipDelay (gboolean skip_tooltip_delay);
153
152 sigc::signal<void, int> MouseDown;154 sigc::signal<void, int> MouseDown;
153 sigc::signal<void, int> MouseUp;155 sigc::signal<void, int> MouseUp;
154 sigc::signal<void> MouseEnter;156 sigc::signal<void> MouseEnter;
@@ -258,6 +260,7 @@
258 static gboolean OnPresentTimeout (gpointer data);260 static gboolean OnPresentTimeout (gpointer data);
259 static gboolean OnCenterTimeout (gpointer data);261 static gboolean OnCenterTimeout (gpointer data);
260 static gboolean OnDelayedUpdateTimeout (gpointer data);262 static gboolean OnDelayedUpdateTimeout (gpointer data);
263 static gboolean OnTooltipTimeout (gpointer data);
261264
262 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);265 void ColorForIcon (GdkPixbuf *pixbuf, nux::Color &background, nux::Color &glow);
263266
@@ -270,6 +273,8 @@
270 guint _present_time_handle;273 guint _present_time_handle;
271 guint _center_stabilize_handle;274 guint _center_stabilize_handle;
272 guint _time_delay_handle;275 guint _time_delay_handle;
276 guint _tooltip_delay_handle;
277 static gboolean _skip_tooltip_delay;
273 bool _quicklist_is_initialized;278 bool _quicklist_is_initialized;
274 bool _has_visible_window;279 bool _has_visible_window;
275 bool _remote_urgent;280 bool _remote_urgent;