Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions openless-all/app/src-tauri/src/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,9 @@ mod platform {
if let Some(ctx) = callback_context() {
let keyboard = *(lparam.0 as *const KBDLLHOOKSTRUCT);
if keyboard.flags.0 & LLKHF_INJECTED == 0 || accept_injected_events() {
dispatch_keyboard_event(ctx, keyboard.vkCode, wparam.0);
if dispatch_keyboard_event(ctx, keyboard.vkCode, wparam.0) {
return LRESULT(1);
}
}
}
}
Expand All @@ -576,10 +578,10 @@ mod platform {
}
}

fn dispatch_keyboard_event(ctx: &CallbackContext, vk_code: u32, message: usize) {
fn dispatch_keyboard_event(ctx: &CallbackContext, vk_code: u32, message: usize) -> bool {
if vk_code == VK_ESCAPE && (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) {
send_or_log(&ctx.tx, HotkeyEvent::Cancelled);
return;
return false;
}

// Shift(任一侧)= 翻译模式修饰键。在录音过程中任意时刻按下都生效。详见 issue #4。
Expand All @@ -601,12 +603,12 @@ mod platform {
}
_ => {}
}
return;
return false;
}

let trigger = ctx.shared.binding.read().trigger;
if vk_code != trigger_to_vk_code(trigger) {
return;
return false;
}

match message {
Expand All @@ -626,6 +628,7 @@ mod platform {
}
_ => {}
}
true
}

fn trigger_to_vk_code(trigger: HotkeyTrigger) -> u32 {
Expand Down
Loading