[california/wip/731635-hotspot] Reset cursor on enter/exit widget space



commit cd19991ba04f4b185378651e42364bcd706f8289
Author: Jim Nelson <jim yorba org>
Date:   Fri Sep 19 16:12:46 2014 -0700

    Reset cursor on enter/exit widget space

 src/view/month/month-grid.vala |    7 +++++++
 src/view/week/week-grid.vala   |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/view/month/month-grid.vala b/src/view/month/month-grid.vala
index 6b48b1e..47444d2 100644
--- a/src/view/month/month-grid.vala
+++ b/src/view/month/month-grid.vala
@@ -66,6 +66,8 @@ private class Grid : Gtk.Grid {
         
         cell_button_connector.clicked.connect(on_cell_single_click);
         cell_button_connector.double_clicked.connect(on_cell_double_click);
+        cell_motion_connector.entered.connect(on_cell_entered_exited);
+        cell_motion_connector.exited.connect(on_cell_entered_exited);
         cell_motion_connector.motion.connect(on_cell_motion);
         cell_motion_connector.button_motion.connect(on_cell_button_motion);
         
@@ -356,6 +358,11 @@ private class Grid : Gtk.Grid {
         return Toolkit.STOP;
     }
     
+    private void on_cell_entered_exited(Toolkit.MotionEvent details) {
+        // when entering or leaving cell, reset the cursor
+        Toolkit.set_toplevel_cursor(details.widget, null);
+    }
+    
     private void on_cell_motion(Toolkit.MotionEvent details) {
         Cell cell = (Cell) details.widget;
         
diff --git a/src/view/week/week-grid.vala b/src/view/week/week-grid.vala
index f49adb3..9ee6a7a 100644
--- a/src/view/week/week-grid.vala
+++ b/src/view/week/week-grid.vala
@@ -150,8 +150,13 @@ internal class Grid : Gtk.Box {
         instance_container_button_connector.double_clicked.connect(on_instance_container_double_clicked);
         
         // connect to individual motion event handlers for different types of instance containers
+        all_day_cell_motion_connector.entered.connect(on_instance_container_entered_exited);
+        all_day_cell_motion_connector.exited.connect(on_instance_container_entered_exited);
         all_day_cell_motion_connector.motion.connect(on_instance_container_motion);
         all_day_cell_motion_connector.button_motion.connect(on_all_day_cell_button_motion);
+        
+        day_pane_motion_connector.entered.connect(on_instance_container_entered_exited);
+        day_pane_motion_connector.exited.connect(on_instance_container_entered_exited);
         day_pane_motion_connector.motion.connect(on_instance_container_motion);
         day_pane_motion_connector.button_motion.connect(on_day_pane_button_motion);
         
@@ -359,6 +364,11 @@ internal class Grid : Gtk.Box {
         Toolkit.set_toplevel_cursor(instance_container, cursor_type);
     }
     
+    private void on_instance_container_entered_exited(Toolkit.MotionEvent details) {
+        // when entering or leaving instance container (all day cell or day pane), reset the cursor
+        Toolkit.set_toplevel_cursor(details.widget, null);
+    }
+    
     private bool on_instance_container_double_clicked(Toolkit.ButtonEvent details) {
         if (details.button != Toolkit.Button.PRIMARY)
             return Toolkit.PROPAGATE;


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