app: [Wayland] avoid stuck primary button when invoking window management

Clicking on the window border or the title bar initiates resizing and
moving of the window respectively. This commit fixes a bug where this
would cause a stuck pressed primary button, as we won't receive a
release event. The fix is to only update the set of pressed buttons
after we've decided not to invoke window management.

This fixes a regression introduced by
2957d007a2.

Signed-off-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
Dominik Honnef
2023-04-03 22:55:51 +02:00
committed by Elias Naur
parent e768fe347a
commit ad3db5212d
+12 -12
View File
@@ -903,18 +903,7 @@ func gio_onPointerButton(data unsafe.Pointer, p *C.struct_wl_pointer, serial, t,
default:
return
}
var typ pointer.Type
switch state {
case 0:
w.pointerBtns &^= btn
typ = pointer.Release
// Move or resize gestures no longer applies.
w.inCompositor = false
case 1:
w.pointerBtns |= btn
typ = pointer.Press
}
if typ == pointer.Press && btn == pointer.ButtonPrimary {
if state == 1 && btn == pointer.ButtonPrimary {
if _, edge := w.systemGesture(); edge != 0 {
w.resize(serial, edge)
return
@@ -928,6 +917,17 @@ func gio_onPointerButton(data unsafe.Pointer, p *C.struct_wl_pointer, serial, t,
}
}
}
var typ pointer.Type
switch state {
case 0:
w.pointerBtns &^= btn
typ = pointer.Release
// Move or resize gestures no longer applies.
w.inCompositor = false
case 1:
w.pointerBtns |= btn
typ = pointer.Press
}
w.flushScroll()
w.resetFling()
w.w.Event(pointer.Event{