rdev icon indicating copy to clipboard operation
rdev copied to clipboard

Include scan code when simulating keyboard events on Windows

Open isaackd opened this issue 2 years ago • 2 comments

While trying to get keypresses detected by Factorio I noticed it would only work when the proper scan codes are included in the call to SendInput.

This should also fix https://github.com/Narsil/rdev/issues/73 according to https://github.com/rustdesk/rustdesk/issues/366#issuecomment-1019758259.

I'm not super familiar with the Windows API and came across a more complete-looking implementation at https://github.com/fufesou/rdev/blob/560eb62adfaa1e53b77d80800904b3241812e284/src/windows/simulate.rs#L116-L134, but maybe this PR is a good starting point?

isaackd avatar Sep 12 '23 12:09 isaackd

@isaackd very nice.

Not having a windows machine at hand (only remote ones which don't make testing this easy), I would love if someone could confirm/infirm this PR is indeed working.

Narsil avatar Sep 21 '23 07:09 Narsil

The other PR looks more complete, but thereś a lot of weird values and switches going on, which are probably a tiny bit too platform specific.

Either windows document those values (and they are usually in the lib as flags) and we need to link that, or they are not and I wouldn't include them.

Your PR looks better imo.

Narsil avatar Sep 21 '23 07:09 Narsil