mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Redirect keyboard events to RGUI.
Fixes issue where libretro cores receive keyboard events even though they are not running (inside RGUI).
This commit is contained in:
parent
6fe01e3fcf
commit
b3c1afe2ec
@ -215,6 +215,11 @@ int main_entry(int argc, char *argv[])
|
||||
driver_set_rumble_state(i, RETRO_RUMBLE_WEAK, 0);
|
||||
}
|
||||
|
||||
// Override keyboard callback to redirect to menu instead.
|
||||
// We'll use this later for something ...
|
||||
retro_keyboard_event_t key_event = g_extern.system.key_event;
|
||||
g_extern.system.key_event = menu_key_event;
|
||||
|
||||
if (driver.audio_data)
|
||||
audio_stop_func();
|
||||
|
||||
@ -236,6 +241,9 @@ int main_entry(int argc, char *argv[])
|
||||
}
|
||||
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU);
|
||||
|
||||
// Restore libretro keyboard callback.
|
||||
g_extern.system.key_event = key_event;
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
@ -911,3 +911,12 @@ bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_stat
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers)
|
||||
{
|
||||
// TODO: Do something with this. Stub for now.
|
||||
(void)down;
|
||||
(void)keycode;
|
||||
(void)character;
|
||||
(void)key_modifiers;
|
||||
}
|
||||
|
||||
|
@ -355,6 +355,8 @@ bool menu_save_new_config(void);
|
||||
int menu_set_settings(unsigned setting, unsigned action);
|
||||
extern const unsigned rgui_controller_lut[];
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user