Skip to content

Handle WM_POINTER* events in favor of WM_TOUCH#991

Merged
Osspial merged 2 commits intorust-windowing:masterfrom
dam4rus:master
Jul 10, 2019
Merged

Handle WM_POINTER* events in favor of WM_TOUCH#991
Osspial merged 2 commits intorust-windowing:masterfrom
dam4rus:master

Conversation

@dam4rus
Copy link
Copy Markdown
Contributor

@dam4rus dam4rus commented Jun 27, 2019

Fixes #975

Haven't tested on Windows 7, but it should work, since the POINTER events are only fired on Windows 8 or higher. It should be tested anyway because GetPointerFrameInfoHistory and SkipPointerFrameMessages doesn't exist in User32.dll on pre-Windows 8.

  • 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

@felixrabe
Copy link
Copy Markdown
Contributor

felixrabe commented Jun 27, 2019

Some meta suggestions regarding this PR:

@dam4rus dam4rus changed the title Implemented issue #975 Handle WM_POINTER* events in favor of WM_TOUCH Jun 27, 2019
@Osspial Osspial self-requested a review June 27, 2019 22:19
@goddessfreya
Copy link
Copy Markdown
Contributor

goddessfreya commented Jul 4, 2019

Hey folks, I noticed you were on the windows testing list.

@0xpr03, and @FliegendeWurst Can one of you two test this on windows 7?

@arthrp, and @notriddle Can one of you two test this on windows 8 or 10?

Thanks.

@0xpr03
Copy link
Copy Markdown

0xpr03 commented Jul 4, 2019

Build & Tests pass on win 7

@0xpr03
Copy link
Copy Markdown

0xpr03 commented Jul 4, 2019

Update: All examples are broken with (window example):

error: process didn't exit successfully: target\debug\examples\window.exe (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)

RUST_BACKTRACE doesn't output anything, so if there's a way, tell me how I can provide more information.

@dam4rus
Copy link
Copy Markdown
Contributor Author

dam4rus commented Jul 4, 2019

As i've mentioned, the functions needed by these events are not available on Windows 7 and older. I couldn't find anything about how Rust links FFI functions and I assumed that it uses dynamic linking. Because handling WM_TOUCH already breaks pre-Windows 7 compatibility, i guess that it's not priority for winit to support Windows XP.

So we should load those functions dynamically through LoadLibrary and GetProcAddress. I've found an example usage of GetProcAddress in 'platform_impl/windows/dpi.rs', where a 'get_function' macro is defined to ease this process. Maybe this macro and it's accompanying function should be moved into 'platform_impl/windows/util.rs' and made visible within the whole module.

@0xpr03
Copy link
Copy Markdown

0xpr03 commented Jul 4, 2019

We probably don't want support for anything older, but windows 7 is still supported and will be for longer on the industry side, so I'd personally not drop w7 support for now.

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Jul 5, 2019

@zegentzy thanks for pinging testers!

@dam4rus Sorry about the delay in reviewing. The dynamic function loading machinery in dpi should indeed be used for this, and moving it into util is a good idea.

@dam4rus
Copy link
Copy Markdown
Contributor Author

dam4rus commented Jul 5, 2019

@Osspial Should i create a separate PR for moving the dynamic function loading macro?

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Jul 5, 2019

@dam4rus Nah, adding it in this PR is fine.

@dam4rus
Copy link
Copy Markdown
Contributor Author

dam4rus commented Jul 6, 2019

@0xpr03 It should work now. Can you test it?

@0xpr03
Copy link
Copy Markdown

0xpr03 commented Jul 6, 2019

@dam4rus yes, current version works with examples

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Jul 9, 2019

I'll go ahead and merge this now. Thank you for implementing this!

Actually, one last thing - does this add multitouch support? If so, the relevant line in the feature matrix should get updated.

@dam4rus
Copy link
Copy Markdown
Contributor Author

dam4rus commented Jul 10, 2019

WM_TOUCH already handled multiple touch points (AFAIK) and so does WM_POINTER. So, it depends on what you mean by multitouch support? This just sends individual touch events for every touch point like the WM_TOUCH implementation. The client can store these events to handle simultaneous touch points. Even so, it's kinda hard to tell what's a "touch event frame" with the current implementation.

@Osspial
Copy link
Copy Markdown
Contributor

Osspial commented Jul 10, 2019

Ah, I suppose that should just be marked with a checkmark instead of a question mark, then. I'll merge this now and correct that.

@Osspial Osspial merged commit b00cdad into rust-windowing:master Jul 10, 2019
Osspial added a commit to Osspial/winit that referenced this pull request Jul 11, 2019
commit 026b331
Author: Kalmár Róbert <[email protected]>
Date:   Fri Jul 5 18:37:25 2019 +0200

    Handle WM_POINTER* events in favor of WM_TOUCH

    Fixes rust-windowing#975

commit 93c36cc
Author: Kalmar Robert <[email protected]>
Date:   Thu Jun 27 11:34:38 2019 +0200

    Handle WM_POINTER* events in favor of WM_TOUCH

    Fixes rust-windowing#975.
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.

Handle WM_POINTER* events in favor of WM_TOUCH

5 participants