HumbleUI / JWM

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

Add x/y to EventMouseScroll #227

Open tonsky opened 2 years ago

tonsky commented 2 years ago

https://github.com/HumbleUI/HumbleUI/issues/27

tonsky commented 2 years ago

Check if both are possible on all platfroms

dzaima commented 2 years ago

On X11, mouse & scroll movement, while the mouse is within the bounds of the window, is already sent regardless of whether it's focused or not. And, given that both come from the same event, adding x/y to EventMouseScroll would be trivial.

blnote commented 8 months ago

Just tested that on Windows EventMouseMove is received regardless of whether the window is focused or not, as long as the cursor is above the visible part of the window. It's also possible to capture mouse movements outside the window using SetCapture https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setcapture

By the way, nice talk at London Clojurians, really liked your attention to detail!

tonsky commented 8 months ago

Yeah, we don’t really need mouse events outside window, but I wonder how would one know then that mouse did went outside? Is there a different kind of event?

dzaima commented 8 months ago

Some event on mouse leaving & re-entering the window would make sense and could be useful. X11 has those as XI_Enter & XI_Leave (XI_Enter being already in use for a scroll workaround).

blnote commented 8 months ago

Windows has the WM_MOUSELEAVE event. When the mouse enters, it generates WM_MOUSEMOVE events again.

tonsky commented 8 months ago

I think I remember someone mentioned that Wayland won’t report mouse move events outside window too. It feels like the way forward is to add EventMouseLeave #287 and mouse coordinates to EventMouseScroll. I’ll rename this issue