mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 19:38:14 +00:00
Don't send normal keyboard events if no application window has focus
This can happen if all the windows shown have the SDL_WINDOW_NOT_FOCUSABLE flag. We'll still accept modifier state changes though, so you can do Control-click actions.
This commit is contained in:
@@ -476,7 +476,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event)
|
|||||||
[data.fieldEdit setPendingKey:scancode scancode:code timestamp:Cocoa_GetEventTimestamp([event timestamp])];
|
[data.fieldEdit setPendingKey:scancode scancode:code timestamp:Cocoa_GetEventTimestamp([event timestamp])];
|
||||||
[data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
|
[data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
|
||||||
[data.fieldEdit sendPendingKey];
|
[data.fieldEdit sendPendingKey];
|
||||||
} else {
|
} else if (SDL_GetKeyboardFocus()) {
|
||||||
SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, true);
|
SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user