[gtk: 1/2] video: Reveal controls on tap
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] video: Reveal controls on tap
- Date: Thu, 24 Jun 2021 15:11:35 +0000 (UTC)
commit 517b5173f9eabbece6a3ffaa685c0d244ad2f7ab
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Tue Jun 8 16:28:44 2021 +0530
video: Reveal controls on tap
So that the controls shall be shown on touch
gtk/gtkvideo.c | 21 +++++++++++++++++----
gtk/ui/gtkvideo.ui | 6 ++++++
2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c
index 2343a3aba9..fd889f577b 100644
--- a/gtk/gtkvideo.c
+++ b/gtk/gtkvideo.c
@@ -101,10 +101,7 @@ gtk_video_hide_controls (gpointer data)
}
static void
-gtk_video_motion (GtkEventControllerMotion *motion,
- double x,
- double y,
- GtkVideo *self)
+gtk_video_reveal_controls (GtkVideo *self)
{
gtk_revealer_set_reveal_child (GTK_REVEALER (self->controls_revealer), TRUE);
if (self->controls_hide_source)
@@ -114,6 +111,21 @@ gtk_video_motion (GtkEventControllerMotion *motion,
self);
}
+static void
+gtk_video_motion (GtkEventControllerMotion *motion,
+ double x,
+ double y,
+ GtkVideo *self)
+{
+ gtk_video_reveal_controls (self);
+}
+
+static void
+gtk_video_pressed (GtkVideo *self)
+{
+ gtk_video_reveal_controls (self);
+}
+
static void
gtk_video_realize (GtkWidget *widget)
{
@@ -353,6 +365,7 @@ gtk_video_class_init (GtkVideoClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkVideo, controls);
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_bind_template_callback (widget_class, gtk_video_pressed);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, I_("video"));
diff --git a/gtk/ui/gtkvideo.ui b/gtk/ui/gtkvideo.ui
index 25351250d8..3760d4b7c8 100644
--- a/gtk/ui/gtkvideo.ui
+++ b/gtk/ui/gtkvideo.ui
@@ -45,5 +45,11 @@
<signal name="motion" handler="gtk_video_motion" swapped="no"/>
</object>
</child>
+ <child>
+ <object class="GtkGestureClick">
+ <property name="touch-only">1</property>
+ <signal name="pressed" handler="gtk_video_pressed" swapped="yes"/>
+ </object>
+ </child>
</template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]