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

Unified 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: More comments and Chrome style formatting 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/wayland/wayland.gyp » ('j') | ui/wayland/wayland.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wayland/events/wayland_event.h
diff --git a/ui/wayland/events/wayland_event.h b/ui/wayland/events/wayland_event.h
new file mode 100644
index 0000000000000000000000000000000000000000..84990591ecc359fc41c8b9799ae000d07193b36c
--- /dev/null
+++ b/ui/wayland/events/wayland_event.h
@@ -0,0 +1,128 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WAYLAND_EVENT_H_
Evan Martin 2011/07/22 18:21:22 UI_WAYLAND_EVENTS_WAYLAND_EVENT_H_ (here and every
+#define WAYLAND_EVENT_H_
+
+#include <linux/input.h>
+#include <stdint.h>
+
+/*
+We define a WaylandEvent as a union of all types of events that Wayland will
+send.
Evan Martin 2011/07/22 18:21:22 Is this at the protocol level? Or is it wrapping
+
+The following fields are common for most event types and their use is similar:
+ - time:
+ The time of the event. This should be monotonically increasing.
Evan Martin 2011/07/22 18:21:22 What are the units? (Is this defined in some other
+ - state:
+ The value of the button event as given by evdev. This is 0 if button
+ isn't pressed.
+ - modifiers:
+ Stores all the keyboard modifiers (Ctrl, Alt, Shift, ...) currently
+ active. The modifiers are values as defined by xkbcommon.
+*/
+
+/* Types of events Wayland will send */
+typedef enum {
+ WAYLAND_BUTTON,
+ WAYLAND_KEY,
+ WAYLAND_MOTION,
+ WAYLAND_POINTER_FOCUS,
+ WAYLAND_KEYBOARD_FOCUS,
+ WAYLAND_GEOMETRY_CHANGE,
+} WaylandEventType;
+
+/* These are the mouse events expected. The event type Wayland sends is an
+evdev event. The following is the correct mapping from evdev to expected
+events type.
+*/
+enum WaylandEventButtonType {
+ LEFT_BUTTON = BTN_LEFT,
+ MIDDLE_BUTTON = BTN_RIGHT,
+ RIGHT_BUTTON = BTN_MIDDLE,
+ SCROLL_UP = BTN_SIDE,
+ SCROLL_DOWN = BTN_EXTRA,
+};
+
+struct WaylandEventButton {
+ WaylandEventType type;
+ uint32_t time;
+ /* WaylandEventButtonType defines some of the values button can take */
Evan Martin 2011/07/22 18:21:22 C++-style comments, please. Sorry to nag.
+ uint32_t button;
+ uint32_t state;
+ uint32_t modifiers;
+ int32_t x;
+ int32_t y;
+};
+
+struct WaylandEventKey {
+ WaylandEventType type;
+ uint32_t time;
+ /* The raw key value that evdev returns. */
+ uint32_t key;
+ /* The key symbol returned by processing the raw key using the xkbcommon
+ library.
+ */
+ uint32_t sym;
+ uint32_t state;
+ uint32_t modifiers;
+};
+
+/* Triggered when there is a motion event. The motion event is triggered
+only if there is a window under focus.
+*/
+struct WaylandEventMotion {
+ WaylandEventType type;
+ uint32_t time;
+ uint32_t modifiers;
+ int32_t x;
+ int32_t y;
+};
+
+/* Triggered when a window enters/exits pointer focus. The state tells us
+if the window lost focus (state == 0) or gained focus (state != 0).
+*/
+struct WaylandEventPointerFocus {
+ WaylandEventType type;
+ uint32_t time;
+ uint32_t state;
+ int32_t x;
+ int32_t y;
+};
+
+/* Triggered when a window enters/exits keyboard focus. The state tells us
+if the window lost focus (state == 0) or gained focus (state != 0).
+*/
+struct WaylandEventKeyboardFocus {
+ WaylandEventType type;
+ uint32_t time;
+ uint32_t state;
+ uint32_t modifiers;
+};
+
+/* Event triggered when a window's geometry changes. The event contains the
+position and dimensions of the window.
+*/
+struct WaylandEventGeometryChange {
+ WaylandEventType type;
+ uint32_t time;
+ int32_t x;
+ int32_t y;
+ int32_t width;
+ int32_t height;
+};
+
+union _WaylandEvent {
+ WaylandEventType type;
+ WaylandEventButton button;
+ WaylandEventKey key;
+ WaylandEventMotion motion;
+ WaylandEventPointerFocus pointer_focus;
+ WaylandEventKeyboardFocus keyboard_focus;
+ WaylandEventGeometryChange geometry_change;
+};
+
+typedef _WaylandEvent WaylandEvent;
+
+#endif
« no previous file with comments | « no previous file | ui/wayland/wayland.gyp » ('j') | ui/wayland/wayland.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698