mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
android: enable resume key events
This commit is contained in:
parent
d269f7c6c3
commit
c15c05f642
@ -396,8 +396,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;
|
||||||
window->ns_handle_command(command);
|
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?
|
// 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) {
|
||||||
_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) {
|
} 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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user