wayland: Support the cursor-shape protocol
If present, use the cursor-shape protocol instead of manually updating a pointer surface. This commit supports both v1 of the protocol and the (still unmerged) v2 additions to the enumeration. This was tested with both kwin and mutter. (cherry picked from commit a63d6d1dc7a8ebdf61c682196f89917846cbe8ac)
This commit is contained in:
parent
cc14115d09
commit
b281c8035f
@ -211,6 +211,13 @@ gdk_wayland_cursor_get_surface (GdkCursor *cursor,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
_gdk_wayland_cursor_get_name (GdkCursor *cursor)
|
||||||
|
{
|
||||||
|
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
|
||||||
|
return wayland_cursor->name;
|
||||||
|
}
|
||||||
|
|
||||||
struct wl_buffer *
|
struct wl_buffer *
|
||||||
_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
||||||
guint image_index,
|
guint image_index,
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "gdkseatprivate.h"
|
#include "gdkseatprivate.h"
|
||||||
#include "pointer-gestures-unstable-v1-client-protocol.h"
|
#include "pointer-gestures-unstable-v1-client-protocol.h"
|
||||||
#include "tablet-unstable-v2-client-protocol.h"
|
#include "tablet-unstable-v2-client-protocol.h"
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ struct _GdkWaylandPointerData {
|
|||||||
uint32_t grab_time;
|
uint32_t grab_time;
|
||||||
|
|
||||||
struct wl_surface *pointer_surface;
|
struct wl_surface *pointer_surface;
|
||||||
|
struct wp_cursor_shape_device_v1 *shape_device;
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
guint cursor_timeout_id;
|
guint cursor_timeout_id;
|
||||||
guint cursor_image_index;
|
guint cursor_image_index;
|
||||||
@ -115,6 +117,7 @@ struct _GdkWaylandTabletToolData
|
|||||||
{
|
{
|
||||||
GdkSeat *seat;
|
GdkSeat *seat;
|
||||||
struct zwp_tablet_tool_v2 *wp_tablet_tool;
|
struct zwp_tablet_tool_v2 *wp_tablet_tool;
|
||||||
|
struct wp_cursor_shape_device_v1 *shape_device;
|
||||||
GdkAxisFlags axes;
|
GdkAxisFlags axes;
|
||||||
GdkDeviceToolType type;
|
GdkDeviceToolType type;
|
||||||
guint64 hardware_serial;
|
guint64 hardware_serial;
|
||||||
@ -406,6 +409,77 @@ gdk_wayland_device_manager_find_pad (GdkWaylandSeat *seat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const char *cursor_name;
|
||||||
|
unsigned int shape;
|
||||||
|
unsigned int version;
|
||||||
|
} shape_map[] = {
|
||||||
|
{ "default", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT, 1 },
|
||||||
|
{ "context-menu", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CONTEXT_MENU, 1 },
|
||||||
|
{ "help", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_HELP, 1 },
|
||||||
|
{ "pointer", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER, 1 },
|
||||||
|
{ "progress", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_PROGRESS },
|
||||||
|
{ "wait", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_WAIT, 1 },
|
||||||
|
{ "cell", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CELL, 1 },
|
||||||
|
{ "crosshair", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR, 1 },
|
||||||
|
{ "text", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT, 1 },
|
||||||
|
{ "vertical-text", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_VERTICAL_TEXT, 1 },
|
||||||
|
{ "alias", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALIAS, 1 },
|
||||||
|
{ "copy", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_COPY, 1 },
|
||||||
|
{ "move", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_MOVE, 1 },
|
||||||
|
{ "no-drop", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NO_DROP, 1 },
|
||||||
|
{ "not-allowed", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NOT_ALLOWED, 1 },
|
||||||
|
{ "grab", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRAB, 1 },
|
||||||
|
{ "grabbing", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRABBING, 1 },
|
||||||
|
{ "e-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_E_RESIZE, 1 },
|
||||||
|
{ "n-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_N_RESIZE, 1 },
|
||||||
|
{ "ne-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NE_RESIZE, 1 },
|
||||||
|
{ "nw-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NW_RESIZE, 1 },
|
||||||
|
{ "s-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_S_RESIZE, 1 },
|
||||||
|
{ "se-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SE_RESIZE, 1 },
|
||||||
|
{ "sw-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SW_RESIZE, 1 },
|
||||||
|
{ "w-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_W_RESIZE, 1 },
|
||||||
|
{ "ew-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_EW_RESIZE, 1 },
|
||||||
|
{ "ns-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NS_RESIZE, 1 },
|
||||||
|
{ "nesw-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NESW_RESIZE, 1 },
|
||||||
|
{ "nwse-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NWSE_RESIZE, 1 },
|
||||||
|
{ "col-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_COL_RESIZE, 1 },
|
||||||
|
{ "row-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ROW_RESIZE, 1 },
|
||||||
|
{ "all-scroll", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_SCROLL, 1 },
|
||||||
|
{ "zoom-in", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ZOOM_IN, 1 },
|
||||||
|
{ "zoom-out", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ZOOM_OUT, 1 },
|
||||||
|
{ "all-scroll", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_SCROLL, 1 },
|
||||||
|
/* the following a v2 additions, with a fallback for v1 */
|
||||||
|
{ "dnd-ask", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DND_ASK, 2 },
|
||||||
|
{ "dnd-ask", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CONTEXT_MENU, 1 },
|
||||||
|
{ "all-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_RESIZE, 2 },
|
||||||
|
{ "all-resize", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_MOVE, 1 },
|
||||||
|
{ "none", WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NONE, 2 },
|
||||||
|
{ "none", 0, 1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
_gdk_wayland_cursor_get_shape (GdkCursor *cursor,
|
||||||
|
int version)
|
||||||
|
{
|
||||||
|
gsize i;
|
||||||
|
const char *cursor_name;
|
||||||
|
|
||||||
|
cursor_name = _gdk_wayland_cursor_get_name (cursor);
|
||||||
|
if (cursor_name == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (shape_map); i++)
|
||||||
|
{
|
||||||
|
if (g_str_equal (shape_map[i].cursor_name, cursor_name) &&
|
||||||
|
version >= shape_map[i].version)
|
||||||
|
return shape_map[i].shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_wayland_device_update_window_cursor (GdkDevice *device)
|
gdk_wayland_device_update_window_cursor (GdkDevice *device)
|
||||||
{
|
{
|
||||||
@ -416,29 +490,50 @@ gdk_wayland_device_update_window_cursor (GdkDevice *device)
|
|||||||
guint next_image_index, next_image_delay;
|
guint next_image_index, next_image_delay;
|
||||||
gboolean retval = G_SOURCE_REMOVE;
|
gboolean retval = G_SOURCE_REMOVE;
|
||||||
GdkWaylandTabletData *tablet;
|
GdkWaylandTabletData *tablet;
|
||||||
|
unsigned int shape;
|
||||||
|
|
||||||
tablet = gdk_wayland_device_manager_find_tablet (seat, device);
|
tablet = gdk_wayland_device_manager_find_tablet (seat, device);
|
||||||
|
|
||||||
|
if (!pointer->cursor)
|
||||||
|
{
|
||||||
|
pointer->cursor_timeout_id = 0;
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tablet && !tablet->current_tool)
|
||||||
|
{
|
||||||
|
pointer->cursor_timeout_id = 0;
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDK_WAYLAND_DISPLAY (seat->display)->cursor_shape)
|
||||||
|
{
|
||||||
|
shape = _gdk_wayland_cursor_get_shape (pointer->cursor,
|
||||||
|
wp_cursor_shape_manager_v1_get_version (GDK_WAYLAND_DISPLAY (seat->display)->cursor_shape));
|
||||||
|
if (shape != 0)
|
||||||
|
{
|
||||||
|
if (tablet && tablet->current_tool->shape_device)
|
||||||
|
{
|
||||||
|
wp_cursor_shape_device_v1_set_shape (tablet->current_tool->shape_device, pointer->enter_serial, shape);
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
else if (seat->wl_pointer && pointer->shape_device)
|
||||||
|
{
|
||||||
|
wp_cursor_shape_device_v1_set_shape (pointer->shape_device, pointer->enter_serial, shape);
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pointer->cursor)
|
if (pointer->cursor)
|
||||||
{
|
{
|
||||||
buffer = _gdk_wayland_cursor_get_buffer (pointer->cursor,
|
buffer = _gdk_wayland_cursor_get_buffer (pointer->cursor,
|
||||||
pointer->cursor_image_index,
|
pointer->cursor_image_index,
|
||||||
&x, &y, &w, &h, &scale);
|
&x, &y, &w, &h, &scale);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
pointer->cursor_timeout_id = 0;
|
|
||||||
return G_SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tablet)
|
if (tablet)
|
||||||
{
|
{
|
||||||
if (!tablet->current_tool)
|
|
||||||
{
|
|
||||||
pointer->cursor_timeout_id = 0;
|
|
||||||
return G_SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
zwp_tablet_tool_v2_set_cursor (tablet->current_tool->wp_tablet_tool,
|
zwp_tablet_tool_v2_set_cursor (tablet->current_tool->wp_tablet_tool,
|
||||||
pointer->enter_serial,
|
pointer->enter_serial,
|
||||||
pointer->pointer_surface,
|
pointer->pointer_surface,
|
||||||
@ -2856,6 +2951,8 @@ static void
|
|||||||
_gdk_wayland_seat_remove_tool (GdkWaylandSeat *seat,
|
_gdk_wayland_seat_remove_tool (GdkWaylandSeat *seat,
|
||||||
GdkWaylandTabletToolData *tool)
|
GdkWaylandTabletToolData *tool)
|
||||||
{
|
{
|
||||||
|
g_clear_pointer (&tool->shape_device, wp_cursor_shape_device_v1_destroy);
|
||||||
|
|
||||||
seat->tablet_tools = g_list_remove (seat->tablet_tools, tool);
|
seat->tablet_tools = g_list_remove (seat->tablet_tools, tool);
|
||||||
|
|
||||||
gdk_seat_tool_removed (GDK_SEAT (seat), tool->tool);
|
gdk_seat_tool_removed (GDK_SEAT (seat), tool->tool);
|
||||||
@ -3185,6 +3282,12 @@ seat_handle_capabilities (void *data,
|
|||||||
&gesture_pinch_listener, seat);
|
&gesture_pinch_listener, seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (display_wayland->cursor_shape)
|
||||||
|
{
|
||||||
|
seat->pointer_info.shape_device =
|
||||||
|
wp_cursor_shape_manager_v1_get_pointer (display_wayland->cursor_shape, seat->wl_pointer);
|
||||||
|
}
|
||||||
|
|
||||||
g_signal_emit_by_name (device_manager, "device-added", seat->pointer);
|
g_signal_emit_by_name (device_manager, "device-added", seat->pointer);
|
||||||
}
|
}
|
||||||
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && seat->wl_pointer)
|
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && seat->wl_pointer)
|
||||||
@ -3231,6 +3334,8 @@ seat_handle_capabilities (void *data,
|
|||||||
g_signal_emit_by_name (device_manager, "device-removed", seat->continuous_scrolling);
|
g_signal_emit_by_name (device_manager, "device-removed", seat->continuous_scrolling);
|
||||||
g_clear_object (&seat->continuous_scrolling);
|
g_clear_object (&seat->continuous_scrolling);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_clear_pointer (&seat->pointer_info.shape_device, wp_cursor_shape_device_v1_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !seat->wl_keyboard)
|
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !seat->wl_keyboard)
|
||||||
@ -4625,6 +4730,7 @@ tablet_seat_handle_tool_added (void *data,
|
|||||||
{
|
{
|
||||||
GdkWaylandSeat *seat = data;
|
GdkWaylandSeat *seat = data;
|
||||||
GdkWaylandTabletToolData *tool;
|
GdkWaylandTabletToolData *tool;
|
||||||
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
|
||||||
|
|
||||||
tool = g_new0 (GdkWaylandTabletToolData, 1);
|
tool = g_new0 (GdkWaylandTabletToolData, 1);
|
||||||
tool->wp_tablet_tool = wp_tablet_tool;
|
tool->wp_tablet_tool = wp_tablet_tool;
|
||||||
@ -4634,6 +4740,13 @@ tablet_seat_handle_tool_added (void *data,
|
|||||||
zwp_tablet_tool_v2_set_user_data (wp_tablet_tool, tool);
|
zwp_tablet_tool_v2_set_user_data (wp_tablet_tool, tool);
|
||||||
|
|
||||||
seat->tablet_tools = g_list_prepend (seat->tablet_tools, tool);
|
seat->tablet_tools = g_list_prepend (seat->tablet_tools, tool);
|
||||||
|
|
||||||
|
if (display->cursor_shape)
|
||||||
|
{
|
||||||
|
tool->shape_device =
|
||||||
|
wp_cursor_shape_manager_v1_get_tablet_tool_v2 (
|
||||||
|
display->cursor_shape, tool->wp_tablet_tool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -553,6 +553,12 @@ gdk_registry_handle_global (void *data,
|
|||||||
display_wayland->xdg_activation_version);
|
display_wayland->xdg_activation_version);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else if (strcmp (interface, wp_cursor_shape_manager_v1_interface.name) == 0)
|
||||||
|
{
|
||||||
|
display_wayland->cursor_shape =
|
||||||
|
wl_registry_bind (display_wayland->wl_registry, id,
|
||||||
|
&wp_cursor_shape_manager_v1_interface, 1);
|
||||||
|
}
|
||||||
|
|
||||||
g_hash_table_insert (display_wayland->known_globals,
|
g_hash_table_insert (display_wayland->known_globals,
|
||||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#ifdef HAVE_XDG_ACTIVATION
|
#ifdef HAVE_XDG_ACTIVATION
|
||||||
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <gdk/wayland/cursor-shape-v1-client-protocol.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gdk/gdkkeys.h>
|
#include <gdk/gdkkeys.h>
|
||||||
@ -108,6 +109,7 @@ struct _GdkWaylandDisplay
|
|||||||
#ifdef HAVE_XDG_ACTIVATION
|
#ifdef HAVE_XDG_ACTIVATION
|
||||||
struct xdg_activation_v1 *xdg_activation;
|
struct xdg_activation_v1 *xdg_activation;
|
||||||
#endif
|
#endif
|
||||||
|
struct wp_cursor_shape_manager_v1 *cursor_shape;
|
||||||
|
|
||||||
GList *async_roundtrips;
|
GList *async_roundtrips;
|
||||||
|
|
||||||
|
@ -89,6 +89,8 @@ gboolean _gdk_wayland_display_supports_cursor_color (GdkDisplay *display);
|
|||||||
void gdk_wayland_display_system_bell (GdkDisplay *display,
|
void gdk_wayland_display_system_bell (GdkDisplay *display,
|
||||||
GdkWindow *window);
|
GdkWindow *window);
|
||||||
|
|
||||||
|
const char *_gdk_wayland_cursor_get_name (GdkCursor *cursor);
|
||||||
|
|
||||||
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
||||||
guint image_index,
|
guint image_index,
|
||||||
int *hotspot_x,
|
int *hotspot_x,
|
||||||
|
@ -59,6 +59,7 @@ proto_sources = [
|
|||||||
['server-decoration', 'private' ],
|
['server-decoration', 'private' ],
|
||||||
['xdg-output', 'unstable', 'v1', ],
|
['xdg-output', 'unstable', 'v1', ],
|
||||||
['primary-selection', 'unstable', 'v1', ],
|
['primary-selection', 'unstable', 'v1', ],
|
||||||
|
['cursor-shape-v1', 'private', ],
|
||||||
]
|
]
|
||||||
if wlprotocolsdep.version().version_compare('>=1.21')
|
if wlprotocolsdep.version().version_compare('>=1.21')
|
||||||
proto_sources += [['xdg-activation', 'staging', 'v1', ]]
|
proto_sources += [['xdg-activation', 'staging', 'v1', ]]
|
||||||
|
163
gdk/wayland/protocol/cursor-shape-v1.xml
Normal file
163
gdk/wayland/protocol/cursor-shape-v1.xml
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="cursor_shape_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright 2018 The Chromium Authors
|
||||||
|
Copyright 2023 Simon Ser
|
||||||
|
|
||||||
|
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.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_cursor_shape_manager_v1" version="2">
|
||||||
|
<description summary="cursor shape manager">
|
||||||
|
This global offers an alternative, optional way to set cursor images. This
|
||||||
|
new way uses enumerated cursors instead of a wl_surface like
|
||||||
|
wl_pointer.set_cursor does.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the manager">
|
||||||
|
Destroy the cursor shape manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_pointer">
|
||||||
|
<description summary="manage the cursor shape of a pointer device">
|
||||||
|
Obtain a wp_cursor_shape_device_v1 for a wl_pointer object.
|
||||||
|
|
||||||
|
When the pointer capability is removed from the wl_seat, the
|
||||||
|
wp_cursor_shape_device_v1 object becomes inert.
|
||||||
|
</description>
|
||||||
|
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_tablet_tool_v2">
|
||||||
|
<description summary="manage the cursor shape of a tablet tool device">
|
||||||
|
Obtain a wp_cursor_shape_device_v1 for a zwp_tablet_tool_v2 object.
|
||||||
|
|
||||||
|
When the zwp_tablet_tool_v2 is removed, the wp_cursor_shape_device_v1
|
||||||
|
object becomes inert.
|
||||||
|
</description>
|
||||||
|
<arg name="cursor_shape_device" type="new_id" interface="wp_cursor_shape_device_v1"/>
|
||||||
|
<arg name="tablet_tool" type="object" interface="zwp_tablet_tool_v2"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_cursor_shape_device_v1" version="2">
|
||||||
|
<description summary="cursor shape for a device">
|
||||||
|
This interface allows clients to set the cursor shape.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="shape">
|
||||||
|
<description summary="cursor shapes">
|
||||||
|
This enum describes cursor shapes.
|
||||||
|
|
||||||
|
The names are taken from the CSS W3C specification:
|
||||||
|
https://w3c.github.io/csswg-drafts/css-ui/#cursor
|
||||||
|
with a few additions.
|
||||||
|
|
||||||
|
Note that there are some groups of cursor shapes that are related:
|
||||||
|
The first group is drag-and-drop cursors which are used to indicate
|
||||||
|
the selected action during dnd operations. The second group is resize
|
||||||
|
cursors which are used to indicate resizing and moving possibilities
|
||||||
|
on window borders. It is recommended that the shapes in these groups
|
||||||
|
should use visually compatible images and metaphors.
|
||||||
|
</description>
|
||||||
|
<entry name="default" value="1" summary="default cursor"/>
|
||||||
|
<entry name="context_menu" value="2" summary="a context menu is available for the object under the cursor"/>
|
||||||
|
<entry name="help" value="3" summary="help is available for the object under the cursor"/>
|
||||||
|
<entry name="pointer" value="4" summary="pointer that indicates a link or another interactive element"/>
|
||||||
|
<entry name="progress" value="5" summary="progress indicator"/>
|
||||||
|
<entry name="wait" value="6" summary="program is busy, user should wait"/>
|
||||||
|
<entry name="cell" value="7" summary="a cell or set of cells may be selected"/>
|
||||||
|
<entry name="crosshair" value="8" summary="simple crosshair"/>
|
||||||
|
<entry name="text" value="9" summary="text may be selected"/>
|
||||||
|
<entry name="vertical_text" value="10" summary="vertical text may be selected"/>
|
||||||
|
<entry name="alias" value="11" summary="drag-and-drop: alias of/shortcut to something is to be created"/>
|
||||||
|
<entry name="copy" value="12" summary="drag-and-drop: something is to be copied"/>
|
||||||
|
<entry name="move" value="13" summary="drag-and-drop: something is to be moved"/>
|
||||||
|
<entry name="no_drop" value="14" summary="drag-and-drop: the dragged item cannot be dropped at the current cursor location"/>
|
||||||
|
<entry name="not_allowed" value="15" summary="drag-and-drop: the requested action will not be carried out"/>
|
||||||
|
<entry name="grab" value="16" summary="drag-and-drop: something can be grabbed"/>
|
||||||
|
<entry name="grabbing" value="17" summary="drag-and-drop: something is being grabbed"/>
|
||||||
|
<entry name="e_resize" value="18" summary="resizing: the east border is to be moved"/>
|
||||||
|
<entry name="n_resize" value="19" summary="resizing: the north border is to be moved"/>
|
||||||
|
<entry name="ne_resize" value="20" summary="resizing: the north-east corner is to be moved"/>
|
||||||
|
<entry name="nw_resize" value="21" summary="resizing: the north-west corner is to be moved"/>
|
||||||
|
<entry name="s_resize" value="22" summary="resizing: the south border is to be moved"/>
|
||||||
|
<entry name="se_resize" value="23" summary="resizing: the south-east corner is to be moved"/>
|
||||||
|
<entry name="sw_resize" value="24" summary="resizing: the south-west corner is to be moved"/>
|
||||||
|
<entry name="w_resize" value="25" summary="resizing: the west border is to be moved"/>
|
||||||
|
<entry name="ew_resize" value="26" summary="resizing: the east and west borders are to be moved"/>
|
||||||
|
<entry name="ns_resize" value="27" summary="resizing: the north and south borders are to be moved"/>
|
||||||
|
<entry name="nesw_resize" value="28" summary="resizing: the north-east and south-west corners are to be moved"/>
|
||||||
|
<entry name="nwse_resize" value="29" summary="resizing: the north-west and south-east corners are to be moved"/>
|
||||||
|
<entry name="col_resize" value="30" summary="resizing: that the item/column can be resized horizontally"/>
|
||||||
|
<entry name="row_resize" value="31" summary="resizing: that the item/row can be resized vertically"/>
|
||||||
|
<entry name="all_scroll" value="32" summary="something can be scrolled in any direction"/>
|
||||||
|
<entry name="zoom_in" value="33" summary="something can be zoomed in"/>
|
||||||
|
<entry name="zoom_out" value="34" summary="something can be zoomed out"/>
|
||||||
|
<entry name="dnd_ask" value="35" summary="drag-and-drop: selected drag action is ASK (non-css value)" since="2"/>
|
||||||
|
<entry name="all_resize" value="36" summary="resizing: something can be moved or resized in any direction (non-css value)" since="2"/>
|
||||||
|
<entry name="none" value="37" summary="no cursor is rendered" since="2"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="invalid_shape" value="1"
|
||||||
|
summary="the specified shape value is invalid"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the cursor shape device">
|
||||||
|
Destroy the cursor shape device.
|
||||||
|
|
||||||
|
The device cursor shape remains unchanged.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_shape">
|
||||||
|
<description summary="set device cursor to the shape">
|
||||||
|
Sets the device cursor to the specified shape. The compositor will
|
||||||
|
change the cursor image based on the specified shape.
|
||||||
|
|
||||||
|
The cursor actually changes only if the input device focus is one of
|
||||||
|
the requesting client's surfaces. If any, the previous cursor image
|
||||||
|
(surface or shape) is replaced.
|
||||||
|
|
||||||
|
The "shape" argument must be a valid enum entry, otherwise the
|
||||||
|
invalid_shape protocol error is raised.
|
||||||
|
|
||||||
|
This is similar to the wl_pointer.set_cursor and
|
||||||
|
zwp_tablet_tool_v2.set_cursor requests, but this request accepts a
|
||||||
|
shape instead of contents in the form of a surface. Clients can mix
|
||||||
|
set_cursor and set_shape requests.
|
||||||
|
|
||||||
|
The serial parameter must match the latest wl_pointer.enter or
|
||||||
|
zwp_tablet_tool_v2.proximity_in serial number sent to the client.
|
||||||
|
Otherwise the request will be ignored.
|
||||||
|
</description>
|
||||||
|
<arg name="serial" type="uint" summary="serial number of the enter event"/>
|
||||||
|
<arg name="shape" type="uint" enum="shape"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
Loading…
Reference in New Issue
Block a user