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

Unified Diff: third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-client-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-client-protocol.h
diff --git a/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-client-protocol.h b/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-client-protocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..755aeda97b668d67ebc52e0f8299e82c422e021c
--- /dev/null
+++ b/third_party/wayland-protocols/include/protocol/gamepads-unstable-v1-client-protocol.h
@@ -0,0 +1,170 @@
+/*
+ * 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_CLIENT_PROTOCOL_H
+#define GAMEPADS_UNSTABLE_V1_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.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
+ * @connected: A new gamepad connected
+ * @disconnected: A gamepad disconnected
+ * @axis: Gamepad analog axis changed
+ * @button: Gamepad button changed
+ * @frame: Notifies end of a series of gamepad changes.
+ *
+ * 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_listener {
+ /**
+ * connected - A new gamepad connected
+ * @id: id of the gamepad
+ *
+ * Every gamepad gets an assigned an incrementing id, starting
+ * with 0. This event is called before any other event for the
+ * gamepad will be sent.
+ */
+ void (*connected)(void *data,
+ struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ int32_t id);
+ /**
+ * disconnected - A gamepad disconnected
+ * @id: id of the gamepad
+ *
+ * Called after a gamepad is disconnected, no further events for
+ * this gamepad shall be sent by the server.
+ */
+ void (*disconnected)(void *data,
+ struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ int32_t id);
+ /**
+ * axis - Gamepad analog axis changed
+ * @id: id of the gamepad
+ * @axis: id of axis
+ * @value: new value of axis
+ *
+ * Sent when a gamepad axis changed. Follows the W3C
+ * specification of gamepad axes, which has 2 analog sticks
+ * resulting in 4 axes, which are identified by the axis argument.
+ *
+ * The value is normalized and calibrated, with 0 in the resting
+ * state, -1 at the left/top corner of the stick and 1 at the
+ * right/bottom corner.
+ *
+ * This event should not cause any changes to the client until the
+ * frame event is received.
+ */
+ void (*axis)(void *data,
+ struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ int32_t id,
+ int32_t axis,
+ wl_fixed_t value);
+ /**
+ * button - Gamepad button changed
+ * @id: id of the gamepad
+ * @button: id of button
+ * @pressed: boolean state of the button
+ * @value: new analog value of button
+ *
+ * Sent when a gamepad button state changed. Follows the W3C
+ * specification of gamepad buttons, which has 17 possible buttons.
+ *
+ * All buttons have a boolean state and an analog value. The analog
+ * value is normalized from 0 (not pressed) to 1 (fully pressed),
+ * if a button does not support an analog value, the value will be
+ * derived from the boolean state.
+ *
+ * This event should not cause any changes to the client until the
+ * frame event is received.
+ */
+ void (*button)(void *data,
+ struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ int32_t id,
+ int32_t button,
+ int32_t pressed,
+ wl_fixed_t value);
+ /**
+ * frame - Notifies end of a series of gamepad changes.
+ * @time: timestamp with millisecond granularity
+ *
+ * Sent after a series of axis and button events that logically
+ * belong together.
+ */
+ void (*frame)(void *data,
+ struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ uint32_t time);
+};
+
+static inline int
+zwp_gamepads_v1_add_listener(struct zwp_gamepads_v1 *zwp_gamepads_v1,
+ const struct zwp_gamepads_v1_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) zwp_gamepads_v1,
+ (void (**)(void)) listener, data);
+}
+
+#define ZWP_GAMEPADS_V1_DESTROY 0
+
+static inline void
+zwp_gamepads_v1_set_user_data(struct zwp_gamepads_v1 *zwp_gamepads_v1, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) zwp_gamepads_v1, user_data);
+}
+
+static inline void *
+zwp_gamepads_v1_get_user_data(struct zwp_gamepads_v1 *zwp_gamepads_v1)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) zwp_gamepads_v1);
+}
+
+static inline void
+zwp_gamepads_v1_destroy(struct zwp_gamepads_v1 *zwp_gamepads_v1)
+{
+ wl_proxy_marshal((struct wl_proxy *) zwp_gamepads_v1,
+ ZWP_GAMEPADS_V1_DESTROY);
+
+ wl_proxy_destroy((struct wl_proxy *) zwp_gamepads_v1);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698