2
0
Эх сурвалжийг харах

android: enable resume key events

rdb 7 жил өмнө
parent
commit
c15c05f642

+ 10 - 4
panda/src/androiddisplay/androidGraphicsWindow.cxx

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