android: enable resume key events

This commit is contained in:
rdb 2018-02-06 22:44:53 +01:00
parent d269f7c6c3
commit c15c05f642

View File

@ -396,8 +396,10 @@ create_surface() {
*/
void AndroidGraphicsWindow::
handle_command(struct android_app *app, int32_t command) {
AndroidGraphicsWindow* window = (AndroidGraphicsWindow*) app->userData;
window->ns_handle_command(command);
AndroidGraphicsWindow *window = (AndroidGraphicsWindow *)app->userData;
if (window != nullptr) {
window->ns_handle_command(command);
}
}
/**
@ -517,11 +519,15 @@ handle_key_event(const AInputEvent *event) {
// Is it an up or down event?
int32_t action = AKeyEvent_getAction(event);
if (action == AKEY_EVENT_ACTION_DOWN) {
_input_devices[0].button_down(button);
if (AKeyEvent_getRepeatCount(event) > 0) {
_input_devices[0].button_resume_down(button);
} else {
_input_devices[0].button_down(button);
}
} else if (action == AKEY_EVENT_ACTION_UP) {
_input_devices[0].button_up(button);
}
// TODO getRepeatCount, ACTION_MULTIPLE
// TODO AKEY_EVENT_ACTION_MULTIPLE
return 1;
}