diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-04-11 12:00:46 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-04-11 15:37:57 +0200 |
commit | 47af343d92fbc0b93a061a366c863d5cb963723c (patch) | |
tree | 65cb1c895481df56caeccc82bae18ca80402f4f9 | |
parent | adcb775d24edb0aba662c1ba4811a11542c0ff66 (diff) | |
download | totem-47af343d92fbc0b93a061a366c863d5cb963723c.tar.gz |
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
-rw-r--r-- | 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 37c80a8b9..a7a5fac7e 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; } |