-
Notifications
You must be signed in to change notification settings - Fork 186
General Windows improvements / c_* and winapi types #41
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
Conversation
this allows it to be used in erorr propagation (i.e. ?)
functions were changed to either panic or return error types, but never silently fail. `u32`s were replaced with DWORDS when calling windows functions (u32 and Dword are equivalent, but DWORD indicates it will be consumed by winapi). A few bugs were fixed, like not simulating scrolling and setting mouse position off-by one errors.
| fn sim_keyboard_event(flags: DWORD, vk: WORD, scan: WORD) -> Result<(), SimulateError> { | ||
| let mut union: INPUT_u = unsafe { std::mem::zeroed() }; | ||
| let inner_union = unsafe { union.ki_mut() }; | ||
| *inner_union = KEYBDINPUT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while more verbose, this is how the winapi crate recommends you instantiate unions.
|
This is failing CI because I added extra tests which don't pass on Ubuntu - I didn't actually change any linux-specific code, only expose an existing bug. I will still fix CI, but give me some time. |
Narsil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for all these changes !
They are very much appreciated.
|
Okay, now I have no clue why Ubuntu tests are failing. They pass on my local computer... |
tests/listen_and_simulate.rs
Outdated
| listen(send_event).expect("Could not listen"); | ||
| }); | ||
| let tenth_sec = Duration::from_millis(100); | ||
| thread::sleep(tenth_sec); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try waiting for longer ? Maybe the github docker images are slower than this to start the listening ? I have 1 s set on my grab branch to get it working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, that seems to have fixed it. Crazy. My rule of thumb is that 100ms is like 10 eternities for a computer. CI must be doing something weird that I'm not thinking of. Maybe Xvfb takes some time to initialize? Or maybe the CI server is virtualized on a host that is very busy. Regardless, I think this is ready to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect !
fixes #32 for Windows only, fixes #39 #40