Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: runtime/embedders/openglui/android/eventloop.h

Issue 13042015: Various OpenGLUI changes: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ 5 #ifndef EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_
6 #define EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ 6 #define EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_
7 7
8 #include <android_native_app_glue.h> 8 #include <android_native_app_glue.h>
9 #include <android/sensor.h>
9 #include "embedders/openglui/common/events.h" 10 #include "embedders/openglui/common/events.h"
10 #include "embedders/openglui/common/input_handler.h" 11 #include "embedders/openglui/common/input_handler.h"
11 #include "embedders/openglui/common/lifecycle_handler.h" 12 #include "embedders/openglui/common/lifecycle_handler.h"
12 13
13 class EventLoop { 14 class EventLoop {
14 public: 15 public:
15 explicit EventLoop(android_app* application); 16 explicit EventLoop(android_app* application);
16 void Run(LifeCycleHandler* activity_handler, 17 void Run(LifeCycleHandler* activity_handler,
17 InputHandler* input_handler); 18 InputHandler* input_handler);
18 19
19 protected: 20 protected:
21 void EnableSensorEvents();
22 void DisableSensorEvents();
23
20 void ProcessActivityEvent(int32_t command); 24 void ProcessActivityEvent(int32_t command);
21 int32_t ProcessInputEvent(AInputEvent* event); 25 int32_t ProcessInputEvent(AInputEvent* event);
26 void ProcessSensorEvent();
27
22 bool OnTouchEvent(AInputEvent* event); 28 bool OnTouchEvent(AInputEvent* event);
23 bool OnKeyEvent(AInputEvent* event); 29 bool OnKeyEvent(AInputEvent* event);
24 30
25 static void ActivityCallback(android_app* application, int32_t command); 31 static void ActivityCallback(android_app* application, int32_t command);
26 static int32_t InputCallback(android_app* application, AInputEvent* event); 32 static int32_t InputCallback(android_app* application, AInputEvent* event);
33 static void SensorCallback(android_app* application,
34 android_poll_source* source);
27 35
28 private: 36 private:
37 friend class Sensor;
38
29 bool enabled_, quit_; 39 bool enabled_, quit_;
30 bool isResumed_, hasSurface_, hasFocus_; 40 bool isResumed_, hasSurface_, hasFocus_;
31 android_app* application_; 41 android_app* application_;
32 LifeCycleHandler* lifecycle_handler_; 42 LifeCycleHandler* lifecycle_handler_;
33 InputHandler* input_handler_; 43 InputHandler* input_handler_;
44 const ASensor* sensor_;
45 ASensorManager* sensor_manager_;
46 ASensorEventQueue* sensor_event_queue_;
47 android_poll_source sensor_poll_source_;
34 }; 48 };
35 49
36 #endif // EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_ 50 #endif // EMBEDDERS_OPENGLUI_ANDROID_EVENTLOOP_H_
37 51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698