|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<protocol name="game_controller_v1"> |
| 3 | + <copyright> |
| 4 | + Copyright © 2023-2024 Collabora, Ltd. |
| 5 | + |
| 6 | + Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | + copy of this software and associated documentation files (the "Software"), |
| 8 | + to deal in the Software without restriction, including without limitation |
| 9 | + the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | + and/or sell copies of the Software, and to permit persons to whom the |
| 11 | + Software is furnished to do so, subject to the following conditions: |
| 12 | + |
| 13 | + The above copyright notice and this permission notice (including the next |
| 14 | + paragraph) shall be included in all copies or substantial portions of the |
| 15 | + Software. |
| 16 | + |
| 17 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | + DEALINGS IN THE SOFTWARE. |
| 24 | + </copyright> |
| 25 | + |
| 26 | + <description summary="Wayland protocol for game controller devices"> |
| 27 | + TODO high level documentation about game controllers and the input source |
| 28 | + </description> |
| 29 | + |
| 30 | + <interface name="wp_game_controller_v1" version="1"> |
| 31 | + <description summary="game controller input device"> |
| 32 | + This interface represents a physical game controller, also known as a |
| 33 | + gamepad, held by the user in their hands. |
| 34 | + |
| 35 | + The wp_game_controller_v1 interface generates events for every input |
| 36 | + sources present on the game controller. The client can also request |
| 37 | + haptic vibration, or rumble, if the hardware supports it. |
| 38 | + </description> |
| 39 | + |
| 40 | + <request name="destroy" type="destructor"> |
| 41 | + <description summary="release the memory for the game controller object"> |
| 42 | + Destroy the game controller device. |
| 43 | + </description> |
| 44 | + </request> |
| 45 | + |
| 46 | + <event name="name"> |
| 47 | + <description summary="name of this game controller"> |
| 48 | + User friendly device identification string. The game controller name |
| 49 | + is a UTF-8 string that should not be NULL. |
| 50 | + </description> |
| 51 | + <arg name="name" type="string" summary="game controller name"/> |
| 52 | + </event> |
| 53 | + |
| 54 | + <enum name="theme"> |
| 55 | + <description summary="button theme"> |
| 56 | + Each vendor uses a different set of glyph on its controller's buttons. |
| 57 | + </description> |
| 58 | + <entry name="none" value="0" summary="default value"/> |
| 59 | + <entry name="playstation" value="1" summary="Sony controllers"/> |
| 60 | + <entry name="xbox" value="2" summary="Microsoft controllers"/> |
| 61 | + <entry name="nintendo" value="3" summary="Nintendo controllers"/> |
| 62 | + </enum> |
| 63 | + |
| 64 | + <event name="theme_hint"> |
| 65 | + <description summary="theme the client should use"> |
| 66 | + Theme the client should follow to render the adequate glyph for matching |
| 67 | + the button on the physical controller. |
| 68 | + </description> |
| 69 | + <arg name="hint" type="uint" enum="theme" summary="theme hint"/> |
| 70 | + </event> |
| 71 | + |
| 72 | + <event name="done"> |
| 73 | + <description summary="all properties events are sent"> |
| 74 | + This event is sent after all of the other properties event have been |
| 75 | + sent. No more property events will be sent to the client after this. |
| 76 | + </description> |
| 77 | + </event> |
| 78 | + |
| 79 | + <event name="enter"> |
| 80 | + <description summary="enter focus event"> |
| 81 | + Notification that the gamepad is focused on a given surface. |
| 82 | + </description> |
| 83 | + <arg name="serial" type="uint" summary="serial number of the enter evenr"/> |
| 84 | + <arg name="surface" type="object" interface="wl_surface" summary="surface gaining gamepad focus"/> |
| 85 | + </event> |
| 86 | + |
| 87 | + <event name="leave"> |
| 88 | + <description summary="leave focus event"> |
| 89 | + Notification that the gamepad is no longer focused on the given surface. |
| 90 | + </description> |
| 91 | + <arg name="serial" type="uint" summary="serial number of the leave event"/> |
| 92 | + <arg name="surface" type="object" interface="wl_surface" summary="surface loosing gamepad focus"/> |
| 93 | + </event> |
| 94 | + |
| 95 | + <enum name="button_state"> |
| 96 | + <description summary="physical input source state"> |
| 97 | + Describes the physical state of a button on the game controller. |
| 98 | + </description> |
| 99 | + <entry name="released" value="0" summary="the input source is not pressed"/> |
| 100 | + <entry name="pressed" value="1" summary="the input source is pressed"/> |
| 101 | + </enum> |
| 102 | + |
| 103 | + <event name="button"> |
| 104 | + <description summary="game controller button event"> |
| 105 | + game controller button click and release notification. |
| 106 | + |
| 107 | + The source is a button code as defined in the Linux kernel's |
| 108 | + linux/input-event-codes.h header file. |
| 109 | + |
| 110 | + The time argument is a timestamp in microseconds of the moment of the |
| 111 | + state changes |
| 112 | + </description> |
| 113 | + <arg name="source" type="uint" summary="source that produced the event"/> |
| 114 | + <arg name="state" type="uint" enum="button_state" summary="physical state of the button"/> |
| 115 | + <arg name="time" type="uint" summary="timestamp with microsecond granularity"/> |
| 116 | + </event> |
| 117 | + |
| 118 | + <event name="trigger"> |
| 119 | + <description summary="game controller trigger event"> |
| 120 | + game controller trigger pressure notification, expressed with a value |
| 121 | + varying between 0.0 and 1.0, with 0.0 being the neutral state. |
| 122 | + |
| 123 | + The source is a button code as defined in the Linux kernel's |
| 124 | + linux/input-event-codes.h header file. |
| 125 | + |
| 126 | + The time argument is a timestamp in microseconds of the moment of the |
| 127 | + state changes |
| 128 | + </description> |
| 129 | + <arg name="source" type="uint" summary="source that produced the event"/> |
| 130 | + <arg name="value" type="fixed" summary="trigger value in the 0 to 1 range"/> |
| 131 | + <arg name="time" type="uint" summary="timestamp with microsecond granularity"/> |
| 132 | + </event> |
| 133 | + |
| 134 | + <event name="axis"> |
| 135 | + <description summary="game controller axis event"> |
| 136 | + game controller axis position notification, expressed by a 2D |
| 137 | + position varying from -1.0 to 1.0, with 0.0 being the neutral state. |
| 138 | + |
| 139 | + The source is a button code as defined in the Linux kernel's |
| 140 | + linux/input-event-codes.h header file. |
| 141 | + |
| 142 | + The time argument is a timestamp in microseconds of the moment of the |
| 143 | + state changes |
| 144 | + </description> |
| 145 | + <arg name="source" type="uint" summary="source that produced the event"/> |
| 146 | + <arg name="value" type="fixed" summary="axis coordinate in the -1 to 1 range"/> |
| 147 | + <arg name="time" type="uint" summary="timestamp with microsecond granularity"/> |
| 148 | + </event> |
| 149 | + |
| 150 | + <event name="frame"> |
| 151 | + <description summary="end of a game controller event sequence"> |
| 152 | + Indicates the end of a set of events that logically belong together. |
| 153 | + A client is expected to accumulate the data in all events within the |
| 154 | + frame before proceeding |
| 155 | + |
| 156 | + All wp_game_controller_v1 events before a wp_game_controller_v1.frame |
| 157 | + event belong together. |
| 158 | + </description> |
| 159 | + </event> |
| 160 | + </interface> |
| 161 | +</protocol> |
0 commit comments