~eliasnaur/gio

ad3db5212d10059bfe8af3ed75b60711d5705955 — Dominik Honnef 7 months ago e768fe3
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
2957d007a25ff4ec8c6858a056cfd40275393695.

Signed-off-by: Dominik Honnef <dominik@honnef.co>
1 files changed, 12 insertions(+), 12 deletions(-)

M app/os_wayland.go
M app/os_wayland.go => app/os_wayland.go +12 -12
@@ 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{