mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 15:22:11 +02:00
widget: Do gestures in capture phase
Capture phase runs from the toplevel down to the event widget and is meant to be used in containers that might possibly handle events before their children, like our OSD layer. This avoids an issue where pressing an OSD button does not emit cancelled signal, accidentally triggering long press gesture signal handler. Fixes #170
This commit is contained in:
@@ -738,6 +738,7 @@ class ClapperWidget extends Gtk.Grid
|
||||
{
|
||||
const clickGesture = new Gtk.GestureClick({
|
||||
button: 0,
|
||||
propagation_phase: Gtk.PropagationPhase.CAPTURE,
|
||||
});
|
||||
clickGesture.connect('pressed', this._onPressed.bind(this));
|
||||
clickGesture.connect('released', this._onReleased.bind(this));
|
||||
@@ -750,6 +751,7 @@ class ClapperWidget extends Gtk.Grid
|
||||
const longPressGesture = new Gtk.GestureLongPress({
|
||||
touch_only: true,
|
||||
delay_factor: 0.9,
|
||||
propagation_phase: Gtk.PropagationPhase.CAPTURE,
|
||||
});
|
||||
longPressGesture.connect('pressed', this._onLongPressed.bind(this));
|
||||
|
||||
@@ -758,7 +760,9 @@ class ClapperWidget extends Gtk.Grid
|
||||
|
||||
_getDragGesture()
|
||||
{
|
||||
const dragGesture = new Gtk.GestureDrag();
|
||||
const dragGesture = new Gtk.GestureDrag({
|
||||
propagation_phase: Gtk.PropagationPhase.CAPTURE,
|
||||
});
|
||||
dragGesture.connect('drag-update', this._onDragUpdate.bind(this));
|
||||
|
||||
return dragGesture;
|
||||
@@ -768,6 +772,7 @@ class ClapperWidget extends Gtk.Grid
|
||||
{
|
||||
const swipeGesture = new Gtk.GestureSwipe({
|
||||
touch_only: true,
|
||||
propagation_phase: Gtk.PropagationPhase.CAPTURE,
|
||||
});
|
||||
swipeGesture.connect('swipe', this._onSwipe.bind(this));
|
||||
swipeGesture.connect('update', this._onSwipeUpdate.bind(this));
|
||||
|
Reference in New Issue
Block a user