mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Mac: Fix keyboard state if capslock was toggled while app wasn't in foreground.
This commit is contained in:
parent
fa7c15ce1f
commit
d3b323f89d
@ -588,6 +588,17 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
|
||||
if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
|
||||
[NSMenu setMenuBarVisible:NO];
|
||||
}
|
||||
|
||||
/* On pre-10.6, you might have the capslock key state wrong now. */
|
||||
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) {
|
||||
const unsigned int oldflags = _data->videodata->modifierFlags & NSAlphaShiftKeyMask;
|
||||
const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask;
|
||||
if (oldflags != newflags) {
|
||||
_data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags;
|
||||
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||
|
Loading…
Reference in New Issue
Block a user