HumbleUI / JWM

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

macOS: implement RESIZE_NESW and RESIZE_NWSE cursors #232

Open tonsky opened 2 years ago

tonsky commented 2 years ago

macOS is missing NESW/NWSE right now. I guess the solution here would be to provide custom cursors (I think that’s what both browsers and AWT do), then we can cover all the use-cases

See #231 for context

LuisThiamNye commented 2 years ago

You may be able to access a range of additional cursors using private methods of NSCursor: https://stackoverflow.com/questions/27242353/cocoa-predefined-resize-mouse-cursor

Also, from the Chromium source, these look relevant: https://github.com/chromium/chromium/blob/main/ui/base/cocoa/cursor_utils.mm https://github.com/chromium/chromium/commit/146be2e5165365b500fd573769c4fb53343d6276

Granted I have no real experience with Objective-C, but it appears to me as though Chromium first attempts to use the hidden system cursors by inheriting NSCursor and setting the private field _type. If that fails, a fallback image is used. I think this would be the best approach.

tonsky commented 2 years ago

Looks great!