Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: ui/wayland/events/wayland_event.h

Issue 7457023: Adding a Wayland basic toolkit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated trunk to HEAD Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/linux/system.gyp ('k') | ui/wayland/wayland.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
6 #define UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
7
8 #include <linux/input.h>
9 #include <stdint.h>
10
11 // 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
13 // events are processed.)
14 // 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
16 // types of events that Wayland will send.
17 //
18 // The following fields are common for most event types and their use is
19 // similar:
20 // - time:
21 // The time of the event. This should be monotonically increasing.
22 // - state:
23 // The value of the button event as given by evdev. This is 0 if button
24 // isn't pressed.
25 // - modifiers:
26 // Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently
27 // active. The modifiers are values as defined by xkbcommon.
28
29 namespace ui {
30
31 // Types of events Wayland will send
32 enum WaylandEventType {
33 WAYLAND_BUTTON,
34 WAYLAND_KEY,
35 WAYLAND_MOTION,
36 WAYLAND_POINTER_FOCUS,
37 WAYLAND_KEYBOARD_FOCUS,
38 WAYLAND_GEOMETRY_CHANGE,
39 };
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 {
53 WaylandEventType type;
54 uint32_t time;
55 // WaylandEventButtonType defines some of the values button can take
56 uint32_t button;
57 uint32_t state;
58 uint32_t modifiers;
59 int32_t x;
60 int32_t y;
61 };
62
63 struct WaylandEventKey {
64 WaylandEventType type;
65 uint32_t time;
66 // The raw key value that evdev returns.
67 uint32_t key;
68 // The key symbol returned by processing the raw key using the xkbcommon
69 // library.
70 uint32_t sym;
71 uint32_t state;
72 uint32_t modifiers;
73 };
74
75 // Triggered when there is a motion event. The motion event is triggered
76 // only if there is a window under focus.
77 struct WaylandEventMotion {
78 WaylandEventType type;
79 uint32_t time;
80 uint32_t modifiers;
81 int32_t x;
82 int32_t y;
83 };
84
85 // Triggered when a window enters/exits pointer focus. The state tells us
86 // if the window lost focus (state == 0) or gained focus (state != 0).
87 struct WaylandEventPointerFocus {
88 WaylandEventType type;
89 uint32_t time;
90 uint32_t state;
91 int32_t x;
92 int32_t y;
93 };
94
95 // Triggered when a window enters/exits keyboard focus. The state tells us
96 // if the window lost focus (state == 0) or gained focus (state != 0).
97 struct WaylandEventKeyboardFocus {
98 WaylandEventType type;
99 uint32_t time;
100 uint32_t state;
101 uint32_t modifiers;
102 };
103
104 // Event triggered when a window's geometry changes. The event contains the
105 // position and dimensions of the window.
106 struct WaylandEventGeometryChange {
107 WaylandEventType type;
108 uint32_t time;
109 int32_t x;
110 int32_t y;
111 int32_t width;
112 int32_t height;
113 };
114
115 union WaylandEvent {
116 WaylandEventType type;
117 WaylandEventButton button;
118 WaylandEventKey key;
119 WaylandEventMotion motion;
120 WaylandEventPointerFocus pointer_focus;
121 WaylandEventKeyboardFocus keyboard_focus;
122 WaylandEventGeometryChange geometry_change;
123 };
124
125 } // namespace ui
126
127 #endif // UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
OLDNEW
« no previous file with comments | « build/linux/system.gyp ('k') | ui/wayland/wayland.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698