wayland: bump wayland-protocol requirement to 1.31

And wayland-client/cursor to 1.21

Debian Stable has these
This commit is contained in:
llyyr 2024-07-05 21:05:57 +05:30 committed by Dudemanguy
parent 539e95730a
commit 9d7d861202
5 changed files with 13 additions and 71 deletions

View File

@ -1003,9 +1003,9 @@ if features['d3d11']
endif
wayland = {
'deps': [dependency('wayland-client', version: '>= 1.20.0', required: get_option('wayland')),
dependency('wayland-cursor', version: '>= 1.20.0', required: get_option('wayland')),
dependency('wayland-protocols', version: '>= 1.25', required: get_option('wayland')),
'deps': [dependency('wayland-client', version: '>= 1.21.0', required: get_option('wayland')),
dependency('wayland-cursor', version: '>= 1.21.0', required: get_option('wayland')),
dependency('wayland-protocols', version: '>= 1.31', required: get_option('wayland')),
dependency('xkbcommon', version: '>= 0.3.0', required: get_option('wayland'))],
'header': cc.has_header('linux/input-event-codes.h', required: get_option('wayland'),
# Pass CFLAGS from a related package as a hint for non-Linux

View File

@ -4,22 +4,18 @@ protocols = [[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml']
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml']]
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'],
[wl_protocol_dir, 'staging/content-type/content-type-v1.xml'],
[wl_protocol_dir, 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml'],
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml']]
wl_protocols_source = []
wl_protocols_headers = []
foreach v: ['1.27', '1.31', '1.32']
foreach v: ['1.32']
features += {'wayland-protocols-' + v.replace('.', '-'):
wayland['deps'][2].version().version_compare('>=' + v)}
endforeach
if features['wayland-protocols-1-27']
protocols += [[wl_protocol_dir, 'staging/content-type/content-type-v1.xml'],
[wl_protocol_dir, 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml']]
endif
if features['wayland-protocols-1-31']
protocols += [[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml']]
endif
if features['wayland-protocols-1-32']
protocols += [[wl_protocol_dir, 'staging/cursor-shape/cursor-shape-v1.xml'],
[wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml']] # required by cursor-shape

View File

@ -43,10 +43,7 @@
// Generated from wayland-protocols
#include "linux-dmabuf-unstable-v1.h"
#include "viewporter.h"
#if HAVE_WAYLAND_PROTOCOLS_1_27
#include "single-pixel-buffer-v1.h"
#endif
// We need at least enough buffers to avoid a
// flickering artifact in certain formats.
@ -782,10 +779,8 @@ static int preinit(struct vo *vo)
}
if (vo->wl->single_pixel_manager) {
#if HAVE_WAYLAND_PROTOCOLS_1_27
p->solid_buffer = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer(
vo->wl->single_pixel_manager, 0, 0, 0, UINT32_MAX); /* R, G, B, A */
#endif
} else {
int width = 1;
int height = 1;

View File

@ -42,24 +42,14 @@
#include "xdg-decoration-unstable-v1.h"
#include "xdg-shell.h"
#include "viewporter.h"
#if HAVE_WAYLAND_PROTOCOLS_1_27
#include "content-type-v1.h"
#include "single-pixel-buffer-v1.h"
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_31
#include "fractional-scale-v1.h"
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_32
#include "cursor-shape-v1.h"
#endif
#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 21
#define HAVE_WAYLAND_1_21
#endif
#if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 22
#define HAVE_WAYLAND_1_22
#endif
@ -407,7 +397,6 @@ static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_point
{
}
#ifdef HAVE_WAYLAND_1_21
static void pointer_handle_axis_value120(void *data, struct wl_pointer *wl_pointer,
uint32_t axis, int32_t value120)
{
@ -422,7 +411,6 @@ static void pointer_handle_axis_value120(void *data, struct wl_pointer *wl_point
break;
}
}
#endif
static const struct wl_pointer_listener pointer_listener = {
pointer_handle_enter,
@ -434,9 +422,7 @@ static const struct wl_pointer_listener pointer_listener = {
pointer_handle_axis_source,
pointer_handle_axis_stop,
pointer_handle_axis_discrete,
#ifdef HAVE_WAYLAND_1_21
pointer_handle_axis_value120,
#endif
};
static void touch_handle_down(void *data, struct wl_touch *wl_touch,
@ -1192,23 +1178,18 @@ static void handle_configure_bounds(void *data, struct xdg_toplevel *xdg_topleve
wl->bounded_height = height * wl->scaling;
}
#ifdef XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION
static void handle_wm_capabilities(void *data, struct xdg_toplevel *xdg_toplevel,
struct wl_array *capabilities)
{
}
#endif
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
handle_toplevel_config,
handle_toplevel_close,
handle_configure_bounds,
#ifdef XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION
handle_wm_capabilities,
#endif
};
#if HAVE_WAYLAND_PROTOCOLS_1_31
static void preferred_scale(void *data,
struct wp_fractional_scale_v1 *fractional_scale,
uint32_t scale)
@ -1235,7 +1216,6 @@ static void preferred_scale(void *data,
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
preferred_scale,
};
#endif
static const char *zxdg_decoration_mode_to_str(const uint32_t mode)
{
@ -1493,11 +1473,7 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
if (ver < 5)
MP_WARN(wl, "Scrolling won't work because the compositor doesn't "
"support version 5 of wl_seat protocol!\n");
#ifdef HAVE_WAYLAND_1_21
ver = MPMIN(ver, 8); /* Cap at 8 in case new events are added later. */
#else
ver = MPMIN(ver, 7);
#endif
struct vo_wayland_seat *seat = talloc_zero(wl, struct vo_wayland_seat);
seat->wl = wl;
seat->id = id;
@ -1511,7 +1487,6 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
wl->shm = wl_registry_bind(reg, id, &wl_shm_interface, ver);
}
#if HAVE_WAYLAND_PROTOCOLS_1_27
if (!strcmp(interface, wp_content_type_manager_v1_interface.name) && found++) {
ver = 1;
wl->content_type_manager = wl_registry_bind(reg, id, &wp_content_type_manager_v1_interface, ver);
@ -1521,14 +1496,11 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
ver = 1;
wl->single_pixel_manager = wl_registry_bind(reg, id, &wp_single_pixel_buffer_manager_v1_interface, ver);
}
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_31
if (!strcmp(interface, wp_fractional_scale_manager_v1_interface.name) && found++) {
ver = 1;
wl->fractional_scale_manager = wl_registry_bind(reg, id, &wp_fractional_scale_manager_v1_interface, ver);
}
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_32
if (!strcmp(interface, wp_cursor_shape_manager_v1_interface.name) && found++) {
@ -1544,11 +1516,7 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
}
if (!strcmp(interface, xdg_wm_base_interface.name) && found++) {
#ifdef XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION
ver = MPMIN(ver, 6); /* Cap at 6 in case new events are added later. */
#else
ver = MPMIN(ver, 4);
#endif
wl->wm_base = wl_registry_bind(reg, id, &xdg_wm_base_interface, ver);
xdg_wm_base_add_listener(wl->wm_base, &xdg_wm_base_listener, wl);
}
@ -2036,14 +2004,12 @@ static void set_content_type(struct vo_wayland_state *wl)
{
if (!wl->content_type_manager)
return;
#if HAVE_WAYLAND_PROTOCOLS_1_27
// handle auto;
if (wl->vo_opts->content_type == -1) {
wp_content_type_v1_set_content_type(wl->content_type, wl->current_content_type);
} else {
wp_content_type_v1_set_content_type(wl->content_type, wl->vo_opts->content_type);
}
#endif
}
static void set_cursor_shape(struct vo_wayland_seat *s)
@ -2465,10 +2431,8 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
return VO_TRUE;
}
case VOCTRL_CONTENT_TYPE: {
#if HAVE_WAYLAND_PROTOCOLS_1_27
wl->current_content_type = *(enum mp_content_type *)arg;
set_content_type(wl);
#endif
return VO_TRUE;
}
case VOCTRL_GET_FOCUSED: {
@ -2640,7 +2604,6 @@ bool vo_wayland_init(struct vo *vo)
wl->video_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->video_surface, wl->surface);
}
#if HAVE_WAYLAND_PROTOCOLS_1_27
if (wl->content_type_manager) {
wl->content_type = wp_content_type_manager_v1_get_surface_content_type(wl->content_type_manager, wl->surface);
} else {
@ -2652,9 +2615,7 @@ bool vo_wayland_init(struct vo *vo)
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
wp_single_pixel_buffer_manager_v1_interface.name);
}
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_31
if (wl->fractional_scale_manager) {
wl->fractional_scale = wp_fractional_scale_manager_v1_get_fractional_scale(wl->fractional_scale_manager, wl->surface);
wp_fractional_scale_v1_add_listener(wl->fractional_scale, &fractional_scale_listener, wl);
@ -2662,7 +2623,6 @@ bool vo_wayland_init(struct vo *vo)
MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",
wp_fractional_scale_manager_v1_interface.name);
}
#endif
#if HAVE_WAYLAND_PROTOCOLS_1_32
if (!wl->cursor_shape_manager) {
@ -2826,13 +2786,11 @@ void vo_wayland_uninit(struct vo *vo)
if (wl->cursor_theme)
wl_cursor_theme_destroy(wl->cursor_theme);
#if HAVE_WAYLAND_PROTOCOLS_1_27
if (wl->content_type)
wp_content_type_v1_destroy(wl->content_type);
if (wl->content_type_manager)
wp_content_type_manager_v1_destroy(wl->content_type_manager);
#endif
if (wl->dnd_devman)
wl_data_device_manager_destroy(wl->dnd_devman);
@ -2843,13 +2801,11 @@ void vo_wayland_uninit(struct vo *vo)
if (wl->fback_pool)
clean_feedback_pool(wl->fback_pool);
#if HAVE_WAYLAND_PROTOCOLS_1_31
if (wl->fractional_scale)
wp_fractional_scale_v1_destroy(wl->fractional_scale);
if (wl->fractional_scale_manager)
wp_fractional_scale_manager_v1_destroy(wl->fractional_scale_manager);
#endif
if (wl->frame_callback)
wl_callback_destroy(wl->frame_callback);
@ -2890,10 +2846,8 @@ void vo_wayland_uninit(struct vo *vo)
if (wl->shm)
wl_shm_destroy(wl->shm);
#if HAVE_WAYLAND_PROTOCOLS_1_27
if (wl->single_pixel_manager)
wp_single_pixel_buffer_manager_v1_destroy(wl->single_pixel_manager);
#endif
if (wl->surface)
wl_surface_destroy(wl->surface);

View File

@ -92,9 +92,8 @@ struct vo_wayland_state {
int wakeup_pipe[2];
/* content-type */
/* TODO: unvoid these if required wayland protocols is bumped to 1.27+ */
void *content_type_manager;
void *content_type;
struct wp_content_type_manager_v1 *content_type_manager;
struct wp_content_type_v1 *content_type;
int current_content_type;
/* cursor-shape */
@ -102,9 +101,8 @@ struct vo_wayland_state {
void *cursor_shape_manager;
/* fractional-scale */
/* TODO: unvoid these if required wayland protocols is bumped to 1.31+ */
void *fractional_scale_manager;
void *fractional_scale;
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
struct wp_fractional_scale_v1 *fractional_scale;
/* idle-inhibit */
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
@ -125,8 +123,7 @@ struct vo_wayland_state {
bool use_present;
/* single-pixel-buffer */
/* TODO: unvoid this if required wayland-protocols is bumped to 1.27+ */
void *single_pixel_manager;
struct wp_single_pixel_buffer_manager_v1 *single_pixel_manager;
/* xdg-decoration */
struct zxdg_decoration_manager_v1 *xdg_decoration_manager;