[gnome-games/wip/exalm/gtk4: 17/35] ui: Stop using 'motion-notify-event' signal



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

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

 data/ui/display-box.ui  | 12 ++++++++++--
 src/ui/display-box.vala |  4 +---
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/display-box.ui b/data/ui/display-box.ui
index 3ec046ab..dbef4a0c 100644
--- a/data/ui/display-box.ui
+++ b/data/ui/display-box.ui
@@ -5,7 +5,11 @@
     <property name="visible">True</property>
     <property name="events">GDK_POINTER_MOTION_MASK</property>
     <signal name="notify::is-fullscreen" handler="on_fullscreen_changed"/>
-    <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>
@@ -17,7 +21,11 @@
             <property name="transition-type">slide-down</property>
             <property name="events">GDK_POINTER_MOTION_MASK</property>
             <signal name="notify::is-fullscreen" handler="on_fullscreen_changed"/>
-            <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="GamesDisplayHeaderBar" id="fullscreen_header_bar">
                 <property name="visible">True</property>
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index 704f354d..746c2d1a 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -73,10 +73,8 @@ private class Games.DisplayBox : Gtk.EventBox {
        }
 
        [GtkCallback]
-       private bool on_motion_event (Gdk.EventMotion event) {
+       private void on_motion_event (Gtk.EventControllerMotion controller, double x, double y) {
                on_activity ();
-
-               return false;
        }
 
        private void on_activity () {


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