Added numlock support
authorSam Lantinga <slouken@libsdl.org>
Sun, 30 Jul 2006 06:11:24 +0000
changeset 1960 118daa3a24cc
parent 1959 25d6537feea4
child 1961 f42f10fc309e
Added numlock support
src/video/cocoa/SDL_cocoakeyboard.h
src/video/cocoa/SDL_cocoakeyboard.m
--- a/src/video/cocoa/SDL_cocoakeyboard.h	Sun Jul 30 05:18:33 2006 +0000
+++ b/src/video/cocoa/SDL_cocoakeyboard.h	Sun Jul 30 06:11:24 2006 +0000
@@ -25,6 +25,7 @@
 #define _SDL_cocoakeyboard_h
 
 extern void Cocoa_InitKeyboard(_THIS);
+extern void Cocoa_HandleKeyEvent(_THIS, NSEvent *event);
 extern void Cocoa_QuitKeyboard(_THIS);
 
 #endif /* _SDL_cocoakeyboard_h */
--- a/src/video/cocoa/SDL_cocoakeyboard.m	Sun Jul 30 05:18:33 2006 +0000
+++ b/src/video/cocoa/SDL_cocoakeyboard.m	Sun Jul 30 06:11:24 2006 +0000
@@ -423,6 +423,14 @@
         SDL_SendKeyboardKey(keyboard, SDL_PRESSED, (Uint8)scancode, SDLK_CAPSLOCK);
         SDL_SendKeyboardKey(keyboard, SDL_RELEASED, (Uint8)scancode, SDLK_CAPSLOCK);
     }
+
+    oldMask = oldMods & NSNumericPadKeyMask;
+    newMask = newMods & NSNumericPadKeyMask;
+
+    if (oldMask != newMask) {
+        SDL_SendKeyboardKey(keyboard, SDL_PRESSED, (Uint8)scancode, SDLK_NUMLOCK);
+        SDL_SendKeyboardKey(keyboard, SDL_RELEASED, (Uint8)scancode, SDLK_NUMLOCK);
+    }
 }
 
 /* This function will handle the modifier keys and also determine the