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.
5 #ifndef BASE_WAYLAND_WAYLAND_EVENT_H_
6 #define BASE_WAYLAND_WAYLAND_EVENT_H_
10 // Wayland event information is being passed in as arguments to the callbacks.
11 // (See wayland_input_device.{h,cc} for information on the callbacks and how
12 // events are processed.)
13 // In order to provide a more generic look for events we wrap these arguments
14 // in specific event structs. Then define a WaylandEvent as a union of all
15 // types of events that Wayland will send.
17 // The following fields are common for most event types and their use is
20 // The time of the event. This should be monotonically increasing.
22 // The value of the button event as given by evdev. This is 0 if button
25 // Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently
26 // active. The modifiers are values as defined by xkbcommon.
31 // Types of events Wayland will send
32 enum WaylandEventType
{
36 WAYLAND_POINTER_FOCUS
,
37 WAYLAND_KEYBOARD_FOCUS
,
38 WAYLAND_GEOMETRY_CHANGE
,
41 struct WaylandEventButton
{
42 WaylandEventType type
;
44 // WaylandEventButtonType defines some of the values button can take
52 struct WaylandEventKey
{
53 WaylandEventType type
;
55 // The raw key value that evdev returns.
57 // The key symbol returned by processing the raw key using the xkbcommon
64 // Triggered when there is a motion event. The motion event is triggered
65 // only if there is a window under focus.
66 struct WaylandEventMotion
{
67 WaylandEventType type
;
74 // Triggered when a window enters/exits pointer focus. The state tells us
75 // if the window lost focus (state == 0) or gained focus (state != 0).
76 struct WaylandEventPointerFocus
{
77 WaylandEventType type
;
84 // Triggered when a window enters/exits keyboard focus. The state tells us
85 // if the window lost focus (state == 0) or gained focus (state != 0).
86 struct WaylandEventKeyboardFocus
{
87 WaylandEventType type
;
93 // Event triggered when a window's geometry changes. The event contains the
94 // position and dimensions of the window.
95 struct WaylandEventGeometryChange
{
96 WaylandEventType type
;
105 WaylandEventType type
;
106 WaylandEventButton button
;
108 WaylandEventMotion motion
;
109 WaylandEventPointerFocus pointer_focus
;
110 WaylandEventKeyboardFocus keyboard_focus
;
111 WaylandEventGeometryChange geometry_change
;
114 } // namespace wayland
117 #endif // BASE_WAYLAND_WAYLAND_EVENT_H_