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

fix(macOS): cursor_position returns incorrect position #711

Merged
merged 3 commits into from
Mar 7, 2023
Merged

Conversation

wusyong
Copy link
Member

@wusyong wusyong commented Mar 7, 2023

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Checklist

Other information

@wusyong wusyong requested a review from a team as a code owner March 7, 2023 08:42
@wusyong
Copy link
Member Author

wusyong commented Mar 7, 2023

@amrbashir I've test it and the coordinates should be correct now.
But I found #708 is true, all platforms return logical positions. We'll need to discuss how to fix this.

@amrbashir
Copy link
Member

what do you mean by logical exactly? not relative to the window top-left corner? because CursorMoved is relative to the window top-left corner, while window.cursor_position() and event_loop.cursor_position() get the cursor position in the global space.

@wusyong wusyong changed the title On macOS, fix cursor_position returns incorrect position fix(macOS): cursor_position returns incorrect position Mar 7, 2023
@wusyong
Copy link
Member Author

wusyong commented Mar 7, 2023

I mean window.cursor_position() and event_loop.cursor_position() will return logical position. I have a monitor with physical size 2880x1800 and with scale factor 2. Both current_position() will return 1440x900 if I point to the bottom right of the screen. I can test further on Linux and Windows later, but they don't convert with scale factor when returning either.

Anyway, this discussion should move to #708. This PR should fix correct coordinate in second monitor (excluding scale factor).

@wusyong wusyong merged commit ea2e60d into dev Mar 7, 2023
@wusyong wusyong deleted the cursor branch March 7, 2023 12:19
@github-actions github-actions bot mentioned this pull request Mar 7, 2023
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.

monitor::cursor_position() not displaying correct cursor position
2 participants