Skip to content
Permalink
Browse files

Mac: make sure SDL keyboard state reflects system capslock state at s…

…tartup.
  • Loading branch information
icculus committed Dec 27, 2015
1 parent 1446faf commit faed05850eef00f5b9dda3f7c53d80f6fb9d0411
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/video/cocoa/SDL_cocoakeyboard.m
@@ -497,6 +497,15 @@ - (NSArray *)validAttributesForMarkedText
SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command");
SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option");
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");

/* On pre-10.6, you might have the initial capslock key state wrong. */
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) {
data->modifierFlags = [NSEvent modifierFlags];
if (data->modifierFlags & NSAlphaShiftKeyMask) {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
}
}
}

void

0 comments on commit faed058

Please sign in to comment.