HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
547 stars 44 forks source link

X11: EventMouseScroll and EventMouseButton report incorrect cursor position #241

Closed navaratine closed 1 year ago

navaratine commented 1 year ago

These events report incorrect, rarely updated _x and _y values. events

I've been able to track down the source of this issue: unlike MotionNotify handler of XI_Motion doesnt update lastMousePosX and lastMousePosY before dispatching EventMouseMove. Handler of MotionNotify does set these values but I find that it's very rarely invoked. This results in scroll and click events often reporting incorrect mouse position.

This can be fixed by replicating behaviour of MotionNotify handler and updating last mouse position before event dispatch. fix. events after fix

navaratine commented 1 year ago

I've opened a PR with the proposed fix. Feel free to merge it if it looks alright to You.