这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@maxbla
Copy link
Contributor

@maxbla maxbla commented Mar 31, 2020

fixes #32 for Windows only, fixes #39 #40

maxbla added 3 commits March 31, 2020 11:30
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 {
Copy link
Contributor Author

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.

@maxbla
Copy link
Contributor Author

maxbla commented Mar 31, 2020

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.

Copy link
Owner

@Narsil Narsil left a 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.

@maxbla
Copy link
Contributor Author

maxbla commented Apr 1, 2020

Okay, now I have no clue why Ubuntu tests are failing. They pass on my local computer...

listen(send_event).expect("Could not listen");
});
let tenth_sec = Duration::from_millis(100);
thread::sleep(tenth_sec);
Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

Choose a reason for hiding this comment

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

Perfect !

@Narsil Narsil merged commit 128ccc7 into Narsil:master Apr 2, 2020
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.

Simulating scroll doesn't work on Windows

2 participants