[gtk/popup-controls-hiding] video: Don't hide the controls while the popup is shown
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/popup-controls-hiding] video: Don't hide the controls while the popup is shown
- Date: Tue, 28 Apr 2020 19:13:17 +0000 (UTC)
commit dc7081599d2a2d99787fd6b5dabb633c74453c77
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 28 15:11:26 2020 -0400
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.
gtk/gtkvideo.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
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;
@@ -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));
+
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]