| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_ | 5 #ifndef BASE_WAYLAND_WAYLAND_EVENT_H_ |
| 6 #define UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_ | 6 #define BASE_WAYLAND_WAYLAND_EVENT_H_ |
| 7 | 7 |
| 8 #include <linux/input.h> | |
| 9 #include <stdint.h> | 8 #include <stdint.h> |
| 10 | 9 |
| 11 // Wayland event information is being passed in as arguments to the callbacks. | 10 // Wayland event information is being passed in as arguments to the callbacks. |
| 12 // (See wayland_input_device.{h,cc} for information on the callbacks and how | 11 // (See wayland_input_device.{h,cc} for information on the callbacks and how |
| 13 // events are processed.) | 12 // events are processed.) |
| 14 // In order to provide a more generic look for events we wrap these arguments | 13 // In order to provide a more generic look for events we wrap these arguments |
| 15 // in specific event structs. Then define a WaylandEvent as a union of all | 14 // in specific event structs. Then define a WaylandEvent as a union of all |
| 16 // types of events that Wayland will send. | 15 // types of events that Wayland will send. |
| 17 // | 16 // |
| 18 // The following fields are common for most event types and their use is | 17 // The following fields are common for most event types and their use is |
| 19 // similar: | 18 // similar: |
| 20 // - time: | 19 // - time: |
| 21 // The time of the event. This should be monotonically increasing. | 20 // The time of the event. This should be monotonically increasing. |
| 22 // - state: | 21 // - state: |
| 23 // The value of the button event as given by evdev. This is 0 if button | 22 // The value of the button event as given by evdev. This is 0 if button |
| 24 // isn't pressed. | 23 // isn't pressed. |
| 25 // - modifiers: | 24 // - modifiers: |
| 26 // Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently | 25 // Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently |
| 27 // active. The modifiers are values as defined by xkbcommon. | 26 // active. The modifiers are values as defined by xkbcommon. |
| 28 | 27 |
| 29 namespace ui { | 28 namespace base { |
| 29 namespace wayland { |
| 30 | 30 |
| 31 // Types of events Wayland will send | 31 // Types of events Wayland will send |
| 32 enum WaylandEventType { | 32 enum WaylandEventType { |
| 33 WAYLAND_BUTTON, | 33 WAYLAND_BUTTON, |
| 34 WAYLAND_KEY, | 34 WAYLAND_KEY, |
| 35 WAYLAND_MOTION, | 35 WAYLAND_MOTION, |
| 36 WAYLAND_POINTER_FOCUS, | 36 WAYLAND_POINTER_FOCUS, |
| 37 WAYLAND_KEYBOARD_FOCUS, | 37 WAYLAND_KEYBOARD_FOCUS, |
| 38 WAYLAND_GEOMETRY_CHANGE, | 38 WAYLAND_GEOMETRY_CHANGE, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // These are the mouse events expected. The event type Wayland sends is an | |
| 42 // evdev event. The following is the correct mapping from evdev to expected | |
| 43 // events type. | |
| 44 enum WaylandEventButtonType { | |
| 45 LEFT_BUTTON = BTN_LEFT, | |
| 46 MIDDLE_BUTTON = BTN_RIGHT, | |
| 47 RIGHT_BUTTON = BTN_MIDDLE, | |
| 48 SCROLL_UP = BTN_SIDE, | |
| 49 SCROLL_DOWN = BTN_EXTRA, | |
| 50 }; | |
| 51 | |
| 52 struct WaylandEventButton { | 41 struct WaylandEventButton { |
| 53 WaylandEventType type; | 42 WaylandEventType type; |
| 54 uint32_t time; | 43 uint32_t time; |
| 55 // WaylandEventButtonType defines some of the values button can take | 44 // WaylandEventButtonType defines some of the values button can take |
| 56 uint32_t button; | 45 uint32_t button; |
| 57 uint32_t state; | 46 uint32_t state; |
| 58 uint32_t modifiers; | 47 uint32_t modifiers; |
| 59 int32_t x; | 48 int32_t x; |
| 60 int32_t y; | 49 int32_t y; |
| 61 }; | 50 }; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 union WaylandEvent { | 104 union WaylandEvent { |
| 116 WaylandEventType type; | 105 WaylandEventType type; |
| 117 WaylandEventButton button; | 106 WaylandEventButton button; |
| 118 WaylandEventKey key; | 107 WaylandEventKey key; |
| 119 WaylandEventMotion motion; | 108 WaylandEventMotion motion; |
| 120 WaylandEventPointerFocus pointer_focus; | 109 WaylandEventPointerFocus pointer_focus; |
| 121 WaylandEventKeyboardFocus keyboard_focus; | 110 WaylandEventKeyboardFocus keyboard_focus; |
| 122 WaylandEventGeometryChange geometry_change; | 111 WaylandEventGeometryChange geometry_change; |
| 123 }; | 112 }; |
| 124 | 113 |
| 125 } // namespace ui | 114 } // namespace wayland |
| 115 } // namespace base |
| 126 | 116 |
| 127 #endif // UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_ | 117 #endif // BASE_WAYLAND_WAYLAND_EVENT_H_ |
| OLD | NEW |