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

Unified Diff: third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-server-protocol.h

Issue 2093803002: wayland-protocols: Add gaming-input-unstable-v1 protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migration
Patch Set: Created 4 years, 6 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: third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-server-protocol.h
diff --git a/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-server-protocol.h b/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-server-protocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..fab707c0a92a01e17b0739da4a69540b8a90b04a
--- /dev/null
+++ b/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-server-protocol.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016 The Chromium Authors.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef GAMEPADS_UNSTABLE_V1_SERVER_PROTOCOL_H
+#define GAMEPADS_UNSTABLE_V1_SERVER_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-util.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct zwp_gamepads_v1;
+
+extern const struct wl_interface zwp_gamepads_v1_interface;
+
+/**
+ * zwp_gamepads_v1 - gamepad support
+ * @destroy: destroy gamepads object
+ *
+ * A global interface to notify the client of any gamepads connected to
+ * the server. All gamepads axes and buttons follow the W3C definition of a
+ * 'Standard Gamepad' as specified in:
+ * https://w3c.github.io/gamepad/#remapping
+ */
+struct zwp_gamepads_v1_interface {
+ /**
+ * destroy - destroy gamepads object
+ *
+ *
+ */
+ void (*destroy)(struct wl_client *client,
+ struct wl_resource *resource);
+};
+
+#define ZWP_GAMEPADS_V1_CONNECTED 0
+#define ZWP_GAMEPADS_V1_DISCONNECTED 1
+#define ZWP_GAMEPADS_V1_AXIS 2
+#define ZWP_GAMEPADS_V1_BUTTON 3
+#define ZWP_GAMEPADS_V1_FRAME 4
+
+static inline void
+zwp_gamepads_v1_send_connected(struct wl_resource *resource_, int32_t id)
+{
+ wl_resource_post_event(resource_, ZWP_GAMEPADS_V1_CONNECTED, id);
+}
+
+static inline void
+zwp_gamepads_v1_send_disconnected(struct wl_resource *resource_, int32_t id)
+{
+ wl_resource_post_event(resource_, ZWP_GAMEPADS_V1_DISCONNECTED, id);
+}
+
+static inline void
+zwp_gamepads_v1_send_axis(struct wl_resource *resource_, int32_t id, int32_t axis, wl_fixed_t value)
+{
+ wl_resource_post_event(resource_, ZWP_GAMEPADS_V1_AXIS, id, axis, value);
+}
+
+static inline void
+zwp_gamepads_v1_send_button(struct wl_resource *resource_, int32_t id, int32_t button, int32_t pressed, wl_fixed_t value)
+{
+ wl_resource_post_event(resource_, ZWP_GAMEPADS_V1_BUTTON, id, button, pressed, value);
+}
+
+static inline void
+zwp_gamepads_v1_send_frame(struct wl_resource *resource_, uint32_t time)
+{
+ wl_resource_post_event(resource_, ZWP_GAMEPADS_V1_FRAME, time);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698