[totem] backend: Hide popups when leaving the window



commit 47af343d92fbc0b93a061a366c863d5cb963723c
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Apr 11 12:00:46 2014 +0200

    backend: Hide popups when leaving the window
    
    Monitor leave events on the toplevel window, rather than just
    on the video widget itself, and only consider it left if it left
    to a window that's not in the same hierarchy. This means that
    we know that it's left the whole window (and not just the video widget)
    and we don't hide the popup when you try to go to the revealed toolbar
    in fullscreen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727220

 src/backend/bacon-video-widget.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 37c80a8..a7a5fac 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -614,6 +614,29 @@ get_media_size (BaconVideoWidget *bvw, gint *width, gint *height)
   }
 }
 
+static gboolean
+leave_notify_cb (GtkWidget        *widget,
+                GdkEventCrossing *event,
+                gpointer          user_data)
+{
+  gboolean res = GDK_EVENT_PROPAGATE;
+  BaconVideoWidget *bvw = BACON_VIDEO_WIDGET (user_data);
+  GdkDevice *device;
+
+  if (event->detail != GDK_NOTIFY_NONLINEAR &&
+      event->detail != GDK_NOTIFY_NONLINEAR_VIRTUAL)
+    return res;
+
+  device = gdk_event_get_source_device ((GdkEvent *) event);
+  if (gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN)
+    return res;
+
+  if (bvw->priv->reveal_controls)
+    set_controls_visibility (bvw, FALSE, TRUE);
+
+  return res;
+}
+
 static void
 bacon_video_widget_realize (GtkWidget * widget)
 {
@@ -632,6 +655,8 @@ bacon_video_widget_realize (GtkWidget * widget)
   toplevel = gtk_widget_get_toplevel (widget);
   if (is_gtk_plug (toplevel) == FALSE) {
     gtk_window_set_geometry_hints (GTK_WINDOW (toplevel), widget, NULL, 0);
+    g_signal_connect (G_OBJECT (toplevel), "leave-notify-event",
+                     G_CALLBACK (leave_notify_cb), bvw);
   } else {
     bvw->priv->embedded = TRUE;
   }


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