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




commit d7d9552c4cca6b542ee2d8a5f7d46ea6bc9ad434
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 591d2bf99..6bdd47f2b 100644
--- a/src/ephy-fullscreen-box.c
+++ b/src/ephy-fullscreen-box.c
@@ -156,8 +156,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;
@@ -165,6 +165,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)
 {
@@ -404,6 +418,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]