wayland: Add cursor-shape-v1 protocol support
parent
9bdb992925
commit
c2e9693de5
|
@ -56,13 +56,14 @@
|
||||||
#define BTN_SIDE (0x113)
|
#define BTN_SIDE (0x113)
|
||||||
#define BTN_EXTRA (0x114)
|
#define BTN_EXTRA (0x114)
|
||||||
#endif
|
#endif
|
||||||
|
#include "../../events/SDL_keysym_to_scancode_c.h"
|
||||||
|
#include "../../events/imKStoUCS.h"
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
#include "../../events/imKStoUCS.h"
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include "../../events/SDL_keysym_to_scancode_c.h"
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
/* Weston uses a ratio of 10 units per scroll tick */
|
/* Weston uses a ratio of 10 units per scroll tick */
|
||||||
#define WAYLAND_WHEEL_AXIS_UNIT 10
|
#define WAYLAND_WHEEL_AXIS_UNIT 10
|
||||||
|
@ -245,6 +246,17 @@ void Wayland_RegisterTimestampListeners(struct SDL_WaylandInput *input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wayland_CreateCursorShapeDevice(struct SDL_WaylandInput *input)
|
||||||
|
{
|
||||||
|
SDL_VideoData *viddata = input->display;
|
||||||
|
|
||||||
|
if (viddata->cursor_shape_manager) {
|
||||||
|
if (input->pointer && !input->cursor_shape) {
|
||||||
|
input->cursor_shape = wp_cursor_shape_manager_v1_get_pointer(viddata->cursor_shape_manager, input->pointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns SDL_TRUE if a key repeat event was due */
|
/* Returns SDL_TRUE if a key repeat event was due */
|
||||||
static SDL_bool keyboard_repeat_handle(SDL_WaylandKeyboardRepeat *repeat_info, Uint64 elapsed)
|
static SDL_bool keyboard_repeat_handle(SDL_WaylandKeyboardRepeat *repeat_info, Uint64 elapsed)
|
||||||
{
|
{
|
||||||
|
@ -1696,10 +1708,17 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
|
||||||
input->pointer = wl_seat_get_pointer(seat);
|
input->pointer = wl_seat_get_pointer(seat);
|
||||||
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof(input->pointer_curr_axis_info));
|
SDL_memset(&input->pointer_curr_axis_info, 0, sizeof(input->pointer_curr_axis_info));
|
||||||
input->display->pointer = input->pointer;
|
input->display->pointer = input->pointer;
|
||||||
|
|
||||||
|
Wayland_CreateCursorShapeDevice(input);
|
||||||
|
|
||||||
wl_pointer_set_user_data(input->pointer, input);
|
wl_pointer_set_user_data(input->pointer, input);
|
||||||
wl_pointer_add_listener(input->pointer, &pointer_listener,
|
wl_pointer_add_listener(input->pointer, &pointer_listener,
|
||||||
input);
|
input);
|
||||||
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
|
} else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
|
||||||
|
if (input->cursor_shape) {
|
||||||
|
wp_cursor_shape_device_v1_destroy(input->cursor_shape);
|
||||||
|
input->cursor_shape = NULL;
|
||||||
|
}
|
||||||
wl_pointer_destroy(input->pointer);
|
wl_pointer_destroy(input->pointer);
|
||||||
input->pointer = NULL;
|
input->pointer = NULL;
|
||||||
input->display->pointer = NULL;
|
input->display->pointer = NULL;
|
||||||
|
@ -3066,6 +3085,10 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input->cursor_shape) {
|
||||||
|
wp_cursor_shape_device_v1_destroy(input->cursor_shape);
|
||||||
|
}
|
||||||
|
|
||||||
if (input->pointer) {
|
if (input->pointer) {
|
||||||
if (wl_pointer_get_version(input->pointer) >= WL_POINTER_RELEASE_SINCE_VERSION) {
|
if (wl_pointer_get_version(input->pointer) >= WL_POINTER_RELEASE_SINCE_VERSION) {
|
||||||
wl_pointer_release(input->pointer);
|
wl_pointer_release(input->pointer);
|
||||||
|
|
|
@ -102,6 +102,7 @@ struct SDL_WaylandInput
|
||||||
SDL_WaylandDataDevice *data_device;
|
SDL_WaylandDataDevice *data_device;
|
||||||
SDL_WaylandPrimarySelectionDevice *primary_selection_device;
|
SDL_WaylandPrimarySelectionDevice *primary_selection_device;
|
||||||
SDL_WaylandTextInput *text_input;
|
SDL_WaylandTextInput *text_input;
|
||||||
|
struct wp_cursor_shape_device_v1 *cursor_shape;
|
||||||
struct zwp_relative_pointer_v1 *relative_pointer;
|
struct zwp_relative_pointer_v1 *relative_pointer;
|
||||||
struct zwp_input_timestamps_v1 *keyboard_timestamps;
|
struct zwp_input_timestamps_v1 *keyboard_timestamps;
|
||||||
struct zwp_input_timestamps_v1 *pointer_timestamps;
|
struct zwp_input_timestamps_v1 *pointer_timestamps;
|
||||||
|
@ -209,6 +210,7 @@ extern void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_
|
||||||
extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input);
|
extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input);
|
||||||
|
|
||||||
extern void Wayland_RegisterTimestampListeners(struct SDL_WaylandInput *input);
|
extern void Wayland_RegisterTimestampListeners(struct SDL_WaylandInput *input);
|
||||||
|
extern void Wayland_CreateCursorShapeDevice(struct SDL_WaylandInput *input);
|
||||||
|
|
||||||
/* The implicit grab serial needs to be updated on:
|
/* The implicit grab serial needs to be updated on:
|
||||||
* - Keyboard key down/up
|
* - Keyboard key down/up
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
#include "wayland-cursor.h"
|
#include "wayland-cursor.h"
|
||||||
#include "SDL_waylandmouse.h"
|
#include "SDL_waylandmouse.h"
|
||||||
|
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
#include "../../SDL_hints_c.h"
|
#include "../../SDL_hints_c.h"
|
||||||
|
|
||||||
static SDL_Cursor *sys_cursors[SDL_HITTEST_RESIZE_LEFT + 1];
|
static SDL_Cursor *sys_cursors[SDL_HITTEST_RESIZE_LEFT + 1];
|
||||||
|
@ -529,14 +531,19 @@ static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->driverdata = (void *)cdata;
|
cursor->driverdata = (void *)cdata;
|
||||||
|
|
||||||
cdata->surface = wl_compositor_create_surface(data->compositor);
|
/* The surface is only necessary if the cursor shape manager is not present.
|
||||||
wl_surface_set_user_data(cdata->surface, NULL);
|
*
|
||||||
|
* Note that we can't actually set any other cursor properties, as this
|
||||||
/* Note that we can't actually set any other cursor properties, as this
|
|
||||||
* is output-specific. See wayland_get_system_cursor for the rest!
|
* is output-specific. See wayland_get_system_cursor for the rest!
|
||||||
*/
|
*/
|
||||||
|
if (!data->cursor_shape_manager) {
|
||||||
|
cdata->surface = wl_compositor_create_surface(data->compositor);
|
||||||
|
wl_surface_set_user_data(cdata->surface, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
cdata->system_cursor = id;
|
cdata->system_cursor = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,6 +588,79 @@ static void Wayland_FreeCursor(SDL_Cursor *cursor)
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Wayland_SetSystemCursorShape(struct SDL_WaylandInput *input, SDL_SystemCursor id)
|
||||||
|
{
|
||||||
|
Uint32 shape;
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case SDL_SYSTEM_CURSOR_ARROW:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_IBEAM:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WAIT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_WAIT;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_CROSSHAIR:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WAITARROW:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_PROGRESS;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_SIZENWSE:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NWSE_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_SIZENESW:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NESW_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_SIZEWE:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_EW_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_SIZENS:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NS_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_SIZEALL:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_SCROLL;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_NO:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NOT_ALLOWED;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_HAND:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_TOPLEFT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NW_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_TOP:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_N_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_TOPRIGHT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NE_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_RIGHT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_E_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMRIGHT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SE_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_BOTTOM:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_S_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMLEFT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SW_RESIZE;
|
||||||
|
break;
|
||||||
|
case SDL_SYSTEM_CURSOR_WINDOW_LEFT:
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_W_RESIZE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SDL_assert(0); /* Should never be here... */
|
||||||
|
shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_cursor_shape_device_v1_set_shape(input->cursor_shape, input->pointer_enter_serial, shape);
|
||||||
|
}
|
||||||
|
|
||||||
static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
|
@ -598,7 +678,10 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
||||||
|
|
||||||
/* TODO: High-DPI custom cursors? -flibit */
|
/* TODO: High-DPI custom cursors? -flibit */
|
||||||
if (!data->shm_data) {
|
if (!data->shm_data) {
|
||||||
if (!wayland_get_system_cursor(d, data, &scale)) {
|
if (input->cursor_shape) {
|
||||||
|
Wayland_SetSystemCursorShape(input, data->system_cursor);
|
||||||
|
return 0;
|
||||||
|
} else if (!wayland_get_system_cursor(d, data, &scale)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,41 +23,42 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||||
|
|
||||||
#include "../../events/SDL_events_c.h"
|
|
||||||
#include "../../core/linux/SDL_system_theme.h"
|
#include "../../core/linux/SDL_system_theme.h"
|
||||||
|
#include "../../events/SDL_events_c.h"
|
||||||
|
|
||||||
#include "SDL_waylandvideo.h"
|
|
||||||
#include "SDL_waylandevents_c.h"
|
|
||||||
#include "SDL_waylandwindow.h"
|
|
||||||
#include "SDL_waylandopengles.h"
|
|
||||||
#include "SDL_waylandmouse.h"
|
|
||||||
#include "SDL_waylandkeyboard.h"
|
|
||||||
#include "SDL_waylandclipboard.h"
|
#include "SDL_waylandclipboard.h"
|
||||||
#include "SDL_waylandvulkan.h"
|
#include "SDL_waylandevents_c.h"
|
||||||
|
#include "SDL_waylandkeyboard.h"
|
||||||
#include "SDL_waylandmessagebox.h"
|
#include "SDL_waylandmessagebox.h"
|
||||||
|
#include "SDL_waylandmouse.h"
|
||||||
|
#include "SDL_waylandopengles.h"
|
||||||
|
#include "SDL_waylandvideo.h"
|
||||||
|
#include "SDL_waylandvulkan.h"
|
||||||
|
#include "SDL_waylandwindow.h"
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
|
|
||||||
#include "xdg-shell-client-protocol.h"
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
#include "xdg-decoration-unstable-v1-client-protocol.h"
|
|
||||||
#include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
|
|
||||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
|
||||||
#include "xdg-activation-v1-client-protocol.h"
|
|
||||||
#include "text-input-unstable-v3-client-protocol.h"
|
|
||||||
#include "tablet-unstable-v2-client-protocol.h"
|
|
||||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
|
||||||
#include "viewporter-client-protocol.h"
|
|
||||||
#include "primary-selection-unstable-v1-client-protocol.h"
|
|
||||||
#include "fractional-scale-v1-client-protocol.h"
|
#include "fractional-scale-v1-client-protocol.h"
|
||||||
|
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||||
#include "input-timestamps-unstable-v1-client-protocol.h"
|
#include "input-timestamps-unstable-v1-client-protocol.h"
|
||||||
#include "relative-pointer-unstable-v1-client-protocol.h"
|
|
||||||
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
|
||||||
#include "kde-output-order-v1-client-protocol.h"
|
#include "kde-output-order-v1-client-protocol.h"
|
||||||
|
#include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
|
||||||
|
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
||||||
|
#include "primary-selection-unstable-v1-client-protocol.h"
|
||||||
|
#include "relative-pointer-unstable-v1-client-protocol.h"
|
||||||
|
#include "tablet-unstable-v2-client-protocol.h"
|
||||||
|
#include "text-input-unstable-v3-client-protocol.h"
|
||||||
|
#include "viewporter-client-protocol.h"
|
||||||
|
#include "xdg-activation-v1-client-protocol.h"
|
||||||
|
#include "xdg-decoration-unstable-v1-client-protocol.h"
|
||||||
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||||
|
#include "xdg-shell-client-protocol.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBDECOR_H
|
#ifdef HAVE_LIBDECOR_H
|
||||||
#include <libdecor.h>
|
#include <libdecor.h>
|
||||||
|
@ -200,7 +201,8 @@ error:
|
||||||
static void Wayland_FlushOutputOrder(SDL_VideoData *vid)
|
static void Wayland_FlushOutputOrder(SDL_VideoData *vid)
|
||||||
{
|
{
|
||||||
SDL_WaylandConnectorName *c, *tmp;
|
SDL_WaylandConnectorName *c, *tmp;
|
||||||
wl_list_for_each_safe (c, tmp, &vid->output_order, link) {
|
wl_list_for_each_safe(c, tmp, &vid->output_order, link)
|
||||||
|
{
|
||||||
WAYLAND_wl_list_remove(&c->link);
|
WAYLAND_wl_list_remove(&c->link);
|
||||||
SDL_free(c);
|
SDL_free(c);
|
||||||
}
|
}
|
||||||
|
@ -796,7 +798,7 @@ static void display_handle_done(void *data,
|
||||||
/* ...and the compositor scales the logical viewport... */
|
/* ...and the compositor scales the logical viewport... */
|
||||||
if (video->viewporter) {
|
if (video->viewporter) {
|
||||||
/* ...and viewports are supported, calculate the true scale of the output. */
|
/* ...and viewports are supported, calculate the true scale of the output. */
|
||||||
driverdata->scale_factor = (float) native_mode.w / (float)driverdata->screen_width;
|
driverdata->scale_factor = (float)native_mode.w / (float)driverdata->screen_width;
|
||||||
} else {
|
} else {
|
||||||
/* ...otherwise, the 'native' pixel values are a multiple of the logical screen size. */
|
/* ...otherwise, the 'native' pixel values are a multiple of the logical screen size. */
|
||||||
driverdata->pixel_width = driverdata->screen_width * (int)driverdata->scale_factor;
|
driverdata->pixel_width = driverdata->screen_width * (int)driverdata->scale_factor;
|
||||||
|
@ -906,11 +908,11 @@ static void display_handle_description(void *data, struct wl_output *wl_output,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener = {
|
static const struct wl_output_listener output_listener = {
|
||||||
display_handle_geometry, /* Version 1 */
|
display_handle_geometry, /* Version 1 */
|
||||||
display_handle_mode, /* Version 1 */
|
display_handle_mode, /* Version 1 */
|
||||||
display_handle_done, /* Version 2 */
|
display_handle_done, /* Version 2 */
|
||||||
display_handle_scale, /* Version 2 */
|
display_handle_scale, /* Version 2 */
|
||||||
display_handle_name, /* Version 4 */
|
display_handle_name, /* Version 4 */
|
||||||
display_handle_description /* Version 4 */
|
display_handle_description /* Version 4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -978,7 +980,7 @@ static void Wayland_FinalizeDisplays(SDL_VideoData *vid)
|
||||||
SDL_DisplayData *d;
|
SDL_DisplayData *d;
|
||||||
|
|
||||||
Wayland_SortOutputs(vid);
|
Wayland_SortOutputs(vid);
|
||||||
wl_list_for_each(d, &vid->output_list, link) {
|
wl_list_for_each (d, &vid->output_list, link) {
|
||||||
d->display = SDL_AddVideoDisplay(&d->placeholder, SDL_FALSE);
|
d->display = SDL_AddVideoDisplay(&d->placeholder, SDL_FALSE);
|
||||||
SDL_free(d->placeholder.name);
|
SDL_free(d->placeholder.name);
|
||||||
SDL_zero(d->placeholder);
|
SDL_zero(d->placeholder);
|
||||||
|
@ -1072,6 +1074,11 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
|
||||||
if (d->input) {
|
if (d->input) {
|
||||||
Wayland_RegisterTimestampListeners(d->input);
|
Wayland_RegisterTimestampListeners(d->input);
|
||||||
}
|
}
|
||||||
|
} else if (SDL_strcmp(interface, "wp_cursor_shape_manager_v1") == 0) {
|
||||||
|
d->cursor_shape_manager = wl_registry_bind(d->registry, id, &wp_cursor_shape_manager_v1_interface, 1);
|
||||||
|
if (d->input) {
|
||||||
|
Wayland_CreateCursorShapeDevice(d->input);
|
||||||
|
}
|
||||||
} else if (SDL_strcmp(interface, "kde_output_order_v1") == 0) {
|
} else if (SDL_strcmp(interface, "kde_output_order_v1") == 0) {
|
||||||
d->kde_output_order = wl_registry_bind(d->registry, id, &kde_output_order_v1_interface, 1);
|
d->kde_output_order = wl_registry_bind(d->registry, id, &kde_output_order_v1_interface, 1);
|
||||||
kde_output_order_v1_add_listener(d->kde_output_order, &kde_output_order_listener, d);
|
kde_output_order_v1_add_listener(d->kde_output_order, &kde_output_order_listener, d);
|
||||||
|
@ -1081,7 +1088,7 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
|
||||||
static void display_remove_global(void *data, struct wl_registry *registry, uint32_t id)
|
static void display_remove_global(void *data, struct wl_registry *registry, uint32_t id)
|
||||||
{
|
{
|
||||||
SDL_VideoData *d = data;
|
SDL_VideoData *d = data;
|
||||||
SDL_DisplayData *node;
|
SDL_DisplayData *node;
|
||||||
|
|
||||||
/* We don't get an interface, just an ID, so assume it's a wl_output :shrug: */
|
/* We don't get an interface, just an ID, so assume it's a wl_output :shrug: */
|
||||||
wl_list_for_each (node, &d->output_list, link) {
|
wl_list_for_each (node, &d->output_list, link) {
|
||||||
|
@ -1320,6 +1327,11 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
||||||
data->input_timestamps_manager = NULL;
|
data->input_timestamps_manager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->cursor_shape_manager) {
|
||||||
|
wp_cursor_shape_manager_v1_destroy(data->cursor_shape_manager);
|
||||||
|
data->cursor_shape_manager = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (data->kde_output_order) {
|
if (data->kde_output_order) {
|
||||||
Wayland_FlushOutputOrder(data);
|
Wayland_FlushOutputOrder(data);
|
||||||
kde_output_order_v1_destroy(data->kde_output_order);
|
kde_output_order_v1_destroy(data->kde_output_order);
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct SDL_VideoData
|
||||||
} shell;
|
} shell;
|
||||||
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
|
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
|
||||||
struct zwp_pointer_constraints_v1 *pointer_constraints;
|
struct zwp_pointer_constraints_v1 *pointer_constraints;
|
||||||
|
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||||
struct wl_data_device_manager *data_device_manager;
|
struct wl_data_device_manager *data_device_manager;
|
||||||
struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
|
struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
|
||||||
struct zxdg_decoration_manager_v1 *decoration_manager;
|
struct zxdg_decoration_manager_v1 *decoration_manager;
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
<?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="1">
|
||||||
|
<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.
|
||||||
|
</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.
|
||||||
|
</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="1">
|
||||||
|
<description summary="cursor shape for a device">
|
||||||
|
This interface advertises the list of supported cursor shapes for a
|
||||||
|
device, and 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
|
||||||
|
</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"/>
|
||||||
|
</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