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

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: removed unused flag Created 9 years, 5 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 | « no previous file | ui/wayland/wayland.gyp » ('j') | ui/wayland/wayland_buffer.cc » ('J')
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 // Types of events Wayland will send
30 typedef enum {
31 WAYLAND_BUTTON,
32 WAYLAND_KEY,
33 WAYLAND_MOTION,
34 WAYLAND_POINTER_FOCUS,
35 WAYLAND_KEYBOARD_FOCUS,
36 WAYLAND_GEOMETRY_CHANGE,
37 } WaylandEventType;
38
39 // These are the mouse events expected. The event type Wayland sends is an
40 // evdev event. The following is the correct mapping from evdev to expected
41 // events type.
42 enum WaylandEventButtonType {
43 LEFT_BUTTON = BTN_LEFT,
44 MIDDLE_BUTTON = BTN_RIGHT,
45 RIGHT_BUTTON = BTN_MIDDLE,
46 SCROLL_UP = BTN_SIDE,
47 SCROLL_DOWN = BTN_EXTRA,
48 };
49
50 struct WaylandEventButton {
51 WaylandEventType type;
52 uint32_t time;
53 // WaylandEventButtonType defines some of the values button can take
54 uint32_t button;
55 uint32_t state;
56 uint32_t modifiers;
57 int32_t x;
58 int32_t y;
59 };
60
61 struct WaylandEventKey {
62 WaylandEventType type;
63 uint32_t time;
64 // The raw key value that evdev returns.
65 uint32_t key;
66 // The key symbol returned by processing the raw key using the xkbcommon
67 // library.
68 uint32_t sym;
69 uint32_t state;
70 uint32_t modifiers;
71 };
72
73 // Triggered when there is a motion event. The motion event is triggered
74 // only if there is a window under focus.
75 struct WaylandEventMotion {
76 WaylandEventType type;
77 uint32_t time;
78 uint32_t modifiers;
79 int32_t x;
80 int32_t y;
81 };
82
83 // Triggered when a window enters/exits pointer focus. The state tells us
84 // if the window lost focus (state == 0) or gained focus (state != 0).
85 struct WaylandEventPointerFocus {
86 WaylandEventType type;
87 uint32_t time;
88 uint32_t state;
89 int32_t x;
90 int32_t y;
91 };
92
93 // Triggered when a window enters/exits keyboard focus. The state tells us
94 // if the window lost focus (state == 0) or gained focus (state != 0).
95 struct WaylandEventKeyboardFocus {
96 WaylandEventType type;
97 uint32_t time;
98 uint32_t state;
99 uint32_t modifiers;
100 };
101
102 // Event triggered when a window's geometry changes. The event contains the
103 // position and dimensions of the window.
104 struct WaylandEventGeometryChange {
105 WaylandEventType type;
106 uint32_t time;
107 int32_t x;
108 int32_t y;
109 int32_t width;
110 int32_t height;
111 };
112
113 union _WaylandEvent {
114 WaylandEventType type;
115 WaylandEventButton button;
116 WaylandEventKey key;
117 WaylandEventMotion motion;
118 WaylandEventPointerFocus pointer_focus;
119 WaylandEventKeyboardFocus keyboard_focus;
120 WaylandEventGeometryChange geometry_change;
121 };
122
123 typedef _WaylandEvent WaylandEvent;
124
125 #endif // UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/wayland/wayland.gyp » ('j') | ui/wayland/wayland_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698