[banshee] Don't hide the track info popup while it has focus (bgo#544592)



commit 87d12ec3aa415866a7cda49c1d5a56330197683a
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Tue Jun 16 10:50:37 2009 +1000

    Don't hide the track info popup while it has focus (bgo#544592)

 .../X11NotificationAreaBox.cs                      |   26 ++++++++++++++++++-
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
index 16d587c..5783967 100644
--- a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
+++ b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
@@ -51,6 +51,7 @@ namespace Banshee.NotificationArea
         private TrackInfoPopup popup;
         private bool can_show_popup = false;
         private bool cursor_over_trayicon = false;
+        private bool hide_delay_started = false;
         private int panel_size;
         
         public event EventHandler Disconnected;
@@ -216,6 +217,16 @@ namespace Banshee.NotificationArea
             }
             
             popup = new TrackInfoPopup ();
+            popup.EnterNotifyEvent += delegate {
+                hide_delay_started = false;
+            };
+            popup.LeaveNotifyEvent += delegate(object o, LeaveNotifyEventArgs args) {
+                Gdk.Rectangle rect;
+                if (!popup.Intersect (new Gdk.Rectangle ((int)args.Event.X, (int)args.Event.Y, 1, 1), out rect)) {
+                    OnLeaveNotifyEvent (o, args);
+                }
+            };
+
             PositionPopup ();
 
             popup.Show ();
@@ -301,6 +312,7 @@ namespace Banshee.NotificationArea
         
         private void OnEnterNotifyEvent (object o, EnterNotifyEventArgs args) 
         {
+            hide_delay_started = false;
             cursor_over_trayicon = true;
             if (can_show_popup) {
                 // only show the popup when the cursor is still over the
@@ -316,8 +328,18 @@ namespace Banshee.NotificationArea
         
         private void OnLeaveNotifyEvent (object o, LeaveNotifyEventArgs args) 
         {
-            cursor_over_trayicon = false;
-            HidePopup ();
+            // Give the user half a second to move the mouse cursor to the popup.
+            if (!hide_delay_started) {
+                hide_delay_started = true;
+                GLib.Timeout.Add (500, delegate {
+                    if (hide_delay_started) {
+                        hide_delay_started = false;
+                        cursor_over_trayicon = false;
+                        HidePopup ();
+                    }
+                    return false;
+                });
+            }
         }
         
         public void OnPlayerEvent (PlayerEventArgs args)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]