[gnome-boxes] collection-view: No prelight after mouse leaves view



commit d3f79d6fb5da1bb5966e8aaca6ea63e34f0c4a44
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 5 18:46:45 2014 +0000

    collection-view: No prelight after mouse leaves view
    
    It can easily happen that user quickly moves the mouse away from the
    view soon after hovering over a box and therefore us never getting the
    'motion-notify-event'. As a result we don't get to remove the prelight.
    
    This patch fixes that.

 src/collection-view.vala |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index dbbb620..6299550 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -279,7 +279,11 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
         selection_mode_request.connect (() => {
             App.app.selection_mode = true;
         });
-        (get_generic_view () as Gtk.IconView).motion_notify_event.connect (on_motion_notify);
+        var icon_view = get_generic_view () as Gtk.IconView;
+        icon_view.add_events (Gdk.EventMask.LEAVE_NOTIFY_MASK);
+        icon_view.motion_notify_event.connect (on_motion_notify);
+        icon_view.leave_notify_event.connect (on_leave_notify);
+
         show_all ();
     }
 
@@ -366,4 +370,16 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
 
         return false;
     }
+
+    private bool on_leave_notify (Gtk.Widget widget,
+                                  Gdk.Event  event) {
+        if (prelight_iter == null)
+            return false;
+
+        var iter = prelight_iter;
+        prelight_iter = null;
+        update_screenshot (iter);
+
+        return false;
+    }
 }


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