changeset 1960:118daa3a24cc

Added numlock support
author Sam Lantinga <slouken@libsdl.org>
date Sun, 30 Jul 2006 06:11:24 +0000
parents 25d6537feea4
children f42f10fc309e
files src/video/cocoa/SDL_cocoakeyboard.h src/video/cocoa/SDL_cocoakeyboard.m
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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