Skip to content

Commit 7887719

Browse files
authored
wayland: add support for cursor-shape-v1 protocol (#17284)
* wayland: add support for cursor-shape-v1 protocol * Bump required wayland-protocols to 1.32
1 parent e5fde4d commit 7887719

File tree

11 files changed

+1387
-12
lines changed

11 files changed

+1387
-12
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ gfx/common/wayland/relative-pointer-unstable-v1.c
231231
gfx/common/wayland/relative-pointer-unstable-v1.h
232232
gfx/common/wayland/viewporter.c
233233
gfx/common/wayland/viewporter.h
234+
gfx/common/wayland/cursor-shape-v1.h
235+
gfx/common/wayland/cursor-shape-v1.c
236+
gfx/common/wayland/tablet-unstable-v2.h
237+
gfx/common/wayland/tablet-unstable-v2.c
234238

235239
# libretro-common samples
236240
libretro-common/samples/streams/rzip/rzip

Makefile.common

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,9 @@ ifeq ($(HAVE_WAYLAND), 1)
12751275
gfx/common/wayland/idle-inhibit-unstable-v1.o \
12761276
gfx/common/wayland/xdg-decoration-unstable-v1.o \
12771277
gfx/common/wayland/pointer-constraints-unstable-v1.o \
1278-
gfx/common/wayland/relative-pointer-unstable-v1.o
1278+
gfx/common/wayland/relative-pointer-unstable-v1.o \
1279+
gfx/common/wayland/cursor-shape-v1.o \
1280+
gfx/common/wayland/tablet-unstable-v2.o
12791281

12801282
ifeq ($(HAVE_VULKAN), 1)
12811283
OBJ += gfx/drivers_context/wayland_vk_ctx.o
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cursor-shape protocol
2+
3+
Maintainers:
4+
Simon Ser <[email protected]> (@emersion)
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<protocol name="cursor_shape_v1">
3+
<copyright>
4+
Copyright 2018 The Chromium Authors
5+
Copyright 2023 Simon Ser
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a
8+
copy of this software and associated documentation files (the "Software"),
9+
to deal in the Software without restriction, including without limitation
10+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
11+
and/or sell copies of the Software, and to permit persons to whom the
12+
Software is furnished to do so, subject to the following conditions:
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+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22+
DEALINGS IN THE SOFTWARE.
23+
</copyright>
24+
25+
<interface name="wp_cursor_shape_manager_v1" version="1">
26+
<description summary="cursor shape manager">
27+
This global offers an alternative, optional way to set cursor images. This
28+
new way uses enumerated cursors instead of a wl_surface like
29+
wl_pointer.set_cursor does.
30+
31+
Warning! The protocol described in this file is currently in the testing
32+
phase. Backward compatible changes may be added together with the
33+
corresponding interface version bump. Backward incompatible changes can
34+
only be done by creating a new major version of the extension.
35+
</description>
36+
37+
<request name="destroy" type="destructor">
38+
<description summary="destroy the manager">
39+
Destroy the cursor shape manager.
40+
</description>
41+
</request>
42+
43+
<request name="get_pointer">
44+
<description summary="manage the cursor shape of a pointer device">
45+
Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
46+
47+
When the pointer capability is removed from the wl_seat, the
48+
wp_cursor_shape_device_v1 object becomes inert.
49+
</description>
50+
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
51+
<arg name="pointer" type="object" interface="wl_pointer"/>
52+
</request>
53+
54+
<request name="get_tablet_tool_v2">
55+
<description summary="manage the cursor shape of a tablet tool device">
56+
Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
57+
58+
When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
59+
object becomes inert.
60+
</description>
61+
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
62+
<arg name="tablet_tool" type="object" interface="zwp_tablet_tool_v2"/>
63+
</request>
64+
</interface>
65+
66+
<interface name="wp_cursor_shape_device_v1" version="1">
67+
<description summary="cursor shape for a device">
68+
This interface allows clients to set the cursor shape.
69+
</description>
70+
71+
<enum name="shape">
72+
<description summary="cursor shapes">
73+
This enum describes cursor shapes.
74+
75+
The names are taken from the CSS W3C specification:
76+
https://w3c.github.io/csswg-drafts/css-ui/#cursor
77+
</description>
78+
<entry name="default" value="1" summary="default cursor"/>
79+
<entry name="context_menu" value="2" summary="a context menu is available for the object under the cursor"/>
80+
<entry name="help" value="3" summary="help is available for the object under the cursor"/>
81+
<entry name="pointer" value="4" summary="pointer that indicates a link or another interactive element"/>
82+
<entry name="progress" value="5" summary="progress indicator"/>
83+
<entry name="wait" value="6" summary="program is busy, user should wait"/>
84+
<entry name="cell" value="7" summary="a cell or set of cells may be selected"/>
85+
<entry name="crosshair" value="8" summary="simple crosshair"/>
86+
<entry name="text" value="9" summary="text may be selected"/>
87+
<entry name="vertical_text" value="10" summary="vertical text may be selected"/>
88+
<entry name="alias" value="11" summary="drag-and-drop: alias of/shortcut to something is to be created"/>
89+
<entry name="copy" value="12" summary="drag-and-drop: something is to be copied"/>
90+
<entry name="move" value="13" summary="drag-and-drop: something is to be moved"/>
91+
<entry name="no_drop" value="14" summary="drag-and-drop: the dragged item cannot be dropped at the current cursor location"/>
92+
<entry name="not_allowed" value="15" summary="drag-and-drop: the requested action will not be carried out"/>
93+
<entry name="grab" value="16" summary="drag-and-drop: something can be grabbed"/>
94+
<entry name="grabbing" value="17" summary="drag-and-drop: something is being grabbed"/>
95+
<entry name="e_resize" value="18" summary="resizing: the east border is to be moved"/>
96+
<entry name="n_resize" value="19" summary="resizing: the north border is to be moved"/>
97+
<entry name="ne_resize" value="20" summary="resizing: the north-east corner is to be moved"/>
98+
<entry name="nw_resize" value="21" summary="resizing: the north-west corner is to be moved"/>
99+
<entry name="s_resize" value="22" summary="resizing: the south border is to be moved"/>
100+
<entry name="se_resize" value="23" summary="resizing: the south-east corner is to be moved"/>
101+
<entry name="sw_resize" value="24" summary="resizing: the south-west corner is to be moved"/>
102+
<entry name="w_resize" value="25" summary="resizing: the west border is to be moved"/>
103+
<entry name="ew_resize" value="26" summary="resizing: the east and west borders are to be moved"/>
104+
<entry name="ns_resize" value="27" summary="resizing: the north and south borders are to be moved"/>
105+
<entry name="nesw_resize" value="28" summary="resizing: the north-east and south-west corners are to be moved"/>
106+
<entry name="nwse_resize" value="29" summary="resizing: the north-west and south-east corners are to be moved"/>
107+
<entry name="col_resize" value="30" summary="resizing: that the item/column can be resized horizontally"/>
108+
<entry name="row_resize" value="31" summary="resizing: that the item/row can be resized vertically"/>
109+
<entry name="all_scroll" value="32" summary="something can be scrolled in any direction"/>
110+
<entry name="zoom_in" value="33" summary="something can be zoomed in"/>
111+
<entry name="zoom_out" value="34" summary="something can be zoomed out"/>
112+
</enum>
113+
114+
<enum name="error">
115+
<entry name="invalid_shape" value="1"
116+
summary="the specified shape value is invalid"/>
117+
</enum>
118+
119+
<request name="destroy" type="destructor">
120+
<description summary="destroy the cursor shape device">
121+
Destroy the cursor shape device.
122+
123+
The device cursor shape remains unchanged.
124+
</description>
125+
</request>
126+
127+
<request name="set_shape">
128+
<description summary="set device cursor to the shape">
129+
Sets the device cursor to the specified shape. The compositor will
130+
change the cursor image based on the specified shape.
131+
132+
The cursor actually changes only if the input device focus is one of
133+
the requesting client's surfaces. If any, the previous cursor image
134+
(surface or shape) is replaced.
135+
136+
The "shape" argument must be a valid enum entry, otherwise the
137+
invalid_shape protocol error is raised.
138+
139+
This is similar to the wl_pointer.set_cursor and
140+
zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
141+
shape instead of contents in the form of a surface. Clients can mix
142+
set_cursor and set_shape requests.
143+
144+
The serial parameter must match the latest wl_pointer.enter or
145+
zwp_tablet_tool_v2.proximity_in serial number sent to the client.
146+
Otherwise the request will be ignored.
147+
</description>
148+
<arg name="serial" type="uint" summary="serial number of the enter event"/>
149+
<arg name="shape" type="uint" enum="shape"/>
150+
</request>
151+
</interface>
152+
</protocol>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Tablet protocol
2+
3+
Maintainers:
4+
Peter Hutterer <[email protected]> (@whot)

0 commit comments

Comments
 (0)