comparison src/video/cocoa/SDL_cocoakeyboard.m @ 5083:25d4feb7c127

Renamed SDL_keysym to SDL_KeySym Renamed SDL_scancode to SDL_ScanCode Added #defines to SDL_compat.h
author krogoway
date Mon, 24 Jan 2011 13:47:35 -0600
parents 514f811a4887
children 572a73d71b5f
comparison
equal deleted inserted replaced
5082:de59e0218aa2 5083:25d4feb7c127
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) {