Skip to content
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

More Cursors #1612

Merged
merged 5 commits into from
Feb 26, 2021
Merged

More Cursors #1612

merged 5 commits into from
Feb 26, 2021

Conversation

maan2003
Copy link
Collaborator

This adds pointer and busy cursors. I have only tested this on linux(gtk).

@cmyr
Copy link
Member

cmyr commented Feb 23, 2021

The cursors that are currently available represent the set of cursors that are implemented on all of our major platforms. I'm not sure how best to expose cursors that are only available on some platforms. I do agree that this would be nice, but I would like to be principled about it.

One option might be to have separate PlatformCursor enums that describe cursors that are platform specific, and then maybe have a Cursor::Platform variant in the main Cursor enum? PlatformCursor would only be exported if the appropriate target_os/feature, but this is sort of fragile because of gtk/x11.

what we really want is some way to do like if cfg(target_backend = "gtk")`, but that doesn't exist. I'm not sure what to suggest, otherwise...

@maan2003
Copy link
Collaborator Author

So, adding Cursor::Pointer should be Ok. Also, I think Cursor::OpenHand is not available on windows.

Cursor::Busy is a fundamental cursor IMO 🤷 . How do browsers handle it on Mac OS?

@cmyr
Copy link
Member

cmyr commented Feb 23, 2021

I think macOS only shows the spinner when the main thread is blocked or something?

@cmyr
Copy link
Member

cmyr commented Feb 23, 2021

As far as I can tell there is no pointing hand cursor on windows: (see docs here?)

@maan2003
Copy link
Collaborator Author

As far as I can tell there is no pointing hand cursor on windows: (see docs here?)

I think IDC_HAND is the pointing hand cursor,
see https://docs.microsoft.com/en-us/windows/win32/menurc/about-cursors#the-mouse-and-the-cursor

For example, when the cursor crosses over a hyperlink, the system changes the cursor from an arrow to a hand.
image

@cmyr
Copy link
Member

cmyr commented Feb 23, 2021

Hmm okay, so there's no open hand, for dragging?

@maan2003
Copy link
Collaborator Author

yeah, no open hand 🤕

@maan2003
Copy link
Collaborator Author

Ready for review. I have removed the busy cursor. Also, I am not sure about CI failure.

@totsteps
Copy link
Collaborator

totsteps commented Feb 25, 2021

Tested on macOS and Windows 10. Works like a charm.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Cursor::Crosshair => IDC_CROSS,
// not correct, maybe polyfill this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, can we open an issue here? Not sure what the best solution is, I'd probably prefer to deprecate the open hand from this enum. 😢

@maan2003 maan2003 merged commit 5dbbcf8 into linebender:master Feb 26, 2021
derekdreery pushed a commit to derekdreery/druid that referenced this pull request Apr 6, 2021
* More Cursors

* Fix example

* Remove Busy Cursor

* Deprecate Cursor::OpenHand

* Fix example
xarvic pushed a commit to xarvic/druid that referenced this pull request Apr 7, 2021
* More Cursors

* Fix example

* Remove Busy Cursor

* Deprecate Cursor::OpenHand

* Fix example
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.

3 participants