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

Unified Diff: remoting/client/ui/gesture_interpreter.cc

Issue 2904703003: [CRD iOS] Add support for three-finger gestures (Closed)
Patch Set: 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
Index: remoting/client/ui/gesture_interpreter.cc
diff --git a/remoting/client/ui/gesture_interpreter.cc b/remoting/client/ui/gesture_interpreter.cc
index f307077e6153d3b659465c61a0869abd1ec9726a..25f77722726536ad6fa610c305ae45e68811f414 100644
--- a/remoting/client/ui/gesture_interpreter.cc
+++ b/remoting/client/ui/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,

Powered by Google App Engine
This is Rietveld 408576698