From 3fbceec8de833416bf1ae049f959f222c3f1a4a0 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Tue, 02 Jun 2026 14:05:59 +0800
Subject: [PATCH] Prepare Round 1 model profile QA baseline

---
 privatevoice.src/internal/hotkey/hotkey_darwin.go |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/VoiceSnapGo/internal/hotkey/hotkey_darwin.go b/privatevoice.src/internal/hotkey/hotkey_darwin.go
similarity index 96%
rename from VoiceSnapGo/internal/hotkey/hotkey_darwin.go
rename to privatevoice.src/internal/hotkey/hotkey_darwin.go
index 1ddda60..043b4ee 100755
--- a/VoiceSnapGo/internal/hotkey/hotkey_darwin.go
+++ b/privatevoice.src/internal/hotkey/hotkey_darwin.go
@@ -151,7 +151,7 @@
 	if (g_activityToken != nil) return;
 	g_activityToken = [[NSProcessInfo processInfo]
 		beginActivityWithOptions:NSActivityUserInitiatedAllowingIdleSystemSleep
-		reason:@"VoiceSnap global hotkey listener"];
+		reason:@"PrivateVoice Input global hotkey listener"];
 }
 
 static void* eventTapThreadMain(void* arg) {
@@ -186,9 +186,16 @@
 static int isSideModifierDown(int keyCode) {
 	if (keyCode >= 0 && keyCode < 128) {
 		if (CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, (CGKeyCode)keyCode)) return 1;
-		if (g_keysDown[keyCode] && g_lastDownAt[keyCode] > 0 && nowSeconds() - g_lastDownAt[keyCode] < 0.25) return 1;
-		if (g_keysDown[keyCode]) g_keysDown[keyCode] = 0;
-		if (g_lastDownAt[keyCode] > 0 && nowSeconds() - g_lastDownAt[keyCode] < 0.12) return 1;
+		unsigned long long mask = modifierMaskForKey((unsigned short)keyCode);
+		int modifierDown = mask != 0 ? isModifierDown(mask) : 0;
+		double age = g_lastDownAt[keyCode] > 0 ? nowSeconds() - g_lastDownAt[keyCode] : 999.0;
+		if (g_keysDown[keyCode]) {
+			if (modifierDown) return 1;
+			if (age < 0.25) return 1;
+			g_keysDown[keyCode] = 0;
+			return 0;
+		}
+		if (age < 0.12) return 1;
 	}
 	return 0;
 }
@@ -325,7 +332,7 @@
 	C.beginHotkeyActivity()
 	trusted := C.ensureAccessibility()
 	if trusted == 0 {
-		logger.Info("Accessibility permission not granted for current app identity — hotkey won't work until VoiceSnap is removed and re-added in System Settings > Privacy & Security > Accessibility")
+		logger.Info("Accessibility permission not granted for current app identity — hotkey won't work until PrivateVoice Input is removed and re-added in System Settings > Privacy & Security > Accessibility")
 	} else {
 		logger.Info("Accessibility permission granted")
 	}

--
Gitblit v1.9.3