Skip to content
This repository
Browse code

droid: fixed, useless verbose logging on new events and multiple inpu…

…t events handling (seen with game controllers)
  • Loading branch information...
commit d35d89317e7b875193e1f3b05dd2bfdfe7915520 1 parent ebd977f
authored August 16, 2013

Showing 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. 26  xbmc/android/activity/android_main.cpp
26  xbmc/android/activity/android_main.cpp
@@ -19,15 +19,41 @@
19 19
  */
20 20
 
21 21
 #include <stdlib.h>
  22
+#include <errno.h>
22 23
 #include <android_native_app_glue.h>
23 24
 #include "EventLoop.h"
24 25
 #include "XBMCApp.h"
25 26
 
  27
+// copied from new android_native_app_glue.c
  28
+static void process_input(struct android_app* app, struct android_poll_source* source) {
  29
+    AInputEvent* event = NULL;
  30
+    int processed = 0;
  31
+    while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
  32
+        if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
  33
+            continue;
  34
+        }
  35
+        int32_t handled = 0;
  36
+        if (app->onInputEvent != NULL) handled = app->onInputEvent(app, event);
  37
+        AInputQueue_finishEvent(app->inputQueue, event, handled);
  38
+        processed = 1;
  39
+    }
  40
+    if (processed == 0) {
  41
+        CXBMCApp::android_printf("process_input: Failure reading next input event: %s", strerror(errno));
  42
+    }
  43
+}
  44
+
26 45
 extern void android_main(struct android_app* state)
27 46
 {
28 47
   {
29 48
     // make sure that the linker doesn't strip out our glue
30 49
     app_dummy();
  50
+
  51
+    // revector inputPollSource.process so we can shut up
  52
+    // its useless verbose logging on new events (see ouya)
  53
+    // and fix the error in handling multiple input events.
  54
+    // see https://code.google.com/p/android/issues/detail?id=41755
  55
+    state->inputPollSource.process = process_input;
  56
+
31 57
     CEventLoop eventLoop(state);
32 58
     CXBMCApp xbmcApp(state->activity);
33 59
     if (xbmcApp.isValid())

0 notes on commit d35d893

Please sign in to comment.
Something went wrong with that request. Please try again.