-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional Cursors #427
Comments
Those ones weren't added because they're not available on all platforms and at that point you're better of making your own. |
horizontal and vertical resize are standard, so the two diagonal resize, i think a couple of them are missing along with just a few other standard cursors. I would like the ability to offer the standard system cursors as well as custom ones. |
I came here asking for the same question and found this. The lack of cursor on OS X is pretty unfortunate :( Perhaps is that it wouldn't hurt if glfw supported the definition for some of those extra cursors, with the documented fact that they won't be used on some platform. (the comment can be next to the definition). (As for X11, It looks pretty clear that X11 cursors predate the jurassic era so perhaps they shouldn't be treated as the bottleneck.) |
I may squeeze in a few extra standard cursors by following the example set by SDL2. Since OS X has the most limited set but also doesn't (obviously) support cursor themes, I'll also consider adding custom images matching the existing standard cursors. |
Alternate approach: an API where you can set standard cursors including the ones in the top post here, but get an error code if the platform does not support the selected standard cursor. Then the application code could notice the error and set a custom cursor. That way GLFW does not have to include any art. |
@andrewrk That is the solution I want to avoid, as it is the least user friendly. |
I understand. Be careful though - trading power for user-friendliness in a C API is a dangerous road. |
I wouldn't throw an error, just ignore it in OS X and don't do anything, people use GLFW on OS X probably already know better than asking for things that don't exist any way. |
+1, I just ran into this. It's puzzling to have |
FYI was looking into this today, and found references (untested) of the fact that OS X apparently have those cursors but they are not documented: https://stackoverflow.com/questions/10733228/native-osx-lion-resize-cursor-for-custom-nswindow-or-nsview If OS X was the bottleneck here that may be a solution to easily add some extra cursors. |
Still disappointed this hasn't been implemented yet.. what would it take for this to get an accepted PR? What would be the desired API? I'm willing to make a PR myself if an API can be agreed upon. I particularly like the "return error code" if creation of a standard cursor is not available on some platform. Perhaps just return null so that the cursor will just be the standard cursor if the code follows something like this: GLFWcursor* cursor;
void Initialize()
{
cursor = glfwCreateStandardCursor(GLFW_BOTHRESIZE_CURSOR);
}
void Update()
{
// For cursor == nullptr, it'll just set it to the default cursor
glfwSetCursor(cursor);
} |
As many projects the number of issues can be hard to follow up so I don't think it is particularly constructive to state disappointment (we all have issues that are important to us). IHMO even a PR that implemented what you suggest and not even support all the cursors on OSX would be a way forward. As GLFW depends on work for multiple platform it can be paralyzing for a single developer, and difficult to coordinate multiple people. I imagine if a PR existed which proved that it was possible on OSX (and maybe discussed the potential issues associated to using undocumented API, or provided references as to who may be doing the same) and implemented the bulk of the cross-platform work if it would be much easier to take a decision on the API and merging details. |
As for the cross-platform work, I do have and regularly use Windows, Mac, and Ubuntu machines. I can definitely see what is available on those.
You're right, I apologize for that wording. Didn't mean to make it sound personal or anything like that. |
Started working on this in the more-standard-cursors branch. Does the naming of the new cursor constants make sense? How strict should the new cursors be about matching visually? On platforms where the usual generic move cursor is a closed hand instead of a four-way arrow cross, should |
Hello, Thank you Camilla for looking into this. I think the names you added are alright seeing they tend to match what most platform uses (e.g. NOT_ALLOWED is the closest to what most platforms uses, apart from win32 "NO" which is misleading anyway). To answer this one specific example: Looking at https://github.com/glfw/glfw/compare/more-standard-cursors it appears only Mac doesn't have a I was thinking maybe this particular cursor should be called MOVE and not RESIZE-ALL ? But resize-all appears to be the standard name everywhere, and SDL use Personally I am most looking forward for:
I can imagine exposing this if it was available:
Maybe other users (e.g. @imaginationcoin) would have more feedback on this. |
Taking the liberty to ping @imaginationcoin @andrewrk @PlutoniumHeart @wjakob @codecat who posted in this issue to see if they have any feedback regarding the branch which Camilla proposed? |
This adds the standard cursors for diagonal and omnidirectional resize/move, operation-not-allowed and help. It also adds new (better?) names for the horizontal and vertical resize/move and pointing hand cursors. References: - https://developer.apple.com/documentation/appkit/nscursor - https://stackoverflow.com/questions/10733228/ - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor - https://freedesktop.org/wiki/Specifications/cursor-spec/ - https://tronche.com/gui/x/xlib/appendix/b/ Fixes #427.
This cursor did not behave as needed on macOS. Related to #427.
This adds the standard cursors for diagonal and omnidirectional resize/move and operation-not-allowed. It also adds new (better?) names for the horizontal and vertical resize/move and pointing hand cursors. References: - https://developer.apple.com/documentation/appkit/nscursor - https://stackoverflow.com/questions/10733228/ - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor - https://freedesktop.org/wiki/Specifications/cursor-spec/ - https://tronche.com/gui/x/xlib/appendix/b/ Related to #427.
The following cursors have been added with 7dbdd2e
The macOS context help cursor behaved strangely on 10.10 Yosemite and was left out for now. |
Wonderful, thank you Camilla, much appreciated! |
@elmindreda Is there any chance these new cursors could be backported to 3.3? |
@aloucks Do you mean can it be added to the |
@elmindreda It would be nice if they could be added to I thought the cursor addition was a bugfix and they would show up in one of the recent patch updates, but it didn't happen. I wasn't sure if that was intentional or the work to backport just hadn't happened. |
Just noting that I'd also like to get my hands on this feature in the near future. I'm not familiar with the GLFW release processes, is there something we can do to make sure this is included in the next patch release? |
@aloucks @johnnovak Do you need the additional cursors in any stable branch, or that and pre-built binaries, or that and an official release? |
@elmindreda An official release would be ideal. I'd like to put in a PR to update the Rust glfw native bindings. This is generally updated from the most recent GLFW release tag. I don't think it would be a good idea to have the native bindings reflect changes that aren't present in an actual release. I understand if you want to hold off on a new release, but I figured it wouldn't hurt to ask :) |
@elmindreda For my own purposes I'm fine with just patch that I can apply to the 3.3 official sources (my app is written in Nim and I'm linking statically to glfw). Also, I'm the maintainer of the Nim glfw bindings so whenever this gets released officially I'll update that, But strictly speaking, for my own app this is not a requirement. EDIT: Also, I only care about Windows and OS X, if that counts. |
This adds the standard cursors for diagonal and omnidirectional resize/move and operation-not-allowed. It also adds new (better?) names for the horizontal and vertical resize/move and pointing hand cursors. References: - https://developer.apple.com/documentation/appkit/nscursor - https://stackoverflow.com/questions/10733228/ - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor - https://freedesktop.org/wiki/Specifications/cursor-spec/ - https://tronche.com/gui/x/xlib/appendix/b/ Related to #427.
I created the branch but apparently forgot to tell anyone about it... 🤦♀️ @johnnovak A branch with this feature plus @aloucks Noted. The current release scheme is admittedly a flaming disaster but for the same reasons all I can say at the moment is "I'm working on it." Sorry, I'm working on it. |
@elmindreda Thanks, much appreciated. I will try it sometime! |
@elmindreda I've just tried this branch on my Windows 10 machine and when I'm switching to any of the newly introduced cursor shapes, the default arrow cursor gets displayed. |
@johnnovak I cannot reproduce that here. Does |
@elmindreda @ocornut @aloucks Sorry guys, I must have messed up something before. It's working as expected! Thanks again for creating this branch @elmindreda ! |
If you keep adding more cursor shapes that may or may not be supported, a function for determining if a particular cursor shape is supported would also be a nice addition. I made a separate issue thread for this suggestion. |
This issue seems to have been addressed, as far as the intersection between system cursor sets allow. #1935 seems like a good place to explore potentially going further. Closing this. Thank you everyone for your help! |
This adds the standard cursors for diagonal and omnidirectional resize/move and operation-not-allowed. It also adds new (better?) names for the horizontal and vertical resize/move and pointing hand cursors. References: - https://developer.apple.com/documentation/appkit/nscursor - https://stackoverflow.com/questions/10733228/ - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor - https://freedesktop.org/wiki/Specifications/cursor-spec/ - https://tronche.com/gui/x/xlib/appendix/b/ Related to glfw#427.
Please can you add definitions and support for the default cursors:
resize diagonal top left
resize diagonal bottom right
resize diagonal top right
resize diagonal bottom left
alt select
unavailable
hand grab
help select
hand grab
handwriting
The text was updated successfully, but these errors were encountered: