fix(ags cursorbox): make release more reliable
Some checks are pending
Discord / discord commits (push) Waiting to run

This commit is contained in:
matt1432 2024-05-15 15:13:24 -04:00
parent 5eeb29677d
commit 4f4b1e5140

View file

@ -59,22 +59,20 @@ export class CursorBox<Child extends Gtk.Widget, Attr> extends Gtk.EventBox {
this.add_events(Gdk.EventMask.SMOOTH_SCROLL_MASK);
// Gesture stuff
const gesture = Gtk.GestureLongPress.new(this);
const gesture = Gtk.GestureMultiPress.new(this);
this.hook(gesture, () => {
const pointer = gesture.get_point(null);
const x = pointer[1];
const y = pointer[2];
if ((!x || !y) || (x === 0 && y === 0)) {
this.hook(gesture, (_, _n, x, y) => {
if (!x || !y) {
return;
}
this.#canRun.setValue(!(
x > this.get_allocated_width() ||
y > this.get_allocated_height()
x <= 0 ||
y > this.get_allocated_height() ||
y <= 0
));
}, 'end');
}, 'released');
this.connect('enter-notify-event', (_, event: Gdk.Event) => {
this.set_state_flags(Gtk.StateFlags.PRELIGHT, false);