enforce stricter lints, drop discarded results properly
This commit is contained in:
@@ -92,7 +92,7 @@ unsafe extern "system" fn enum_at_point(hwnd: HWND, lparam: LPARAM) -> BOOL {
|
||||
if IsIconic(hwnd).as_bool() {
|
||||
return BOOL(1);
|
||||
}
|
||||
let ex = GetWindowLongW(hwnd, GWL_EXSTYLE) as u32;
|
||||
let ex = GetWindowLongW(hwnd, GWL_EXSTYLE).cast_unsigned();
|
||||
if (ex & WS_EX_TOOLWINDOW.0) != 0 {
|
||||
return BOOL(1);
|
||||
}
|
||||
@@ -127,10 +127,10 @@ fn top_window_at(pt: POINT, exclude: &[isize]) -> Option<(isize, RECT)> {
|
||||
found: None,
|
||||
};
|
||||
unsafe {
|
||||
let _ = EnumWindows(
|
||||
drop(EnumWindows(
|
||||
Some(enum_at_point),
|
||||
LPARAM(&mut ctx as *mut EnumCtx as isize),
|
||||
);
|
||||
LPARAM(&raw mut ctx as *mut EnumCtx as isize),
|
||||
));
|
||||
}
|
||||
ctx.found
|
||||
}
|
||||
@@ -158,7 +158,7 @@ pub fn start(app: AppHandle, exclude_hwnds: Vec<isize>) -> PickerSession {
|
||||
|
||||
if let Some((id, rect)) = target {
|
||||
if id != last_hwnd {
|
||||
let class = unsafe { class_of(HWND(id as *mut _)) };
|
||||
let class = unsafe { class_of(HWND(id as *mut std::ffi::c_void)) };
|
||||
tracing::info!(
|
||||
"picker hover: hwnd={:x} class={} rect=({},{}) {}x{}",
|
||||
id,
|
||||
@@ -168,15 +168,15 @@ pub fn start(app: AppHandle, exclude_hwnds: Vec<isize>) -> PickerSession {
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top
|
||||
);
|
||||
let _ = app.emit(
|
||||
drop(app.emit(
|
||||
"picker-hover",
|
||||
Rect {
|
||||
x: rect.left,
|
||||
y: rect.top,
|
||||
width: (rect.right - rect.left).max(0) as u32,
|
||||
height: (rect.bottom - rect.top).max(0) as u32,
|
||||
width: (rect.right - rect.left).max(0).cast_unsigned(),
|
||||
height: (rect.bottom - rect.top).max(0).cast_unsigned(),
|
||||
},
|
||||
);
|
||||
));
|
||||
last_hwnd = id;
|
||||
}
|
||||
} else if last_hwnd != 0 {
|
||||
@@ -185,27 +185,27 @@ pub fn start(app: AppHandle, exclude_hwnds: Vec<isize>) -> PickerSession {
|
||||
}
|
||||
|
||||
let pressed =
|
||||
unsafe { (GetAsyncKeyState(VK_LBUTTON) as u16 & 0x8000) != 0 };
|
||||
unsafe { (GetAsyncKeyState(VK_LBUTTON).cast_unsigned() & 0x8000) != 0 };
|
||||
if pressed && !last_pressed {
|
||||
if let Some((_, rect)) = target {
|
||||
let _ = app.emit(
|
||||
drop(app.emit(
|
||||
"picker-pick",
|
||||
Rect {
|
||||
x: rect.left,
|
||||
y: rect.top,
|
||||
width: (rect.right - rect.left).max(0) as u32,
|
||||
height: (rect.bottom - rect.top).max(0) as u32,
|
||||
width: (rect.right - rect.left).max(0).cast_unsigned(),
|
||||
height: (rect.bottom - rect.top).max(0).cast_unsigned(),
|
||||
},
|
||||
);
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
last_pressed = pressed;
|
||||
|
||||
let esc =
|
||||
unsafe { (GetAsyncKeyState(VK_ESCAPE) as u16 & 0x8000) != 0 };
|
||||
unsafe { (GetAsyncKeyState(VK_ESCAPE).cast_unsigned() & 0x8000) != 0 };
|
||||
if esc && !last_esc {
|
||||
let _ = app.emit("picker-cancel", ());
|
||||
drop(app.emit("picker-cancel", ()));
|
||||
break;
|
||||
}
|
||||
last_esc = esc;
|
||||
@@ -224,7 +224,7 @@ impl PickerSession {
|
||||
pub fn stop(mut self) {
|
||||
self.running.store(false, Ordering::Relaxed);
|
||||
if let Some(h) = self.handle.take() {
|
||||
let _ = h.join();
|
||||
drop(h.join());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user