Skip to content

Commit de32ffe

Browse files
committed
Fixes #222 - left click on a button leaves "Left"
button with "suggested-action" style The reason that happens is that when clicking on a button, the button claims the "released" gesture and we don't get the "released" signal. Setting the propagation fhase to "CAPTURE" allows us to handle the event before the button claims it.
1 parent 739b004 commit de32ffe

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/Event Controllers/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ctrl_button.connect("clicked", () => {
4444

4545
// Detect pointer button press and release events
4646
const gesture_click = new Gtk.GestureClick({ button: 0 });
47+
gesture_click.propagation_phase = Gtk.PropagationPhase.CAPTURE;
4748

4849
window.add_controller(gesture_click);
4950

src/Event Controllers/main.py

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def on_swipe(_self, vel_x, _vel_y):
8484

8585
# Detect pointer button press and release events
8686
gesture_click = Gtk.GestureClick(button=0)
87+
gesture_click.set_propagation_phase(Gtk.PropagationPhase.CAPTURE)
8788
window.add_controller(gesture_click)
8889
gesture_click.connect("pressed", on_pressed)
8990
gesture_click.connect("released", on_released)

src/Event Controllers/main.vala

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void main () {
4747
var gesture_click = new Gtk.GestureClick () {
4848
button = 0
4949
};
50+
gesture_click.propagation_phase = Gtk.PropagationPhase.CAPTURE;
5051
((Gtk.Widget) window).add_controller (gesture_click);
5152

5253
gesture_click.pressed.connect ((gesture, n_press, x, y) => {

0 commit comments

Comments
 (0)