diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-04-28 15:11:26 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-04-28 15:11:26 -0400 |
commit | dc7081599d2a2d99787fd6b5dabb633c74453c77 (patch) | |
tree | fd0c5fa5abdb482339ef90fd1a528dc7f21a0df2 /gtk/gtkvideo.c | |
parent | 65c56ea81274ef234b72cc12f9c78acd0314745f (diff) | |
download | gtk+-dc7081599d2a2d99787fd6b5dabb633c74453c77.tar.gz |
video: Don't hide the controls while the popup is shown
We don't get motion events from the popup (due to grabs),
so just don't hide as long as we're grab shadowed. This
makes the controls stay up until the volume popup is
dismissed.
Diffstat (limited to 'gtk/gtkvideo.c')
-rw-r--r-- | gtk/gtkvideo.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c index 78f8ea080c..e976928bb7 100644 --- a/gtk/gtkvideo.c +++ b/gtk/gtkvideo.c @@ -60,6 +60,7 @@ struct _GtkVideo guint autoplay : 1; guint loop : 1; + guint grabbed : 1; }; enum @@ -82,6 +83,9 @@ gtk_video_hide_controls (gpointer data) { GtkVideo *self = data; + if (self->grabbed) + return G_SOURCE_CONTINUE; + gtk_revealer_set_reveal_child (GTK_REVEALER (self->controls_revealer), FALSE); self->controls_hide_source = 0; @@ -167,6 +171,17 @@ gtk_video_unmap (GtkWidget *widget) } static void +gtk_video_grab_notify (GtkWidget *widget, + gboolean was_grabbed) +{ + GtkVideo *self = GTK_VIDEO (widget); + + self->grabbed = !was_grabbed; + + GTK_WIDGET_CLASS (gtk_video_parent_class)->grab_notify (widget, was_grabbed); +} + +static void gtk_video_dispose (GObject *object) { GtkVideo *self = GTK_VIDEO (object); @@ -255,6 +270,7 @@ gtk_video_class_init (GtkVideoClass *klass) widget_class->unmap = gtk_video_unmap; widget_class->grab_focus = gtk_widget_grab_focus_none; widget_class->focus = gtk_widget_focus_child; + widget_class->grab_notify = gtk_video_grab_notify; gobject_class->dispose = gtk_video_dispose; gobject_class->get_property = gtk_video_get_property; @@ -318,7 +334,7 @@ gtk_video_class_init (GtkVideoClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkVideo, controls_revealer); gtk_widget_class_bind_template_callback (widget_class, gtk_video_motion); - gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("video")); } @@ -326,6 +342,7 @@ static void gtk_video_init (GtkVideo *self) { gtk_widget_init_template (GTK_WIDGET (self)); + } /** |