 +    return event;
 +  }
 +
-+   void PushEvent(SDL_NACL_Event* event) {
++   void PushEvent(SDL_Event* event) {
 +    SDL_LockMutex(mu_);
 +    queue_.push(event);
 +    SDL_UnlockMutex(mu_);
 +   } 
 +
 +private:
-+  std::queue<SDL_NACL_Event*> queue_;
++  std::queue<SDL_Event*> queue_;
 +  SDL_mutex* mu_;
 +};
 +

+        keysym.sym = translateKey(keysym.scancode);
+      }
+    } else {  // event->type == PP_INPUTEVENT_TYPE_KEYUP
+      last_scancode = 0;
+    }
+    keysym.mod = KMOD_NONE;
+    event->keysym = keysym;
+  } else {
+    free(event);
+    return;
+  }
+  event_queue.PushEvent(event);
+}
+
+void NACL_PumpEvents(_THIS) {
+  SDL_NACL_Event* event;
+  while (event = event_queue.PopEvent()) {
+    if (event->type == PP_INPUTEVENT_TYPE_MOUSEDOWN) {
+      SDL_PrivateMouseButton(SDL_PRESSED, event->button, 0, 0);
+    } else if (event->type == PP_INPUTEVENT_TYPE_MOUSEUP) {
+      SDL_PrivateMouseButton(SDL_RELEASED, event->button, 0, 0);
+    } else if (event->type == PP_INPUTEVENT_TYPE_WHEEL) {
+      Uint8 button = event->wheel_clicks_x > 0 ? SDL_BUTTON_X1 : SDL_BUTTON_X2;
+      int count = abs(event->wheel_clicks_x);
+      while (count--) {
+        SDL_PrivateMouseButton(SDL_PRESSED, button, 0, 0);
+        SDL_PrivateMouseButton(SDL_RELEASED, button, 0, 0);
+      }
+      button = event->wheel_clicks_y > 0 ? SDL_BUTTON_WHEELUP : SDL_BUTTON_WHEELDOWN;
+      count = abs(event->wheel_clicks_y);
+      while (count--) {
+        SDL_PrivateMouseButton(SDL_PRESSED, button, 0, 0);
+        SDL_PrivateMouseButton(SDL_RELEASED, button, 0, 0);
+      }
+    } else if (event->type == PP_INPUTEVENT_TYPE_MOUSEMOVE) {
+      SDL_PrivateMouseMotion(0, 0, event->x, event->y);
+    } else if (event->type == PP_INPUTEVENT_TYPE_KEYDOWN || event->type == PP_INPUTEVENT_TYPE_CHAR) {
+      SDL_PrivateKeyboard(SDL_PRESSED, &event->keysym);
+    } else if (event->type == PP_INPUTEVENT_TYPE_KEYUP) {
+      SDL_PrivateKeyboard(SDL_RELEASED, &event->keysym);
+    }
+    free(event);
+  }

+#include <ppapi/c/ppp_instance.h>
+void SDL_NACL_SetInstance(PP_Instance instance, int width, int height);
+void SDL_NACL_PushEvent(const pp::InputEvent& ppevent);
+void SDL_NACL_SetHasFocus(bool has_focus);
+void SDL_NACL_SetPageVisible(bool is_visible);
+
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
