mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +00:00
macos: reset keyboard state when focus is lost (#17453)
This commit is contained in:
parent
66e23fca79
commit
f1e3b83d26
@ -78,6 +78,11 @@ static UISelectionFeedbackGenerator *feedbackGenerator;
|
|||||||
|
|
||||||
static bool apple_key_state[MAX_KEYS];
|
static bool apple_key_state[MAX_KEYS];
|
||||||
|
|
||||||
|
void apple_input_keyboard_reset(void)
|
||||||
|
{
|
||||||
|
memset(apple_key_state, 0, sizeof(apple_key_state));
|
||||||
|
}
|
||||||
|
|
||||||
/* Send keyboard inputs directly using RETROK_* codes
|
/* Send keyboard inputs directly using RETROK_* codes
|
||||||
* Used by the iOS custom keyboard implementation */
|
* Used by the iOS custom keyboard implementation */
|
||||||
void apple_direct_input_keyboard_event(bool down,
|
void apple_direct_input_keyboard_event(bool down,
|
||||||
@ -743,8 +748,7 @@ static void cocoa_input_free(void *data)
|
|||||||
if (!apple || !data)
|
if (!apple || !data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < MAX_KEYS; i++)
|
memset(apple_key_state, 0, sizeof(apple_key_state));
|
||||||
apple_key_state[i] = 0;
|
|
||||||
|
|
||||||
free(apple);
|
free(apple);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,8 @@ enum
|
|||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
|
void apple_input_keyboard_reset(void);
|
||||||
|
|
||||||
void apple_input_keyboard_event(bool down,
|
void apple_input_keyboard_event(bool down,
|
||||||
unsigned code, uint32_t character, uint32_t mod, unsigned device);
|
unsigned code, uint32_t character, uint32_t mod, unsigned device);
|
||||||
|
|
||||||
|
@ -824,7 +824,10 @@ static ui_application_t ui_application_cocoa = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(NSNotification *)notification { }
|
- (void)applicationDidBecomeActive:(NSNotification *)notification { }
|
||||||
- (void)applicationWillResignActive:(NSNotification *)notification { }
|
- (void)applicationWillResignActive:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
apple_input_keyboard_reset();
|
||||||
|
}
|
||||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { return YES; }
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { return YES; }
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user