HumbleUI/JWM

Add x/y to EventMouseScroll

tonsky opened this issue · 7 comments

  • Report mouse move when window out of focus
  • Add x/y to EventMouseScroll

Check if both are possible on all platfroms

  • Windows
  • X11
  • macOS

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.

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!

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?

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).

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

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