mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-04-30 07:37:51 +02:00
chore: linting
This commit is contained in:
@@ -127,7 +127,6 @@ objc2-app-kit = { version = "0.3.2", features = ["NSWindow", "NSApplication", "N
|
||||
winreg = "0.55"
|
||||
windows = { version = "0.62", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_System_Console",
|
||||
"Win32_System_ProcessStatus",
|
||||
"Win32_System_Threading",
|
||||
"Win32_System_Diagnostics_Debug",
|
||||
|
||||
@@ -190,21 +190,22 @@ fn run_daemon() {
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
unsafe {
|
||||
use windows::Win32::System::Console::{SetConsoleCtrlHandler, PHANDLER_ROUTINE};
|
||||
|
||||
unsafe extern "system" fn ctrl_handler(_ctrl_type: u32) -> windows::Win32::Foundation::BOOL {
|
||||
SHOULD_QUIT.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
windows::Win32::Foundation::TRUE
|
||||
{
|
||||
extern "system" {
|
||||
fn SetConsoleCtrlHandler(
|
||||
handler: Option<unsafe extern "system" fn(u32) -> i32>,
|
||||
add: i32,
|
||||
) -> i32;
|
||||
}
|
||||
|
||||
let _ = SetConsoleCtrlHandler(
|
||||
Some(std::mem::transmute::<
|
||||
unsafe extern "system" fn(u32) -> windows::Win32::Foundation::BOOL,
|
||||
PHANDLER_ROUTINE,
|
||||
>(ctrl_handler)),
|
||||
true,
|
||||
);
|
||||
unsafe extern "system" fn ctrl_handler(_ctrl_type: u32) -> i32 {
|
||||
SHOULD_QUIT.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
1 // TRUE
|
||||
}
|
||||
|
||||
unsafe {
|
||||
SetConsoleCtrlHandler(Some(ctrl_handler), 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the event loop
|
||||
|
||||
Reference in New Issue
Block a user