[gnome-games/wip/exalm/gtk4: 15/48] fullscreen-box: Stop using 'motion-notify-event' signal



commit 8508774bf8c665bdf136867eb0af84c92db5262f
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Jul 29 00:17:31 2018 +0500

    fullscreen-box: Stop using 'motion-notify-event' signal
    
    Use Gtk.EventControllerMotion instead.

 data/ui/fullscreen-box.ui  | 12 ++++++++++--
 src/ui/fullscreen-box.vala |  6 ++----
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/fullscreen-box.ui b/data/ui/fullscreen-box.ui
index 66e3abe7..1164c0fe 100644
--- a/data/ui/fullscreen-box.ui
+++ b/data/ui/fullscreen-box.ui
@@ -4,7 +4,11 @@
   <template class="GamesFullscreenBox" parent="GtkEventBox">
     <property name="visible">True</property>
     <property name="events">pointer-motion-mask</property>
-    <signal name="motion-notify-event" handler="on_motion_event"/>
+    <child>
+      <object class="GtkEventControllerMotion">
+        <signal name="motion" handler="on_motion_event"/>
+      </object>
+    </child>
     <child>
       <object class="GtkOverlay" id="overlay">
         <property name="visible">True</property>
@@ -16,7 +20,11 @@
             <property name="transition-type">slide-down</property>
             <property name="transition-duration">500</property>
             <property name="events">pointer-motion-mask</property>
-            <signal name="motion-notify-event" handler="on_motion_event"/>
+            <child>
+              <object class="GtkEventControllerMotion">
+                <signal name="motion" handler="on_motion_event"/>
+              </object>
+            </child>
           </object>
         </child>
       </object>
diff --git a/src/ui/fullscreen-box.vala b/src/ui/fullscreen-box.vala
index 1bfce112..27af107e 100644
--- a/src/ui/fullscreen-box.vala
+++ b/src/ui/fullscreen-box.vala
@@ -106,16 +106,14 @@ private class Games.FullscreenBox : Gtk.EventBox, Gtk.Buildable {
        }
 
        [GtkCallback]
-       private bool on_motion_event (Gdk.EventMotion event) {
+       private void on_motion_event (Gtk.EventControllerMotion controller, double x, double y) {
                if (!autohide)
-                       return false;
+                       return;
 
                if (event.y_root <= SHOW_HEADERBAR_DISTANCE)
                        show_ui ();
 
                on_cursor_moved ();
-
-               return false;
        }
 
        private void show_ui () {


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