comparison src/video/cocoa/SDL_cocoakeyboard.m @ 5223:572a73d71b5f

Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Feb 2011 09:37:11 -0800
parents 25d4feb7c127
children c1a92e61907d
comparison
equal deleted inserted replaced
5222:9c0593fa27d6 5223:572a73d71b5f
244 */ 244 */
245 static void 245 static void
246 HandleNonDeviceModifier(unsigned int device_independent_mask, 246 HandleNonDeviceModifier(unsigned int device_independent_mask,
247 unsigned int oldMods, 247 unsigned int oldMods,
248 unsigned int newMods, 248 unsigned int newMods,
249 SDL_ScanCode scancode) 249 SDL_Scancode scancode)
250 { 250 {
251 unsigned int oldMask, newMask; 251 unsigned int oldMask, newMask;
252 252
253 /* Isolate just the bits we care about in the depedent bits so we can 253 /* Isolate just the bits we care about in the depedent bits so we can
254 * figure out what changed 254 * figure out what changed
266 /* This is a helper function for HandleModifierSide. 266 /* This is a helper function for HandleModifierSide.
267 * This function sets the actual SDL_PrivateKeyboard event. 267 * This function sets the actual SDL_PrivateKeyboard event.
268 */ 268 */
269 static void 269 static void
270 HandleModifierOneSide(unsigned int oldMods, unsigned int newMods, 270 HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
271 SDL_ScanCode scancode, 271 SDL_Scancode scancode,
272 unsigned int sided_device_dependent_mask) 272 unsigned int sided_device_dependent_mask)
273 { 273 {
274 unsigned int old_dep_mask, new_dep_mask; 274 unsigned int old_dep_mask, new_dep_mask;
275 275
276 /* Isolate just the bits we care about in the depedent bits so we can 276 /* Isolate just the bits we care about in the depedent bits so we can
295 * e.g. left-shift vs right-shift. 295 * e.g. left-shift vs right-shift.
296 */ 296 */
297 static void 297 static void
298 HandleModifierSide(int device_independent_mask, 298 HandleModifierSide(int device_independent_mask,
299 unsigned int oldMods, unsigned int newMods, 299 unsigned int oldMods, unsigned int newMods,
300 SDL_ScanCode left_scancode, 300 SDL_Scancode left_scancode,
301 SDL_ScanCode right_scancode, 301 SDL_Scancode right_scancode,
302 unsigned int left_device_dependent_mask, 302 unsigned int left_device_dependent_mask,
303 unsigned int right_device_dependent_mask) 303 unsigned int right_device_dependent_mask)
304 { 304 {
305 unsigned int device_dependent_mask = (left_device_dependent_mask | 305 unsigned int device_dependent_mask = (left_device_dependent_mask |
306 right_device_dependent_mask); 306 right_device_dependent_mask);
339 * can't still be down). 339 * can't still be down).
340 */ 340 */
341 static void 341 static void
342 ReleaseModifierSide(unsigned int device_independent_mask, 342 ReleaseModifierSide(unsigned int device_independent_mask,
343 unsigned int oldMods, unsigned int newMods, 343 unsigned int oldMods, unsigned int newMods,
344 SDL_ScanCode left_scancode, 344 SDL_Scancode left_scancode,
345 SDL_ScanCode right_scancode, 345 SDL_Scancode right_scancode,
346 unsigned int left_device_dependent_mask, 346 unsigned int left_device_dependent_mask,
347 unsigned int right_device_dependent_mask) 347 unsigned int right_device_dependent_mask)
348 { 348 {
349 unsigned int device_dependent_mask = (left_device_dependent_mask | 349 unsigned int device_dependent_mask = (left_device_dependent_mask |
350 right_device_dependent_mask); 350 right_device_dependent_mask);
407 static void 407 static void
408 DoSidedModifiers(unsigned short scancode, 408 DoSidedModifiers(unsigned short scancode,
409 unsigned int oldMods, unsigned int newMods) 409 unsigned int oldMods, unsigned int newMods)
410 { 410 {
411 /* Set up arrays for the key syms for the left and right side. */ 411 /* Set up arrays for the key syms for the left and right side. */
412 const SDL_ScanCode left_mapping[] = { 412 const SDL_Scancode left_mapping[] = {
413 SDL_SCANCODE_LSHIFT, 413 SDL_SCANCODE_LSHIFT,
414 SDL_SCANCODE_LCTRL, 414 SDL_SCANCODE_LCTRL,
415 SDL_SCANCODE_LALT, 415 SDL_SCANCODE_LALT,
416 SDL_SCANCODE_LGUI 416 SDL_SCANCODE_LGUI
417 }; 417 };
418 const SDL_ScanCode right_mapping[] = { 418 const SDL_Scancode right_mapping[] = {
419 SDL_SCANCODE_RSHIFT, 419 SDL_SCANCODE_RSHIFT,
420 SDL_SCANCODE_RCTRL, 420 SDL_SCANCODE_RCTRL,
421 SDL_SCANCODE_RALT, 421 SDL_SCANCODE_RALT,
422 SDL_SCANCODE_RGUI 422 SDL_SCANCODE_RGUI
423 }; 423 };
487 #else 487 #else
488 KeyboardLayoutRef key_layout; 488 KeyboardLayoutRef key_layout;
489 #endif 489 #endif
490 const void *chr_data; 490 const void *chr_data;
491 int i; 491 int i;
492 SDL_ScanCode scancode; 492 SDL_Scancode scancode;
493 SDLKey keymap[SDL_NUM_SCANCODES]; 493 SDLKey keymap[SDL_NUM_SCANCODES];
494 494
495 /* See if the keymap needs to be updated */ 495 /* See if the keymap needs to be updated */
496 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 496 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
497 key_layout = TISCopyCurrentKeyboardLayoutInputSource(); 497 key_layout = TISCopyCurrentKeyboardLayoutInputSource();
673 void 673 void
674 Cocoa_HandleKeyEvent(_THIS, NSEvent *event) 674 Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
675 { 675 {
676 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 676 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
677 unsigned short scancode = [event keyCode]; 677 unsigned short scancode = [event keyCode];
678 SDL_ScanCode code; 678 SDL_Scancode code;
679 #if 0 679 #if 0
680 const char *text; 680 const char *text;
681 #endif 681 #endif
682 682
683 if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) { 683 if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) {