@@ -53,7 +53,7 @@ public class GlobalKeyboardHook : IDisposable
5353 private Dictionary < int , bool > _keyStates = new ( ) ;
5454 private bool _wasHotkeyActive = false ;
5555 private volatile bool _isControlPressed = false ;
56-
56+
5757 // Drawing mode state - used to determine if we should suppress keys
5858 private volatile bool _isDrawingModeActive = false ;
5959
@@ -67,7 +67,7 @@ public GlobalKeyboardHook(ILogger<GlobalKeyboardHook> logger)
6767 foreach ( var vk in _hotkeyVKs )
6868 _keyStates [ vk ] = false ;
6969 }
70-
70+
7171 /// <summary>
7272 /// Configures the hotkey combination
7373 /// </summary>
@@ -186,7 +186,7 @@ private nint SetHook(LowLevelKeyboardProc proc)
186186 private nint HookCallback ( int nCode , nint wParam , nint lParam )
187187 {
188188 bool shouldSuppressKey = false ;
189-
189+
190190 try
191191 {
192192 if ( nCode >= 0 )
@@ -204,8 +204,8 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
204204 if ( vkCode == VK_LCONTROL || vkCode == VK_RCONTROL )
205205 {
206206 _isControlPressed = isKeyDown ;
207- _logger . LogDebug ( "Control key ({Type}) {State}" ,
208- vkCode == VK_LCONTROL ? "Left" : "Right" ,
207+ _logger . LogDebug ( "Control key ({Type}) {State}" ,
208+ vkCode == VK_LCONTROL ? "Left" : "Right" ,
209209 isKeyDown ? "PRESSED" : "RELEASED" ) ;
210210 }
211211
@@ -271,12 +271,12 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
271271 _logger . LogInformation ( "====== CTRL+S DETECTED ======" ) ;
272272 _logger . LogInformation ( "Control key state: {IsControlPressed}" , _isControlPressed ) ;
273273 _logger . LogInformation ( "Drawing mode active: {IsDrawingModeActive}" , _isDrawingModeActive ) ;
274-
274+
275275 _logger . LogInformation ( "Ctrl+S pressed - firing ScreenshotFullPressed event" ) ;
276276 ScreenshotFullPressed ? . Invoke ( this , EventArgs . Empty ) ;
277- _logger . LogInformation ( "ScreenshotFullPressed event fired, subscribers: {Count}" ,
277+ _logger . LogInformation ( "ScreenshotFullPressed event fired, subscribers: {Count}" ,
278278 ScreenshotFullPressed ? . GetInvocationList ( ) . Length ?? 0 ) ;
279-
279+
280280 // Suppress Ctrl+S when drawing mode is active to prevent Windows Snipping Tool
281281 if ( _isDrawingModeActive )
282282 {
@@ -287,7 +287,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
287287 {
288288 _logger . LogInformation ( "KEY WILL NOT BE SUPPRESSED - Drawing mode is inactive" ) ;
289289 }
290-
290+
291291 _logger . LogInformation ( "====== END CTRL+S HANDLING ======" ) ;
292292 }
293293
@@ -296,7 +296,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
296296 {
297297 _logger . LogInformation ( "Ctrl+Z pressed - firing UndoPressed event" ) ;
298298 UndoPressed ? . Invoke ( this , EventArgs . Empty ) ;
299-
299+
300300 // Suppress Ctrl+Z when drawing mode is active to prevent underlying apps from receiving it
301301 shouldSuppressKey = true ;
302302 _logger . LogDebug ( "Ctrl+Z suppressed - drawing mode is active" ) ;
@@ -341,7 +341,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
341341 _logger . LogTrace ( "Key suppressed - not calling CallNextHookEx" ) ;
342342 return ( nint ) 1 ;
343343 }
344-
344+
345345 // MUST call CallNextHookEx for non-suppressed keys to allow other applications to process them
346346 return CallNextHookEx ( _hookID , nCode , wParam , lParam ) ;
347347 }
@@ -372,7 +372,7 @@ public void SetDrawingModeActive(bool isActive)
372372 {
373373 var previousState = _isDrawingModeActive ;
374374 _isDrawingModeActive = isActive ;
375-
375+
376376 if ( previousState != isActive )
377377 {
378378 _logger . LogInformation ( "====== DRAWING MODE STATE CHANGED ======" ) ;
0 commit comments