summaryrefslogtreecommitdiffstats
path: root/base/wayland
diff options
context:
space:
mode:
authormsb@chromium.org <msb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-14 19:23:46 +0000
committermsb@chromium.org <msb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-14 19:23:46 +0000
commit43ddf9ade38d89fa12017122cd07085c93da397b (patch)
tree831a2c4b93ae5ebd14033eb833e89a7ecdf99ee4 /base/wayland
parentdf9167beda5d69796316c3c862c849c73433c78a (diff)
downloadchromium_src-43ddf9ade38d89fa12017122cd07085c93da397b.zip
chromium_src-43ddf9ade38d89fa12017122cd07085c93da397b.tar.gz
chromium_src-43ddf9ade38d89fa12017122cd07085c93da397b.tar.bz2
wayland: define base:NativeEvent for Wayland
Fixes the use_wayland build which was broken by this commit: http://codereview.chromium.org/8113028 Similar to win, we create a wayland namespace inside base and define WaylandEvent there. Historical note: Wayland does not have a "native" event structure. Instead, the client is made aware of events via a callback executed in the context of display_run(): http://git.chromium.org/gitweb/?p=chromiumos/third_party/wayland-demos.git;a=blob;f=clients/window.c So we create WaylandEvent structure which takes the parameters from the callback and wraps them into a structure. For details, see: src/ui/wayland/events/wayland_event.h BUG=chromium:102903 TEST=Compiles but doesn't yet link with this change plus a series of others I'm working on. R=msw@chromium.org,oshima@chromium.org,mark@chromium.org Review URL: http://codereview.chromium.org/8378005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/wayland')
-rw-r--r--base/wayland/wayland_event.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/base/wayland/wayland_event.h b/base/wayland/wayland_event.h
new file mode 100644
index 0000000..1d6808d
--- /dev/null
+++ b/base/wayland/wayland_event.h
@@ -0,0 +1,117 @@
+// 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 BASE_WAYLAND_WAYLAND_EVENT_H_
+#define BASE_WAYLAND_WAYLAND_EVENT_H_
+
+#include <stdint.h>
+
+// Wayland event information is being passed in as arguments to the callbacks.
+// (See wayland_input_device.{h,cc} for information on the callbacks and how
+// events are processed.)
+// In order to provide a more generic look for events we wrap these arguments
+// in specific event structs. Then define a WaylandEvent as a union of all
+// types of events that Wayland will send.
+//
+// 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.
+// - 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.
+
+namespace base {
+namespace wayland {
+
+// Types of events Wayland will send
+enum WaylandEventType {
+ WAYLAND_BUTTON,
+ WAYLAND_KEY,
+ WAYLAND_MOTION,
+ WAYLAND_POINTER_FOCUS,
+ WAYLAND_KEYBOARD_FOCUS,
+ WAYLAND_GEOMETRY_CHANGE,
+};
+
+struct WaylandEventButton {
+ WaylandEventType type;
+ uint32_t time;
+ // WaylandEventButtonType defines some of the values button can take
+ 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;
+};
+
+} // namespace wayland
+} // namespace base
+
+#endif // BASE_WAYLAND_WAYLAND_EVENT_H_