| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.graphics.Matrix; | 7 import android.graphics.Matrix; |
| 8 import android.graphics.Point; | 8 import android.graphics.PointF; |
| 9 import android.view.MotionEvent; | 9 import android.view.MotionEvent; |
| 10 | 10 |
| 11 import java.util.LinkedList; | 11 import java.util.LinkedList; |
| 12 import java.util.Queue; | 12 import java.util.Queue; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * This class receives local touch input events and forwards them to the remote
host. | 15 * This class receives local touch input events and forwards them to the remote
host. |
| 16 * A queue of MotionEvents is built up and then either transmitted to the remote
host if one of its | 16 * A queue of MotionEvents is built up and then either transmitted to the remote
host if one of its |
| 17 * remote gesture handler methods is called (such as onScroll) or it is cleared
if the current | 17 * remote gesture handler methods is called (such as onScroll) or it is cleared
if the current |
| 18 * stream of events does not represent a remote gesture. | 18 * stream of events does not represent a remote gesture. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return true; | 73 return true; |
| 74 | 74 |
| 75 case InputStub.BUTTON_RIGHT: | 75 case InputStub.BUTTON_RIGHT: |
| 76 // Using the mouse for right-clicking is consistent across all h
ost platforms. | 76 // Using the mouse for right-clicking is consistent across all h
ost platforms. |
| 77 // Right-click gestures are often platform specific and can be t
ricky to simulate. | 77 // Right-click gestures are often platform specific and can be t
ricky to simulate. |
| 78 | 78 |
| 79 // Grab the first queued event which should be the initial ACTIO
N_DOWN event. | 79 // Grab the first queued event which should be the initial ACTIO
N_DOWN event. |
| 80 MotionEvent downEvent = mQueuedEvents.peek(); | 80 MotionEvent downEvent = mQueuedEvents.peek(); |
| 81 assert downEvent.getActionMasked() == MotionEvent.ACTION_DOWN; | 81 assert downEvent.getActionMasked() == MotionEvent.ACTION_DOWN; |
| 82 | 82 |
| 83 mInjector.sendMouseClick(new Point((int) downEvent.getX(), (int)
downEvent.getY()), | 83 mInjector.sendMouseClick(new PointF(downEvent.getX(), downEvent.
getY()), |
| 84 InputStub.BUTTON_RIGHT); | 84 InputStub.BUTTON_RIGHT); |
| 85 clearQueuedEvents(); | 85 clearQueuedEvents(); |
| 86 return true; | 86 return true; |
| 87 | 87 |
| 88 default: | 88 default: |
| 89 // Tap gestures for > 2 fingers are not supported. | 89 // Tap gestures for > 2 fingers are not supported. |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 return event; | 218 return event; |
| 219 } | 219 } |
| 220 | 220 |
| 221 private void resetStateData() { | 221 private void resetStateData() { |
| 222 clearQueuedEvents(); | 222 clearQueuedEvents(); |
| 223 mInRemoteGesture = false; | 223 mInRemoteGesture = false; |
| 224 mIgnoreTouchEvents = false; | 224 mIgnoreTouchEvents = false; |
| 225 } | 225 } |
| 226 } | 226 } |
| OLD | NEW |