96
96
#define SDL_WL_OUTPUT_VERSION 3
97
97
#endif
98
98
99
+ // The SDL wayland-client minimum is 1.18, which supports version 3.
100
+ #define SDL_WL_DATA_DEVICE_VERSION 3
101
+
102
+ #if SDL_WAYLAND_CHECK_VERSION (1 , 24 , 0 )
103
+ #define SDL_WL_FIXES_VERSION 1
104
+ #endif
105
+
99
106
#ifdef SDL_USE_LIBDBUS
100
107
#include "../../core/linux/SDL_dbus.h"
101
108
@@ -457,6 +464,7 @@ static void Wayland_DeleteDevice(SDL_VideoDevice *device)
457
464
typedef struct
458
465
{
459
466
bool has_fifo_v1 ;
467
+ struct wl_fixes * wl_fixes ;
460
468
} SDL_WaylandPreferredData ;
461
469
462
470
static void wayland_preferred_check_handle_global (void * data , struct wl_registry * registry , uint32_t id ,
@@ -466,6 +474,10 @@ static void wayland_preferred_check_handle_global(void *data, struct wl_registry
466
474
467
475
if (SDL_strcmp (interface , "wp_fifo_manager_v1" ) == 0 ) {
468
476
d -> has_fifo_v1 = true;
477
+ #ifdef SDL_WL_FIXES_VERSION
478
+ } else if (SDL_strcmp (interface , "wl_fixes" ) == 0 ) {
479
+ d -> wl_fixes = wl_registry_bind (registry , id , & wl_fixes_interface , SDL_min (SDL_WL_FIXES_VERSION , version ));
480
+ #endif
469
481
}
470
482
}
471
483
@@ -493,6 +505,12 @@ static bool Wayland_IsPreferred(struct wl_display *display)
493
505
494
506
WAYLAND_wl_display_roundtrip (display );
495
507
508
+ #ifdef WL_FIXES_INTERFACE
509
+ if (preferred_data .wl_fixes ) {
510
+ wl_fixes_destroy_registry (preferred_data .wl_fixes , registry );
511
+ wl_fixes_destroy (preferred_data .wl_fixes );
512
+ }
513
+ #endif
496
514
wl_registry_destroy (registry );
497
515
498
516
if (!preferred_data .has_fifo_v1 ) {
@@ -1313,6 +1331,10 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
1313
1331
} else if (SDL_strcmp (interface , "wp_color_manager_v1" ) == 0 ) {
1314
1332
d -> wp_color_manager_v1 = wl_registry_bind (d -> registry , id , & wp_color_manager_v1_interface , 1 );
1315
1333
Wayland_InitColorManager (d );
1334
+ #ifdef SDL_WL_FIXES_VERSION
1335
+ } else if (SDL_strcmp (interface , "wl_fixes" ) == 0 ) {
1336
+ d -> wl_fixes = wl_registry_bind (d -> registry , id , & wl_fixes_interface , SDL_min (SDL_WL_FIXES_VERSION , version ));
1337
+ #endif
1316
1338
}
1317
1339
}
1318
1340
@@ -1628,6 +1650,13 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
1628
1650
}
1629
1651
1630
1652
if (data -> registry ) {
1653
+ #ifdef SDL_WL_FIXES_VERSION
1654
+ if (data -> wl_fixes ) {
1655
+ wl_fixes_destroy_registry (data -> wl_fixes , data -> registry );
1656
+ wl_fixes_destroy (data -> wl_fixes );
1657
+ data -> wl_fixes = NULL ;
1658
+ }
1659
+ #endif
1631
1660
wl_registry_destroy (data -> registry );
1632
1661
data -> registry = NULL ;
1633
1662
}
0 commit comments