From f3eca34d33f80efb6fdcff268f436f1af927592c Mon Sep 17 00:00:00 2001 From: youtsuho <110821381+youtsuhodev@users.noreply.github.com> Date: Tue, 21 Jul 2026 06:07:33 +0200 Subject: [PATCH] fix: gate macOS-only keyboard_layout symbols behind cfg (#831) * fix: gate macOS-only keyboard_layout symbols behind cfg to suppress dead_code warnings * chore: sync bun.lock with package.json --- tauri/src-tauri/src/keyboard_layout.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tauri/src-tauri/src/keyboard_layout.rs b/tauri/src-tauri/src/keyboard_layout.rs index cb13ffbb..5d27afd2 100644 --- a/tauri/src-tauri/src/keyboard_layout.rs +++ b/tauri/src-tauri/src/keyboard_layout.rs @@ -19,19 +19,23 @@ //! regardless of the active layout — most Windows apps treat that as //! Ctrl+V. AutoHotkey relies on the same behaviour. +#[cfg(target_os = "macos")] use std::sync::atomic::{AtomicU16, Ordering}; /// `kVK_ANSI_V` — the keycode for the physical V key on a US QWERTY /// layout. Used as the fallback whenever live resolution can't produce a /// better answer (no Unicode key layout data, lookup failure, non-macOS). +#[cfg(target_os = "macos")] const FALLBACK_V_KEYCODE: u16 = 9; +#[cfg(target_os = "macos")] static V_KEYCODE: AtomicU16 = AtomicU16::new(FALLBACK_V_KEYCODE); /// Returns the keycode whose current-layout translation is `'v'`. Falls /// back to `kVK_ANSI_V` when resolution hasn't run, the active input /// source carries no Unicode key layout data, or no keycode in the layout /// produces `v`. +#[cfg(target_os = "macos")] pub fn paste_keycode_v() -> u16 { V_KEYCODE.load(Ordering::Relaxed) }