let gesture_click = GestureClick::new();
let pad = Arc::new(Pad {id: id, btn: btn, sample: sample, sample_player: sample_player});
let cloned_pad = Arc::clone(&pad);
gesture_click.connect_pressed(move |_gesture, _n_press, _x, _y| cloned_pad.on_click());
gesture_click.connect_released(move |_gesture, _n_press, _x, _y| println!("I'm released"));
gesture_click.connect_stopped(move |_a| println!("I'm gone."));
pad.btn.add_controller(&gesture_click);
I have multiple buttons in my Rust (gtk4) program. I know that I can use the standard clicked signal of buttons but they respond when you click and release, I don’t want to wait for the release. So I used GtkGestureClick instead of the clicked signal. Basically, the first click works as it is supposed to, but after that, the stopped signal raises and I have no release signal and it doesn’t work anymore.
A short video of the problem:
(Btw I forgot to click the same button again. Simply nothing happens when you click it again since it sent the stopped signal)
May it be related to GTK4: need button pressed and released signals ?
There the issue was, that gestures does not work well with widgets that have their own signals, e.g. gesture was working with a plain label, but not with a button.