Skip to content

Touch events emit screen coordinates instead of client coordinates on Windows#1042

Merged
Osspial merged 3 commits intorust-windowing:masterfrom
dam4rus:windows-touch
Jul 17, 2019
Merged

Touch events emit screen coordinates instead of client coordinates on Windows#1042
Osspial merged 3 commits intorust-windowing:masterfrom
dam4rus:windows-touch

Conversation

@dam4rus
Copy link
Copy Markdown
Contributor

@dam4rus dam4rus commented Jul 11, 2019

Fixes #1002

I think this change should be reflected in CHANGELOG.md. Should i add it under "Unreleased"?

  • Tested on all platforms changed
  • cargo fmt has been run on this branch
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

Copy link
Copy Markdown
Contributor

@Osspial Osspial left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This largely looks good, but it's losing some sub-pixel precision that we should be able to expose.

let mut location = POINT {
x: input.x / 100,
y: input.y / 100,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doing the conversion like this loses the subpixel precision that the windows API provides. It should be possible to do the conversion to client-space and bring over the remainder.

let mut location = POINT {
x: pointer_info.ptPixelLocation.x,
y: pointer_info.ptPixelLocation.y,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may be better-suited to another PR, but would it be possible to use ptHimetricLocation to get sub-pixel precision when handling this event? I should've caught that in the original PR, but I didn't look closely enough and didn't realize it was quite possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, i will look at it. I can open a new PR if you wish.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do whatever works best for you. Either option is fine by me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've implemented it in a separate branch so i'll open a separate PR for it.

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Jul 12, 2019

I think this change should be reflected in CHANGELOG.md. Should i add it under "Unreleased"?

Yep!

@Osspial Osspial merged commit 8567758 into rust-windowing:master Jul 17, 2019
felixrabe pushed a commit to felixrabe/winit that referenced this pull request Jul 24, 2019
… Windows (rust-windowing#1042)

* Touch events emit screen coordinates instead of client coordinates on Windows

Fixes rust-windowing#1002

* Don't lose precision of WM_TOUCH events when converting from screen space to client space

* Updated CHANGELOG.md to reflect changes from issue: rust-windowing#1042
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Touch events emit screen coordinates instead of client coordinates on Windows

2 participants