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.
This commit is contained in:
Matthias Clasen 2020-04-28 15:11:26 -04:00
parent 65c56ea812
commit dc7081599d

View File

@ -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;
@ -166,6 +170,17 @@ gtk_video_unmap (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_video_parent_class)->unmap (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)
{
@ -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));
}
/**