Cursor_type property to use standard cursors #1061
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue description
See #1049
Solution description
I added a cursor_type property. It takes value in a CursorType enum, and have four values representing cursor type at the moment, as well as CT_hidden, which replaces the cursor_hidden property, and CT_custom, which tells Panda to use cursor_filename instead.
I tried to replace every use of the cursor_hidden property accordingly. It seems to work alright on X11 and Win32, but I have doubts about the cocoa implementation as I don't have access to a macOS environment. This should break some existing use of the Panda3D API, as all the cursor_hidden-related functions are removed.
Checklist
I have done my best to ensure that…
Notes
The way cursor_type and cursor_filename (and eventually cursor_hidden if it should instead be kept) still is to be discussed.
Before integrating this, the offered cursors should be discussed too. I used the following sources to see which cursors were exposed by which platform:
As one can see, those platforms offer different cursors. So for this draft, I simply used the set of cursors which clearly were the same on every platform (this reduces to default arrow, open hand, text beam, and crosshair...)
I could include some more with fallbacks: for example, Win32 and Cocoa both offer bidirectional horizontal and vertical resizing cursors, but X11 only offers unidirectional versions. I could make panda offer a unidirectional cursor_type and fall back to the bidirectional one in this case)
I could offer a union of those cursor types too, and return a flag or print a Warning or whatever if a platform doesn't support the asked type?
Finally, Panda could offer its own cursor theme, to get a consistent look and behavior on every platform.
Any other idea is welcome!