macOS: Fix selector response checking for undocumented cursors #4033
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.
AnyClass::responds_to
delegates toclass_respondsToSelector
, a function provided by the Objective-C runtime. However, at some point, this began to returnfalse
for selectors referring to undocumented cursors, despite the cursors remaining accessible via said selectors. That this check fails prevents the cursors from being used.We can instead send
respondsToSelector:
to theNSCursor
class itself. As an instance method, this is nominally impossible; however, Apple grants an exemption that permits class objects to perform instance methods defined in the root class.Checking for the undocumented cursors in this way gets them working again, at least on macOS Sequoia 15.1.1.
changelog
module if knowledge of this change could be valuable to usersThis is my first contribution to winit so please let me know if I missed anything! cc @madsmtm
This should fix #3724.