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

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