Skip to content

Conversation

@PapyChacal
Copy link

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…

  • …I have familiarized myself with the CONTRIBUTING.md file
  • …this change follows the coding style and design patterns of the codebase
  • …I own the intellectual property rights to this code
  • …the intent of this change is clearly explained
  • …existing uses of the Panda3D API are not broken
  • …the changed code is adequately covered by the test suite, where possible.

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!

Emilien Bauer added 3 commits November 25, 2020 11:27
It is meant to switch between various standard cursor types on the supported platforms (X11, Win32, and Cocoa)
@PapyChacal PapyChacal force-pushed the feature/cursor-type-with-hidden branch from 650f08c to 2db91e4 Compare November 26, 2020 18:02
@PapyChacal PapyChacal force-pushed the feature/cursor-type-with-hidden branch from 2db91e4 to 5d6df28 Compare November 26, 2020 18:15
@codecov
Copy link

codecov bot commented Nov 26, 2020

Codecov Report

Merging #1061 (5d6df28) into master (e83657f) will decrease coverage by 0.03%.
The diff coverage is 4.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1061      +/-   ##
==========================================
- Coverage   15.70%   15.67%   -0.04%     
==========================================
  Files        3708     3715       +7     
  Lines      357820   358350     +530     
==========================================
- Hits        56203    56167      -36     
- Misses     301617   302183     +566     
Impacted Files Coverage Δ
panda/src/cocoadisplay/cocoaGraphicsWindow.mm 6.87% <0.00%> (-0.03%) ⬇️
panda/src/display/graphicsWindow.cxx 26.21% <ø> (-0.28%) ⬇️
panda/src/x11display/x11GraphicsWindow.cxx 0.00% <0.00%> (ø)
panda/src/display/windowProperties.I 54.46% <22.22%> (-2.12%) ⬇️
panda/src/display/windowProperties.cxx 48.80% <33.33%> (-0.72%) ⬇️
panda/src/linmath/lmatrix4_src.I 43.03% <0.00%> (-11.55%) ⬇️
dtool/src/dtoolbase/dtoolbase.h 57.14% <0.00%> (-9.53%) ⬇️
panda/src/linmath/lvecBase2_src.I 35.01% <0.00%> (-1.57%) ⬇️
panda/src/mathutil/boundingVolume.cxx 33.57% <0.00%> (-1.43%) ⬇️
panda/src/express/multifile.I 20.72% <0.00%> (-1.40%) ⬇️
... and 68 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e83657f...5d6df28. Read the comment docs.

@rdb
Copy link
Member

rdb commented Dec 29, 2020

I see this is still marked Draft, is this ready to receive review and feedback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants