-
Notifications
You must be signed in to change notification settings - Fork 224
migrate from winapi to windows-sys #189
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ use crate::windows::common::{HOOK, HookError, KEYBOARD, convert, set_key_hook, s | |
| use std::os::raw::c_int; | ||
| use std::ptr::null_mut; | ||
| use std::time::SystemTime; | ||
| use winapi::shared::minwindef::{LPARAM, LRESULT, WPARAM}; | ||
| use winapi::um::winuser::{CallNextHookEx, GetMessageA, HC_ACTION}; | ||
| use windows_sys::Win32::Foundation::{LPARAM, LRESULT, WPARAM}; | ||
| use windows_sys::Win32::UI::WindowsAndMessaging::{CallNextHookEx, GetMessageA, HC_ACTION}; | ||
|
|
||
| static mut GLOBAL_CALLBACK: Option<Box<dyn FnMut(Event)>> = None; | ||
|
|
||
|
|
@@ -19,7 +19,7 @@ impl From<HookError> for ListenError { | |
|
|
||
| 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 { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't understand what we should switch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am the guy from 3 year old PR #98, best to leave it for now. MS is unlikely to break compatibility. Although it is a good idea to add a feature flag if someone wants to use |
||
| let opt = convert(param, lpdata); | ||
| if let Some(event_type) = opt { | ||
| let name = match &event_type { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| extern crate winapi; | ||
|
|
||
| mod common; | ||
| mod display; | ||
| #[cfg(feature = "unstable_grab")] | ||
|
|
||
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.
We're casting right above, maybe we can drop both c_short casts.
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.
We have to keep both variables signed, since
get_deltaresults may be interpreted as a signed as stated in the functionIf 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.