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



commit 3726a67cd08de0c4bf825b6cb1ec46112c7c52ce
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 8c4b23df..545e05b9 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 9b2eaf4f..30603baf 100644
--- a/src/ui/fullscreen-box.vala
+++ b/src/ui/fullscreen-box.vala
@@ -109,16 +109,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]