migrate from winapi to windows-sys#189
Conversation
|
I somehow failed to see that #98 exists... |
| Some(EventType::Wheel { | ||
| delta_x: 0, | ||
| delta_y: (delta / WHEEL_DELTA) as i64, | ||
| delta_y: (delta / WHEEL_DELTA as c_short) as i64, |
There was a problem hiding this comment.
We're casting right above, maybe we can drop both c_short casts.
There was a problem hiding this comment.
We have to keep both variables signed, since get_delta results may be interpreted as a signed as stated in the function
If we were to delete the delta cast we would still need to cast WHEEL_DATA to u16, and it would break the logic, since all the values would now be positive.
| unsafe extern "system" fn raw_callback(code: c_int, param: WPARAM, lpdata: LPARAM) -> LRESULT { | ||
| unsafe { | ||
| if code == HC_ACTION { | ||
| if code == HC_ACTION as c_int { |
There was a problem hiding this comment.
If c_int is not the native type, maybe we should switch.
There was a problem hiding this comment.
Sorry, I don't understand what we should switch.
HC_ACTION in winapi was of type c_int but in windows-sys is u32.
The code variable seems to come as a parameter from a callback that is given to SetWindowsHookExA so I think it's probably better to leave it as a c_int.
Just thought it was good measure to leave the
winapicrate as it unmaintained and the new default are the officialwindows-*crates.From my testing, the same tests pass and behavior is the same.