event.proto 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // Protocol for event messages.
  5. syntax = "proto2";
  6. option optimize_for = LITE_RUNTIME;
  7. package remoting.protocol;
  8. // Defines a keyboard event.
  9. message KeyEvent {
  10. // The keyboard (Caps/Num) lock states.
  11. enum LockStates {
  12. LOCK_STATES_CAPSLOCK = 1;
  13. LOCK_STATES_NUMLOCK = 2;
  14. }
  15. // True for key press events, and false for key release.
  16. optional bool pressed = 2;
  17. // The USB key code.
  18. // The upper 16-bits are the USB Page (0x07 for key events).
  19. // The lower 16-bits are the USB Usage ID (which identifies the actual key).
  20. optional uint32 usb_keycode = 3;
  21. // Legacy keyboard lock states. Prefer the discrete entries below.
  22. optional uint32 lock_states = 4 [default = 0];
  23. // Keyboard lock states. The field should be specified only if the state can
  24. // be reliably determined by the client. E.g., OS X does not have num lock, so
  25. // only caps_lock should be provided by a client running on OS X.
  26. optional bool caps_lock_state = 5;
  27. optional bool num_lock_state = 6;
  28. }
  29. // Text input event for input method different from physical keyboards,
  30. // including software keyboard, gesture typing, voice input, etc.
  31. message TextEvent {
  32. // Unicode sequence for the event in UTF-8.
  33. optional string text = 1;
  34. }
  35. // Fractional coordinate information. Fractional coordinates define a location
  36. // as a number in the range [0, 1], interpreted relative to the bounds of a
  37. // monitor identified by |stream_id| in the most recent VideoLayout message sent
  38. // by the host.
  39. message FractionalCoordinate {
  40. optional float x = 1;
  41. optional float y = 2;
  42. optional int64 screen_id = 3;
  43. }
  44. // Defines a mouse event message on the event channel.
  45. message MouseEvent {
  46. enum MouseButton {
  47. BUTTON_UNDEFINED = 0;
  48. BUTTON_LEFT = 1;
  49. BUTTON_MIDDLE = 2;
  50. BUTTON_RIGHT = 3;
  51. BUTTON_BACK = 4;
  52. BUTTON_FORWARD = 5;
  53. BUTTON_MAX = 6;
  54. }
  55. // Mouse absolute position information. When using WebRTC-based protocol the
  56. // coordinates are in DIPs. Otherwise they are in host's physical pixels. In
  57. // both coordinates systems, the top-left monitor on the system always starts
  58. // from (0, 0).
  59. optional int32 x = 1;
  60. optional int32 y = 2;
  61. // Mouse button event.
  62. optional MouseButton button = 5;
  63. optional bool button_down = 6;
  64. // Mouse wheel information.
  65. // These values encode the number of pixels and 'ticks' of movement that
  66. // would result from the wheel event on the client system.
  67. optional float wheel_delta_x = 7;
  68. optional float wheel_delta_y = 8;
  69. optional float wheel_ticks_x = 9;
  70. optional float wheel_ticks_y = 10;
  71. // Mouse movement information. Provided only for relative mouse events (i.e.
  72. // when mouse lock is engaged).
  73. optional int32 delta_x = 11;
  74. optional int32 delta_y = 12;
  75. // Fractional coordinate information. Provided only for absolute mouse events
  76. // (i.e. when mouse lock is *not* engaged).
  77. optional FractionalCoordinate fractional_coordinate = 13;
  78. }
  79. // Defines an event that sends clipboard data between peers.
  80. message ClipboardEvent {
  81. // The MIME type of the data being sent.
  82. optional string mime_type = 1;
  83. // The data being sent.
  84. optional bytes data = 2;
  85. }
  86. message TouchEventPoint {
  87. // The ID for the touch point.
  88. optional uint32 id = 1;
  89. // The absolute position of the touch point. These values on-the-wire are host
  90. // physical pixel coordinates: the top-left monitor on the system always
  91. // starts from (0, 0).
  92. optional float x = 2;
  93. optional float y = 3;
  94. // The size of the touch point, used to aid hit-testing.
  95. // Scaled to match the size on host.
  96. optional float radius_x = 4;
  97. optional float radius_y = 5;
  98. // Angle in degrees from the y-axis of the touch point.
  99. optional float angle = 6;
  100. // The pressure of the touch point.
  101. // The value should be in [0.0, 1.0].
  102. optional float pressure = 7;
  103. optional FractionalCoordinate fractional_coordinate = 8;
  104. }
  105. message TouchEvent {
  106. // A START event means that this event reports all the touch points that were
  107. // just added, e.g. a finger started touching the display.
  108. // A MOVE event means that the touch points that have been STARTed moved,
  109. // e.g. multiple fingers on the screen moved.
  110. // An END event means that the touch points that have been STARTed ended.
  111. // e.g. a finger went off the screen.
  112. // A CANCEL event means that the touch points that have been STARTed were
  113. // canceled, e.g. a finger went off the screen.
  114. // Cancel event is simlar to END but slighly different. For example, Android
  115. // MotionEvent's ACTION_CANCEL documentation mentions that a cancel should be
  116. // treated as an ACTION_UP (END) event but might not perform the exact same
  117. // actions as a normal ACTION_UP event.
  118. enum TouchEventType {
  119. TOUCH_POINT_UNDEFINED = 0;
  120. TOUCH_POINT_START = 1;
  121. TOUCH_POINT_MOVE = 2;
  122. TOUCH_POINT_END = 3;
  123. TOUCH_POINT_CANCEL = 4;
  124. };
  125. optional TouchEventType event_type = 1;
  126. // Only the changed touch points are added to this field.
  127. // Given the existing touch point APIs (e.g. Android and PPAPI)
  128. // for START, END, and CANCEL events the size of this field will typically be
  129. // 1, but for MOVE events it is likely to have multiple points.
  130. repeated TouchEventPoint touch_points = 2;
  131. }