summaryrefslogtreecommitdiffstats
path: root/remoting/proto/event.proto
blob: 37df684ce5bee58dc599340b0c1cdcc6f3d2a97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Protocol for event messages.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package remoting.protocol;

// Defines a keyboard event.
message KeyEvent {

  // The keyboard (Caps/Num) lock states.
  enum LockStates {
    LOCK_STATES_CAPSLOCK = 1;
    LOCK_STATES_NUMLOCK = 2;
  }

  // True for key press events, and false for key release.
  optional bool pressed = 2;

  // The USB key code.
  // The upper 16-bits are the USB Page (0x07 for key events).
  // The lower 16-bits are the USB Usage ID (which identifies the actual key).
  optional uint32 usb_keycode = 3;

  // The keyboard lock states.
  optional uint32 lock_states = 4 [default = 0];
}

// Text input event for input method different from physical keyboards,
// including software keyboard, gesture typing, voice input, etc.
message TextEvent {
  // Unicode sequence for the event in UTF-8.
  optional string text = 1;
}

// Defines a mouse event message on the event channel.
message MouseEvent {

  enum MouseButton {
    BUTTON_UNDEFINED = 0;
    BUTTON_LEFT = 1;
    BUTTON_MIDDLE = 2;
    BUTTON_RIGHT = 3;
    BUTTON_MAX = 4;
  }

  // Mouse position information.
  optional int32 x = 1;
  optional int32 y = 2;

  // Mouse button event.
  optional MouseButton button = 5;
  optional bool button_down = 6;

  // Mouse wheel information.
  // These values encode the number of pixels and 'ticks' of movement that
  // would result from the wheel event on the client system.
  optional float wheel_delta_x = 7;
  optional float wheel_delta_y = 8;
  optional float wheel_ticks_x = 9;
  optional float wheel_ticks_y = 10;

  // Mouse movement information. Provided only when mouse lock is engaged.
  optional int32 delta_x = 11;
  optional int32 delta_y = 12;
}

// Defines an event that sends clipboard data between peers.
message ClipboardEvent {

  // The MIME type of the data being sent.
  optional string mime_type = 1;

  // 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;
}