wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

seat: keep track of what buttons are pressed

Open acrisci opened this issue 7 years ago • 2 comments

The seat pointer interface seems to be very prickly about how every button press must be followed by a button release in exactly that order.

For instance, if I just send a random wlr_seat_notify_pointer_button() with release, the pointer_state.button_count will now be wrong for the rest of the time that the compositor runs (with no buttons pressed, the value will be -1) because it simply decrements the button count whenever it gets a release.

I'm running into this now on #1018. Here, I don't want to send a button press when the compositor move starts. When the compositor move ends, it would be harmless to send a release for a button that was never pressed. However how it is now, that will completely screw up the seat state in a way that's difficult to debug and requires a compositor restart to fix.

The case of press without a release I would consider a developer error and we can't help that one. However, if the same button were notified to be pressed 5 times without releases, the count would still show one button pressed (not 5), which is correct.


wlroots has migrated to gitlab.freedesktop.org. This issue has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1077

acrisci avatar Jun 21 '18 22:06 acrisci

Yeah, it's true that the pointer state is too error-prone. We should probably make it like the keyboard state.

emersion avatar Jun 21 '18 22:06 emersion

Another weird case we have to handle is if you press a button on the mouse, and then you disconnect your mouse, you have to release all the buttons that are pressed on the mouse. That probably needs another issue.

acrisci avatar Jun 21 '18 22:06 acrisci