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

Unified Diff: remoting/client/gesture_interpreter.cc

Issue 2904703003: [CRD iOS] Add support for three-finger gestures (Closed)
Patch Set: Remove unused import Created 3 years, 7 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
« no previous file with comments | « remoting/client/gesture_interpreter.h ('k') | remoting/ios/app/host_view_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/gesture_interpreter.cc
diff --git a/remoting/client/gesture_interpreter.cc b/remoting/client/gesture_interpreter.cc
index 8f5eac204f5cb5fbf20e9ae008929e998d8f61c1..c5ae59278851fd1d6277f2b544af4cd0af6b4acf 100644
--- a/remoting/client/gesture_interpreter.cc
+++ b/remoting/client/gesture_interpreter.cc
@@ -76,25 +76,19 @@ void GestureInterpreter::Pan(float translation_x, float translation_y) {
void GestureInterpreter::Tap(float x, float y) {
AbortAnimations();
- if (!input_strategy_->TrackTouchInput({x, y}, viewport_)) {
- return;
- }
- ViewMatrix::Point cursor_position = input_strategy_->GetCursorPosition();
- StartInputFeedback(cursor_position.x, cursor_position.y,
- InputStrategy::TAP_FEEDBACK);
- InjectMouseClick(cursor_position.x, cursor_position.y,
- protocol::MouseEvent_MouseButton_BUTTON_LEFT);
+ InjectMouseClick(x, y, protocol::MouseEvent_MouseButton_BUTTON_LEFT);
}
void GestureInterpreter::TwoFingerTap(float x, float y) {
AbortAnimations();
- if (!input_strategy_->TrackTouchInput({x, y}, viewport_)) {
- return;
- }
- ViewMatrix::Point cursor_position = input_strategy_->GetCursorPosition();
- InjectMouseClick(cursor_position.x, cursor_position.y,
- protocol::MouseEvent_MouseButton_BUTTON_RIGHT);
+ InjectMouseClick(x, y, protocol::MouseEvent_MouseButton_BUTTON_RIGHT);
+}
+
+void GestureInterpreter::ThreeFingerTap(float x, float y) {
+ AbortAnimations();
+
+ InjectMouseClick(x, y, protocol::MouseEvent_MouseButton_BUTTON_MIDDLE);
}
void GestureInterpreter::Drag(float x, float y, GestureState state) {
@@ -193,11 +187,20 @@ void GestureInterpreter::AbortAnimations() {
}
void GestureInterpreter::InjectMouseClick(
- float x,
- float y,
+ float touch_x,
+ float touch_y,
protocol::MouseEvent_MouseButton button) {
- input_stub_->SendMouseEvent(x, y, button, true);
- input_stub_->SendMouseEvent(x, y, button, false);
+ if (!input_strategy_->TrackTouchInput({touch_x, touch_y}, viewport_)) {
+ return;
+ }
+ ViewMatrix::Point cursor_position = input_strategy_->GetCursorPosition();
+ StartInputFeedback(cursor_position.x, cursor_position.y,
+ InputStrategy::TAP_FEEDBACK);
+
+ input_stub_->SendMouseEvent(cursor_position.x, cursor_position.y, button,
+ true);
+ input_stub_->SendMouseEvent(cursor_position.x, cursor_position.y, button,
+ false);
}
void GestureInterpreter::SetGestureInProgress(InputStrategy::Gesture gesture,
« no previous file with comments | « remoting/client/gesture_interpreter.h ('k') | remoting/ios/app/host_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698