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

Unified Diff: runtime/embedders/openglui/emulator/emulator_embedder.cc

Issue 12390045: Added a rudimentary DOM, to assist with event dispatch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: runtime/embedders/openglui/emulator/emulator_embedder.cc
===================================================================
--- runtime/embedders/openglui/emulator/emulator_embedder.cc (revision 19252)
+++ runtime/embedders/openglui/emulator/emulator_embedder.cc (working copy)
@@ -53,8 +53,8 @@
}
void keyboard(unsigned char key, int x, int y) {
- input_handler_ptr->OnKeyEvent(kKeyDown, time(0), 0, key, 0, 0);
- input_handler_ptr->OnKeyEvent(kKeyUp, time(0), 0, key, 0, 0);
+ input_handler_ptr->OnKeyEvent(kKeyDown, time(0), key, false, false, false, 0);
+ input_handler_ptr->OnKeyEvent(kKeyUp, time(0), key, false, false, false, 0);
if (key == 27) {
lifecycle_handler_ptr->Pause();
lifecycle_handler_ptr->Deactivate();
@@ -77,6 +77,18 @@
}
}
+void mouse(int button, int state, int x, int y) {
+ if (state == GLUT_UP) {
+ input_handler_ptr->OnMotionEvent(kMotionUp, time(0), x, y);
+ } else if (state == GLUT_DOWN) {
+ input_handler_ptr->OnMotionEvent(kMotionDown, time(0), x, y);
+ }
+}
+
+void motion(int x, int y) {
+ input_handler_ptr->OnMotionEvent(kMotionMove, time(0), x, y);
+}
+
DART_EXPORT void emulator_main(int argc, char** argv, const char* script) {
EmulatorGraphicsHandler graphics_handler(argc, argv);
if (argc > 0) {
@@ -102,6 +114,8 @@
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
+ glutMouseFunc(mouse);
+ glutMotionFunc(motion);
lifecycle_handler_ptr->OnStart();
lifecycle_handler_ptr->Activate();
lifecycle_handler_ptr->Resume();

Powered by Google App Engine
This is Rietveld 408576698