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

Side by Side Diff: third_party/wayland-protocols/include/protocol/gaming-input-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: fixed nit, regenerated Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 The Chromium Authors.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifndef GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H
25 #define GAMING_INPUT_UNSTABLE_V1_SERVER_PROTOCOL_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <stdint.h>
32 #include <stddef.h>
33 #include "wayland-util.h"
34
35 struct wl_client;
36 struct wl_resource;
37
38 struct zwp_gaming_input_v1;
39 struct zwp_gamepad_v1;
40
41 extern const struct wl_interface zwp_gaming_input_v1_interface;
42 extern const struct wl_interface zwp_gamepad_v1_interface;
43
44 /**
45 * zwp_gaming_input_v1 - extends wl_seat with gaming input devices
46 * @get_gamepad: get gamepad device assigned to seat
47 *
48 * A global interface to provide gaming input devices for a given seat.
49 *
50 * Currently only gamepad devices are supported.
51 *
52 * Warning! The protocol described in this file is experimental and
53 * backward incompatible changes may be made. Backward compatible changes
54 * may be added together with the corresponding uinterface version bump.
55 * Backward incompatible changes are done by bumping the version number in
56 * the protocol and uinterface names and resetting the interface version.
57 * Once the protocol is to be declared stable, the 'z' prefix and the
58 * version number in the protocol and interface names are removed and the
59 * interface version number is reset.
60 */
61 struct zwp_gaming_input_v1_interface {
62 /**
63 * get_gamepad - get gamepad device assigned to seat
64 * @id: (none)
65 * @seat: (none)
66 *
67 * Create gamepad object. See zwp_gamepad_v1 interface for
68 * details.
69 */
70 void (*get_gamepad)(struct wl_client *client,
71 struct wl_resource *resource,
72 uint32_t id,
73 struct wl_resource *seat);
74 };
75
76 #ifndef ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM
77 #define ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM
78 /**
79 * zwp_gamepad_v1_gamepad_state - connection state
80 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF: no gamepads are connected or on.
81 * @ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON: at least one gamepad is connected.
82 *
83 *
84 */
85 enum zwp_gamepad_v1_gamepad_state {
86 ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF = 0,
87 ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON = 1,
88 };
89 #endif /* ZWP_GAMEPAD_V1_GAMEPAD_STATE_ENUM */
90
91 #ifndef ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM
92 #define ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM
93 /**
94 * zwp_gamepad_v1_button_state - physical button state
95 * @ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED: the button is not pressed
96 * @ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED: the button is pressed
97 *
98 * Describes the physical state of a button that produced the button
99 * event.
100 */
101 enum zwp_gamepad_v1_button_state {
102 ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED = 0,
103 ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED = 1,
104 };
105 #endif /* ZWP_GAMEPAD_V1_BUTTON_STATE_ENUM */
106
107 /**
108 * zwp_gamepad_v1 - gamepad input device
109 * @destroy: destroy gamepad object
110 *
111 * The zwp_gamepad_v1 interface represents one or more gamepad input
112 * devices, which are reported as a normalized 'Standard Gamepad' as it is
113 * specified by the W3C Gamepad API at:
114 * https://w3c.github.io/gamepad/#remapping
115 */
116 struct zwp_gamepad_v1_interface {
117 /**
118 * destroy - destroy gamepad object
119 *
120 *
121 */
122 void (*destroy)(struct wl_client *client,
123 struct wl_resource *resource);
124 };
125
126 #define ZWP_GAMEPAD_V1_STATE_CHANGE 0
127 #define ZWP_GAMEPAD_V1_AXIS 1
128 #define ZWP_GAMEPAD_V1_BUTTON 2
129 #define ZWP_GAMEPAD_V1_FRAME 3
130
131 static inline void
132 zwp_gamepad_v1_send_state_change(struct wl_resource *resource_, uint32_t state)
133 {
134 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_STATE_CHANGE, state);
135 }
136
137 static inline void
138 zwp_gamepad_v1_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t axis, wl_fixed_t value)
139 {
140 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_AXIS, time, axis, value );
141 }
142
143 static inline void
144 zwp_gamepad_v1_send_button(struct wl_resource *resource_, uint32_t time, uint32_ t button, uint32_t state, wl_fixed_t analog)
145 {
146 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_BUTTON, time, button, s tate, analog);
147 }
148
149 static inline void
150 zwp_gamepad_v1_send_frame(struct wl_resource *resource_, uint32_t time)
151 {
152 wl_resource_post_event(resource_, ZWP_GAMEPAD_V1_FRAME, time);
153 }
154
155 #ifdef __cplusplus
156 }
157 #endif
158
159 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698