From 125154e831bd4026012bed5a62f7f42ea47b3643 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Wed, 20 Jan 2021 15:48:31 -0500 Subject: [PATCH] Get the SDL2 video driver to work in Wayland/KMS --- gfx/drivers/sdl2_gfx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 259366cc94..6045b1e6be 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -440,10 +440,16 @@ static void *sdl2_gfx_init(const video_info_t *video, #if defined(_WIN32) sdl2_set_handles(vid->window, RARCH_DISPLAY_WIN32); -#elif defined(HAVE_X11) - sdl2_set_handles(vid->window, RARCH_DISPLAY_X11); #elif defined(HAVE_COCOA) sdl2_set_handles(vid->window, RARCH_DISPLAY_OSX); +#else + const char *video_driver = SDL_GetCurrentVideoDriver(); + if (strcmp(video_driver, "x11") == 0) + sdl2_set_handles(vid->window, RARCH_DISPLAY_X11); + else if (strcmp(video_driver, "wayland") == 0) + sdl2_set_handles(vid->window, RARCH_DISPLAY_WAYLAND); + else + sdl2_set_handles(vid->window, RARCH_DISPLAY_NONE); #endif sdl_refresh_viewport(vid);