HumbleUI / JWM

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

macOS: Fix cursor resetting to arrow #234

Closed LuisThiamNye closed 2 years ago

LuisThiamNye commented 2 years ago

After using setMouseCursor, I noticed that when the cursor leaves the window and re-enters, it returns to the default arrow cursor.

The solutions to this are to use either addCursorRect:cursor: or NSTrackingArea to ensure the cursor is set back to the preferred image. This implementation builds on the existing tracking area, which I think is better than an implementation using cursor rects.

Also, this patch includes a small modification to the dashboard example which allows you to click to the mouse cursor panel to keep the current cursor set until another element sets it back. As a result, the effect of this patch can be clearly seen.

tonsky commented 2 years ago

Thank you!