Index: blimp/client/android/blimp_view.cc |
diff --git a/blimp/client/android/blimp_view.cc b/blimp/client/android/blimp_view.cc |
index cec7e3a64b213e6e490c70bcd606bd10fda7866c..79633f799bdbfc37c3af0c7aa40234274a726eff 100644 |
--- a/blimp/client/android/blimp_view.cc |
+++ b/blimp/client/android/blimp_view.cc |
@@ -8,6 +8,7 @@ |
#include "blimp/client/compositor/blimp_compositor_android.h" |
#include "jni/BlimpView_jni.h" |
+#include "ui/events/android/motion_event_android.h" |
#include "ui/gfx/geometry/size.h" |
namespace blimp { |
@@ -35,7 +36,8 @@ BlimpView::BlimpView(JNIEnv* env, |
const gfx::Size& real_size, |
const gfx::Size& size, |
float dp_to_px) |
- : compositor_(BlimpCompositorAndroid::Create(real_size, size, dp_to_px)), |
+ : device_scale_factor_(dp_to_px), |
+ compositor_(BlimpCompositorAndroid::Create(real_size, size, dp_to_px)), |
current_surface_format_(0), |
window_(gfx::kNullAcceleratedWidget) { |
java_obj_.Reset(env, jobj); |
@@ -94,4 +96,66 @@ void BlimpView::ReleaseAcceleratedWidget() { |
window_ = gfx::kNullAcceleratedWidget; |
} |
+jboolean BlimpView::OnTouchEvent(JNIEnv* env, |
+ jobject obj, |
+ jobject motion_event, |
+ jlong time_ms, |
+ jint android_action, |
+ jint pointer_count, |
+ jint history_size, |
+ jint action_index, |
+ jfloat pos_x_0, |
+ jfloat pos_y_0, |
+ jfloat pos_x_1, |
+ jfloat pos_y_1, |
+ jint pointer_id_0, |
+ jint pointer_id_1, |
+ jfloat touch_major_0, |
+ jfloat touch_major_1, |
+ jfloat touch_minor_0, |
+ jfloat touch_minor_1, |
+ jfloat orientation_0, |
+ jfloat orientation_1, |
+ jfloat tilt_0, |
+ jfloat tilt_1, |
+ jfloat raw_pos_x, |
+ jfloat raw_pos_y, |
+ jint android_tool_type_0, |
+ jint android_tool_type_1, |
+ jint android_button_state, |
+ jint android_meta_state) { |
+ ui::MotionEventAndroid::Pointer pointer0(pointer_id_0, |
+ pos_x_0, |
+ pos_y_0, |
+ touch_major_0, |
+ touch_minor_0, |
+ orientation_0, |
+ tilt_0, |
+ android_tool_type_0); |
+ ui::MotionEventAndroid::Pointer pointer1(pointer_id_1, |
+ pos_x_1, |
+ pos_y_1, |
+ touch_major_1, |
+ touch_minor_1, |
+ orientation_1, |
+ tilt_1, |
+ android_tool_type_1); |
+ ui::MotionEventAndroid event(1.f / device_scale_factor_, |
+ env, |
+ motion_event, |
+ time_ms, |
+ android_action, |
+ pointer_count, |
+ history_size, |
+ action_index, |
+ android_button_state, |
+ android_meta_state, |
+ raw_pos_x - pos_x_0, |
+ raw_pos_y - pos_y_0, |
+ pointer0, |
+ pointer1); |
+ |
+ return compositor_->OnTouchEvent(event); |
+} |
+ |
} // namespace blimp |