summaryrefslogtreecommitdiffstats
path: root/remoting/proto/event.proto
blob: 2526d7845efff87565e81e76652c1da6cb22f6cb (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
// Copyright (c) 2010 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;

// Defines a keyboard event.
// NEXT ID: 3
message KeyEvent {
  // The POSIX key code.
  required int32 key = 1;
  required bool pressed = 2;
}

// Sets the absolute position of the mouse cursor.
// dimension of the screen area.
// NEXT ID: 3
message MouseSetPositionEvent {
  required int32 x = 1;
  required int32 y = 2;

  // Windows sets absolute mouse pointer positions as a relative value to
  // the screen size. So pass the screen size to make this calculation easier.
  optional int32 width = 3;
  optional int32 height = 4;
}

// Adjust the position of the mouse cursor by an offset.
// NEXT ID: 3
message MouseMoveEvent {
  required int32 offset_x = 1;
  required int32 offset_y = 2;
}

// Motion of the mouse wheel.
// TODO(garykac): What are units here? How many units correspond to a single
// wheel click? On Windows, one click (WHEEL_DELTA) is 120 wheel units.
// NEXT ID: 3
message MouseWheelEvent {
  required int32 offset_x = 1;
  required int32 offset_y = 2;
}

enum MouseButton {
  MouseButtonUndefined = 0;
  MouseButtonLeft = 1;
  MouseButtonMiddle = 2;
  MouseButtonRight = 3;
}

// Mouse button is pressed down.
// NEXT ID: 2
message MouseDownEvent {
  required MouseButton button = 1;
}

// Mouse button is released.
// NEXT ID: 2
message MouseUpEvent {
  required MouseButton button = 1;
}

// Defines a mouse event message on the event channel. 
message MouseEvent {
  // Mouse position information.
  optional int32 mouse_x = 1;
  optional int32 mouse_y = 2;

  // Mouse wheel information.
  optional int32 wheel_offset_x = 3;
  optional int32 wheel_offset_y = 4;

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

// Defines an event message on the event channel.
message Event {
  required int32 timestamp = 1;  // Client timestamp for event
  optional bool dummy = 2;       // Is this a dummy event?

  optional KeyEvent key = 3;
  optional MouseEvent mouse = 4;
}

// Defines the message that is sent from client to host.
// Only one of the optional messages should be present.
message ClientEventMessage {
  repeated Event events = 1;
}

// Defines the message that is sent from host to client.
// Only one of the optional messages should be present.
message HostEventMessage {
  // TODO(hclam): Define the message.
}