mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
@@ -471,19 +471,22 @@ scroll_cb (GtkEventControllerScroll *scroll,
|
|||||||
|
|
||||||
pickup = _pick_pointer_widget (self);
|
pickup = _pick_pointer_widget (self);
|
||||||
|
|
||||||
/* We do not want to accidentally allow this controller
|
/* We do not want to accidentally allow this controller to handle
|
||||||
* to handle scrolls when hovering over scrolled window */
|
* scrolls when hovering over widgets that also handle scroll */
|
||||||
if (pickup && (GTK_IS_SCROLLED_WINDOW (pickup)
|
while (pickup && !CLAPPER_GTK_IS_VIDEO (pickup)) {
|
||||||
|| gtk_widget_get_ancestor (pickup, GTK_TYPE_SCROLLED_WINDOW)))
|
if (GTK_IS_SCROLLED_WINDOW (pickup) || GTK_IS_RANGE (pickup))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
pickup = gtk_widget_get_parent (pickup);
|
||||||
|
}
|
||||||
|
|
||||||
device = gtk_event_controller_get_current_event_device (GTK_EVENT_CONTROLLER (scroll));
|
device = gtk_event_controller_get_current_event_device (GTK_EVENT_CONTROLLER (scroll));
|
||||||
|
|
||||||
switch (gdk_device_get_source (device)) {
|
switch (gdk_device_get_source (device)) {
|
||||||
case GDK_SOURCE_TOUCHPAD:
|
case GDK_SOURCE_TOUCHPAD:
|
||||||
case GDK_SOURCE_TOUCHSCREEN:
|
case GDK_SOURCE_TOUCHSCREEN:
|
||||||
dx *= -0.4;
|
dx *= 0.4;
|
||||||
dy *= -0.4;
|
dy *= 0.4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -55,6 +55,9 @@ struct _ClapperGtkSeekBar
|
|||||||
gboolean has_hours;
|
gboolean has_hours;
|
||||||
gboolean has_markers;
|
gboolean has_markers;
|
||||||
|
|
||||||
|
gboolean can_scrub;
|
||||||
|
gboolean scrubbing;
|
||||||
|
|
||||||
gboolean dragging;
|
gboolean dragging;
|
||||||
guint position_uint;
|
guint position_uint;
|
||||||
|
|
||||||
@@ -288,6 +291,38 @@ scale_css_classes_changed_cb (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_scroll_begin_cb (GtkEventControllerScroll *scroll, ClapperGtkSeekBar *self)
|
||||||
|
{
|
||||||
|
self->can_scrub = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
scale_scroll_cb (GtkEventControllerScroll *scroll,
|
||||||
|
gdouble dx, gdouble dy, ClapperGtkSeekBar *self)
|
||||||
|
{
|
||||||
|
if (self->can_scrub && !self->scrubbing) {
|
||||||
|
GST_DEBUG_OBJECT (self, "Scrubbing start");
|
||||||
|
self->scrubbing = TRUE;
|
||||||
|
gtk_widget_add_css_class (self->scale, "dragging");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_scroll_end_cb (GtkEventControllerScroll *scroll, ClapperGtkSeekBar *self)
|
||||||
|
{
|
||||||
|
if (self->scrubbing) {
|
||||||
|
GST_DEBUG_OBJECT (self, "Scrubbing end");
|
||||||
|
gtk_widget_remove_css_class (self->scale, "dragging");
|
||||||
|
self->scrubbing = FALSE;
|
||||||
|
}
|
||||||
|
self->can_scrub = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
motion_cb (GtkEventControllerMotion *motion,
|
motion_cb (GtkEventControllerMotion *motion,
|
||||||
gdouble x, gdouble y, ClapperGtkSeekBar *self)
|
gdouble x, gdouble y, ClapperGtkSeekBar *self)
|
||||||
@@ -773,6 +808,9 @@ clapper_gtk_seek_bar_class_init (ClapperGtkSeekBarClass *klass)
|
|||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, scale_value_changed_cb);
|
gtk_widget_class_bind_template_callback (widget_class, scale_value_changed_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, scale_css_classes_changed_cb);
|
gtk_widget_class_bind_template_callback (widget_class, scale_css_classes_changed_cb);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, scale_scroll_begin_cb);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, scale_scroll_cb);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, scale_scroll_end_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, motion_cb);
|
gtk_widget_class_bind_template_callback (widget_class, motion_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, motion_leave_cb);
|
gtk_widget_class_bind_template_callback (widget_class, motion_leave_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, touch_released_cb);
|
gtk_widget_class_bind_template_callback (widget_class, touch_released_cb);
|
||||||
|
@@ -29,6 +29,15 @@
|
|||||||
<property name="adjustment">position_adjustment</property>
|
<property name="adjustment">position_adjustment</property>
|
||||||
<signal name="value-changed" handler="scale_value_changed_cb"/>
|
<signal name="value-changed" handler="scale_value_changed_cb"/>
|
||||||
<signal name="notify::css-classes" handler="scale_css_classes_changed_cb"/>
|
<signal name="notify::css-classes" handler="scale_css_classes_changed_cb"/>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEventControllerScroll">
|
||||||
|
<property name="propagation-phase">capture</property>
|
||||||
|
<property name="flags">both-axes</property>
|
||||||
|
<signal name="scroll-begin" handler="scale_scroll_begin_cb"/>
|
||||||
|
<signal name="scroll" handler="scale_scroll_cb"/>
|
||||||
|
<signal name="scroll-end" handler="scale_scroll_end_cb"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
Reference in New Issue
Block a user