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:
Themaister 2013-09-30 18:53:56 +02:00
parent 6fe01e3fcf
commit b3c1afe2ec
3 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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