From 0e68803fd9d34a74646ed1ecc510469c0a98161b Mon Sep 17 00:00:00 2001 From: rkuroiwa Date: Thu, 26 Feb 2015 11:41:42 -0800 Subject: Add touch events to the protocol, the stub layer, and to the client plugin. - Add TouchEvent and TouchEventPoint messages to the input event protocol. - Extend the InputStub interface with an InjectTouchEvent() method. - Update InputEventTracker to track touch points, and to cancel them when ReleaseAll() is called. - Implement touch handling in the client plugin, but off by default. The web-app may choose to enable touch handling if desired. - Add a TouchInputScaler that scales and clamps touch points, similarly to the MouseInputFilter, for use by both client and host. BUG=314515 Review URL: https://codereview.chromium.org/799233004 Cr-Commit-Position: refs/heads/master@{#318284} --- remoting/proto/event.proto | 51 +++++++++++++++++++++++++++++++++++++++++++ remoting/proto/internal.proto | 1 + 2 files changed, 52 insertions(+) (limited to 'remoting/proto') diff --git a/remoting/proto/event.proto b/remoting/proto/event.proto index dd15094..37df684 100644 --- a/remoting/proto/event.proto +++ b/remoting/proto/event.proto @@ -79,3 +79,54 @@ message ClipboardEvent { // The data being sent. optional bytes data = 2; } + +message TouchEventPoint { + // The ID for the touch point. + optional uint32 id = 1; + + // The position of the touch point. + // These values on-the-wire are host coordinates. + optional float x = 2; + optional float y = 3; + + // The size of the touch point, used to aid hit-testing. + // Scaled to match the size on host. + optional float radius_x = 4; + optional float radius_y = 5; + + // Angle in degrees from the y-axis of the touch point. + optional float angle = 6; + + // The pressure of the touch point. + // The value should be in [0.0, 1.0]. + optional float pressure = 7; +} + +message TouchEvent { + // A START event means that this event reports all the touch points that were + // just added, e.g. a finger started touching the display. + // A MOVE event means that the touch points that have been STARTed moved, + // e.g. multiple fingers on the screen moved. + // An END event means that the touch points that have been STARTed ended. + // e.g. a finger went off the screen. + // A CANCEL event means that the touch points that have been STARTed were + // canceled, e.g. a finger went off the screen. + // Cancel event is simlar to END but slighly different. For example, Android + // MotionEvent's ACTION_CANCEL documentation mentions that a cancel should be + // treated as an ACTION_UP (END) event but might not perform the exact same + // actions as a normal ACTION_UP event. + enum TouchEventType { + TOUCH_POINT_START = 1; + TOUCH_POINT_MOVE = 2; + TOUCH_POINT_END = 3; + TOUCH_POINT_CANCEL = 4; + }; + + optional TouchEventType event_type = 1; + + // Only the changed touch points are added to this field. + // Given the existing touch point APIs (e.g. Android and PPAPI) + // for START, END, and CANCEL events the size of this field will typically be + // 1, but for MOVE events it is likely to have multiple points. + repeated TouchEventPoint touch_points = 2; +} diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto index 482d9fa..3041646 100644 --- a/remoting/proto/internal.proto +++ b/remoting/proto/internal.proto @@ -35,4 +35,5 @@ message EventMessage { optional KeyEvent key_event = 3; optional MouseEvent mouse_event = 4; optional TextEvent text_event = 5; + optional TouchEvent touch_event = 6; } -- cgit v1.1