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);
|
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)
|
if (driver.audio_data)
|
||||||
audio_stop_func();
|
audio_stop_func();
|
||||||
|
|
||||||
|
@ -236,6 +241,9 @@ int main_entry(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU);
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU);
|
||||||
|
|
||||||
|
// Restore libretro keyboard callback.
|
||||||
|
g_extern.system.key_event = key_event;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -911,3 +911,12 @@ bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_stat
|
||||||
return false;
|
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);
|
int menu_set_settings(unsigned setting, unsigned action);
|
||||||
extern const unsigned rgui_controller_lut[];
|
extern const unsigned rgui_controller_lut[];
|
||||||
|
|
||||||
|
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue