[epiphany/wip/exalm/fullscreen: 10/12] fullscreen-box: Listen to enter signal as well




commit aae661b3928155555643b39a2f5b2df33e3ccd2e
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Mar 23 14:31:28 2021 +0500

    fullscreen-box: Listen to enter signal as well
    
    If we never moved pointer (for example, just launched the app and pressed
    F11), we don't want the header bar to stay until you move it.

 src/ephy-fullscreen-box.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/ephy-fullscreen-box.c b/src/ephy-fullscreen-box.c
index 2a37340fe..bf604d57c 100644
--- a/src/ephy-fullscreen-box.c
+++ b/src/ephy-fullscreen-box.c
@@ -161,8 +161,8 @@ update (EphyFullscreenBox *self,
 
 static void
 motion_cb (EphyFullscreenBox *self,
-           gdouble            x,
-           gdouble            y)
+           double             x,
+           double             y)
 {
   self->is_touch = FALSE;
   self->last_y = y;
@@ -170,6 +170,20 @@ motion_cb (EphyFullscreenBox *self,
   update (self, FALSE);
 }
 
+static void
+enter_cb (EphyFullscreenBox *self,
+          double             x,
+          double             y)
+{
+  g_autoptr (GdkEvent) event = gtk_get_current_event ();
+
+  if (event->crossing.window != gtk_widget_get_window (GTK_WIDGET (self)) ||
+      event->crossing.detail == GDK_NOTIFY_INFERIOR)
+    return;
+
+  motion_cb (self, x, y);
+}
+
 static void
 press_cb (EphyFullscreenBox *self,
           int                n_press,
@@ -413,6 +427,8 @@ ephy_fullscreen_box_init (EphyFullscreenBox *self)
 
   self->controller = gtk_event_controller_motion_new (GTK_WIDGET (self));
   gtk_event_controller_set_propagation_phase (self->controller, GTK_PHASE_CAPTURE);
+  g_signal_connect_object (self->controller, "enter",
+                           G_CALLBACK (enter_cb), self, G_CONNECT_SWAPPED);
   g_signal_connect_object (self->controller, "motion",
                            G_CALLBACK (motion_cb), self, G_CONNECT_SWAPPED);
 


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