Skip to content

Commit

Permalink
Don't send normal keyboard events if no application window has focus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jan 15, 2025
1 parent 7c39d1a commit 21c90bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoakeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 interpretKeyEvents:[NSArray arrayWithObject:event]];
[data.fieldEdit sendPendingKey];
} else {
} else if (SDL_GetKeyboardFocus()) {
SDL_SendKeyboardKey(Cocoa_GetEventTimestamp([event timestamp]), SDL_DEFAULT_KEYBOARD_ID, scancode, code, true);
}
break;
Expand Down

0 comments on commit 21c90bf

Please sign in to comment.