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

Unified Diff: ui/wayland/wayland_input_device.h

Issue 7457023: Adding a Wayland basic toolkit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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
Index: ui/wayland/wayland_input_device.h
diff --git a/ui/wayland/wayland_input_device.h b/ui/wayland/wayland_input_device.h
new file mode 100644
index 0000000000000000000000000000000000000000..032cde38c5a678142b16fcf32c16593b4f474f24
--- /dev/null
+++ b/ui/wayland/wayland_input_device.h
@@ -0,0 +1,71 @@
+// 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_INPUT_DEVICE_H_
+#define WAYLAND_INPUT_DEVICE_H_
+
+#include "wayland_geometry_utils.h"
+#include "wayland_widget.h"
+
+#include <wayland-client.h>
+
+struct xkb_desc;
+struct wl_buffer;
+
+class WaylandWindow;
+
+/*
+This class represents an input device that was registered with Wayland.
+The purpose of this class is to parse and wrap events into generic
+WaylandEvent types and dispatch the event to the appropriate WaylandWindow.
+
+How Wayland events work:
+------------------------
+
+When the On*Focus events are triggered, the input device receives a reference
+to the surface that just received/lost focus. Each surface is associated with
+a unique WaylandWindow. When processing the focus events we keep track of the
+currently focused window such that when we receive different events (mouse
+button press or key press) we only send the event to the window in focus.
+*/
+class WaylandInputDevice {
+
+ public:
+ WaylandInputDevice(struct wl_display* display, uint32_t id);
+ ~WaylandInputDevice();
+
+ // Used to change the surface of the input device (normally pointer image).
+ void Attach(struct wl_buffer* buffer, int32_t x, int32_t y);
+ private:
+ struct wl_input_device* input_device_;
+
+ WaylandWindow* pointer_focus_;
+ WaylandWindow* keyboard_focus_;
+
+ uint32_t keyboard_modifiers_;
+
+ Point global_position_;
+ Point surface_position_;
+
+ uint32_t last_event_time_;
+
+ struct xkb_desc* xkb_;
+
+ static const struct wl_input_device_listener input_device_listener_;
+
+ static void OnMotionNotify(void* data, struct wl_input_device* input_device,
+ uint32_t time, int32_t x, int32_t y, int32_t sx, int32_t sy);
+ static void OnButtonNotify(void* data, struct wl_input_device* input_device,
+ uint32_t time, uint32_t button, uint32_t state);
+ static void OnKeyNotify(void* data, struct wl_input_device* input_device,
+ uint32_t time, uint32_t key, uint32_t state);
+ static void OnPointerFocus(void* data, struct wl_input_device* input_device,
+ uint32_t time, struct wl_surface *surface, int32_t x, int32_t y,
+ int32_t sx, int32_t sy);
+ static void OnKeyboardFocus(void* data,
+ struct wl_input_device* input_device,
+ uint32_t time, struct wl_surface *surface, struct wl_array* keys);
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698