From e54a862dd504982581ccb4d3e771c28cfa51acf7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 01 2022 10:35:19 +0000 Subject: import SDL2-2.0.20-2.el9 --- diff --git a/.SDL2.metadata b/.SDL2.metadata index 22b9170..6533252 100644 --- a/.SDL2.metadata +++ b/.SDL2.metadata @@ -1 +1 @@ -419c62567d197a52a2136865c158f894939c1adf SOURCES/SDL2-2.0.18.tar.gz +18ce006cbf07502f48abfedc088c14404091f3d3 SOURCES/SDL2-2.0.20.tar.gz diff --git a/.gitignore b/.gitignore index 8f66c37..727ad8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/SDL2-2.0.18.tar.gz +SOURCES/SDL2-2.0.20.tar.gz diff --git a/SOURCES/0001-video-Prefer-Wayland-over-X11.patch b/SOURCES/0001-video-Prefer-Wayland-over-X11.patch new file mode 100644 index 0000000..2f9f8c7 --- /dev/null +++ b/SOURCES/0001-video-Prefer-Wayland-over-X11.patch @@ -0,0 +1,72 @@ +From 8ceba27d6291f1195e13608033ec439aec621fc6 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Sat, 17 Apr 2021 12:07:38 -0400 +Subject: [PATCH] video: Prefer Wayland over X11 + +--- + src/video/SDL_video.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c +index dac8d1cc9..d3fe65502 100644 +--- a/src/video/SDL_video.c ++++ b/src/video/SDL_video.c +@@ -61,12 +61,12 @@ static VideoBootStrap *bootstrap[] = { + #if SDL_VIDEO_DRIVER_COCOA + &COCOA_bootstrap, + #endif +-#if SDL_VIDEO_DRIVER_X11 +- &X11_bootstrap, +-#endif + #if SDL_VIDEO_DRIVER_WAYLAND + &Wayland_bootstrap, + #endif ++#if SDL_VIDEO_DRIVER_X11 ++ &X11_bootstrap, ++#endif + #if SDL_VIDEO_DRIVER_VIVANTE + &VIVANTE_bootstrap, + #endif +@@ -4249,12 +4249,12 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) + #if SDL_VIDEO_DRIVER_UIKIT + #include "uikit/SDL_uikitmessagebox.h" + #endif +-#if SDL_VIDEO_DRIVER_X11 +-#include "x11/SDL_x11messagebox.h" +-#endif + #if SDL_VIDEO_DRIVER_WAYLAND + #include "wayland/SDL_waylandmessagebox.h" + #endif ++#if SDL_VIDEO_DRIVER_X11 ++#include "x11/SDL_x11messagebox.h" ++#endif + #if SDL_VIDEO_DRIVER_HAIKU + #include "haiku/SDL_bmessagebox.h" + #endif +@@ -4362,17 +4362,17 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) + retval = 0; + } + #endif +-#if SDL_VIDEO_DRIVER_X11 ++#if SDL_VIDEO_DRIVER_WAYLAND + if (retval == -1 && +- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) && +- X11_ShowMessageBox(messageboxdata, buttonid) == 0) { ++ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) && ++ Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) { + retval = 0; + } + #endif +-#if SDL_VIDEO_DRIVER_WAYLAND ++#if SDL_VIDEO_DRIVER_X11 + if (retval == -1 && +- SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) && +- Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) { ++ SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) && ++ X11_ShowMessageBox(messageboxdata, buttonid) == 0) { + retval = 0; + } + #endif +-- +2.34.1 + diff --git a/SOURCES/0001-wayland-Convert-URI-to-local-path-for-DropFile.patch b/SOURCES/0001-wayland-Convert-URI-to-local-path-for-DropFile.patch new file mode 100644 index 0000000..e0d8401 --- /dev/null +++ b/SOURCES/0001-wayland-Convert-URI-to-local-path-for-DropFile.patch @@ -0,0 +1,182 @@ +From 9a2bbd8acbebcde56dd2f89ebca3b196c2b38914 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Wed, 12 Jan 2022 13:01:05 -0500 +Subject: [PATCH 01/11] wayland: Convert URI to local path for DropFile + +--- + src/video/wayland/SDL_waylandevents.c | 149 ++++++++++++++++++++++---- + 1 file changed, 129 insertions(+), 20 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c +index dfa62ec69..bf2aeea5b 100644 +--- a/src/video/wayland/SDL_waylandevents.c ++++ b/src/video/wayland/SDL_waylandevents.c +@@ -1312,36 +1312,145 @@ data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, + { + } + ++/* Decodes URI escape sequences in string buf of len bytes ++ (excluding the terminating NULL byte) in-place. Since ++ URI-encoded characters take three times the space of ++ normal characters, this should not be an issue. ++ ++ Returns the number of decoded bytes that wound up in ++ the buffer, excluding the terminating NULL byte. ++ ++ The buffer is guaranteed to be NULL-terminated but ++ may contain embedded NULL bytes. ++ ++ On error, -1 is returned. ++ ++ FIXME: This was shamelessly copied from SDL_x11events.c ++ */ ++static int Wayland_URIDecode(char *buf, int len) { ++ int ri, wi, di; ++ char decode = '\0'; ++ if (buf == NULL || len < 0) { ++ errno = EINVAL; ++ return -1; ++ } ++ if (len == 0) { ++ len = SDL_strlen(buf); ++ } ++ for (ri = 0, wi = 0, di = 0; ri < len && wi < len; ri += 1) { ++ if (di == 0) { ++ /* start decoding */ ++ if (buf[ri] == '%') { ++ decode = '\0'; ++ di += 1; ++ continue; ++ } ++ /* normal write */ ++ buf[wi] = buf[ri]; ++ wi += 1; ++ continue; ++ } else if (di == 1 || di == 2) { ++ char off = '\0'; ++ char isa = buf[ri] >= 'a' && buf[ri] <= 'f'; ++ char isA = buf[ri] >= 'A' && buf[ri] <= 'F'; ++ char isn = buf[ri] >= '0' && buf[ri] <= '9'; ++ if (!(isa || isA || isn)) { ++ /* not a hexadecimal */ ++ int sri; ++ for (sri = ri - di; sri <= ri; sri += 1) { ++ buf[wi] = buf[sri]; ++ wi += 1; ++ } ++ di = 0; ++ continue; ++ } ++ /* itsy bitsy magicsy */ ++ if (isn) { ++ off = 0 - '0'; ++ } else if (isa) { ++ off = 10 - 'a'; ++ } else if (isA) { ++ off = 10 - 'A'; ++ } ++ decode |= (buf[ri] + off) << (2 - di) * 4; ++ if (di == 2) { ++ buf[wi] = decode; ++ wi += 1; ++ di = 0; ++ } else { ++ di += 1; ++ } ++ continue; ++ } ++ } ++ buf[wi] = '\0'; ++ return wi; ++} ++ ++/* Convert URI to local filename ++ return filename if possible, else NULL ++ ++ FIXME: This was shamelessly copied from SDL_x11events.c ++*/ ++static char* Wayland_URIToLocal(char* uri) { ++ char *file = NULL; ++ SDL_bool local; ++ ++ if (SDL_memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */ ++ else if (SDL_strstr(uri,":/") != NULL) return file; /* wrong scheme */ ++ ++ local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/'); ++ ++ /* got a hostname? */ ++ if (!local && uri[0] == '/' && uri[2] != '/') { ++ char* hostname_end = SDL_strchr(uri+1, '/'); ++ if (hostname_end != NULL) { ++ char hostname[ 257 ]; ++ if (gethostname(hostname, 255) == 0) { ++ hostname[ 256 ] = '\0'; ++ if (SDL_memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) { ++ uri = hostname_end + 1; ++ local = SDL_TRUE; ++ } ++ } ++ } ++ } ++ if (local) { ++ file = uri; ++ /* Convert URI escape sequences to real characters */ ++ Wayland_URIDecode(file, 0); ++ if (uri[1] == '/') { ++ file++; ++ } else { ++ file--; ++ } ++ } ++ return file; ++} ++ + static void + data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) + { + SDL_WaylandDataDevice *data_device = data; +- void *buffer = NULL; +- size_t length = 0; +- +- const char *current_uri = NULL; +- const char *last_char = NULL; +- char *current_char = NULL; + + if (data_device->drag_offer != NULL) { + /* TODO: SDL Support more mime types */ +- buffer = Wayland_data_offer_receive(data_device->drag_offer, +- &length, FILE_MIME, SDL_FALSE); +- +- /* uri-list */ +- current_uri = (const char *)buffer; +- last_char = (const char *)buffer + length; +- for (current_char = buffer; current_char < last_char; ++current_char) { +- if (*current_char == '\n' || *current_char == 0) { +- if (*current_uri != 0 && *current_uri != '#') { +- *current_char = 0; +- SDL_SendDropFile(NULL, current_uri); ++ size_t length; ++ void *buffer = Wayland_data_offer_receive(data_device->drag_offer, ++ &length, FILE_MIME, SDL_FALSE); ++ if (buffer) { ++ char *saveptr = NULL; ++ char *token = SDL_strtokr((char *) buffer, "\r\n", &saveptr); ++ while (token != NULL) { ++ char *fn = Wayland_URIToLocal(token); ++ if (fn) { ++ SDL_SendDropFile(NULL, fn); /* FIXME: Window? */ + } +- current_uri = (const char *)current_char + 1; ++ token = SDL_strtokr(NULL, "\r\n", &saveptr); + } ++ SDL_SendDropComplete(NULL); /* FIXME: Window? */ ++ SDL_free(buffer); + } +- +- SDL_free(buffer); + } + } + +-- +2.34.1 + diff --git a/SOURCES/0002-wayland-Avoid-spurious-resize-events.patch b/SOURCES/0002-wayland-Avoid-spurious-resize-events.patch new file mode 100644 index 0000000..30bbd6d --- /dev/null +++ b/SOURCES/0002-wayland-Avoid-spurious-resize-events.patch @@ -0,0 +1,133 @@ +From d3952a8a2c8a32d4f6f521402427052a4b756f9f Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Sun, 16 Jan 2022 15:14:33 -0600 +Subject: [PATCH 02/11] wayland: Avoid spurious resize events + +--- + src/video/wayland/SDL_waylandwindow.c | 42 +++++++++++++++++---------- + src/video/wayland/SDL_waylandwindow.h | 1 + + 2 files changed, 28 insertions(+), 15 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index 3eae22bf7..a4b5933eb 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -224,14 +224,16 @@ handle_configure_xdg_toplevel(void *data, + * us a completely stateless, sizeless configure, with which we have + * to enforce our own state anyway. + */ +- if (width != 0 && height != 0) { ++ if (width != 0 && height != 0 && (window->w != width || window->h != height)) { + window->w = width; + window->h = height; ++ wind->needs_resize_event = SDL_TRUE; + } + + /* This part is good though. */ +- if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { ++ if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && wind->scale_factor != driverdata->scale_factor) { + wind->scale_factor = driverdata->scale_factor; ++ wind->needs_resize_event = SDL_TRUE; + } + + return; +@@ -284,8 +286,11 @@ handle_configure_xdg_toplevel(void *data, + } + + /* Store this now so the xdg_surface configure knows what to resize to */ +- window->w = width; +- window->h = height; ++ if (window->w != width || window->h != height) { ++ window->w = width; ++ window->h = height; ++ wind->needs_resize_event = SDL_TRUE; ++ } + } else { + /* For fullscreen, foolishly do what the compositor says. If it's wrong, + * don't blame us, we were explicitly instructed to do this. +@@ -293,14 +298,16 @@ handle_configure_xdg_toplevel(void *data, + * UPDATE: Nope, sure enough a compositor sends 0,0. This is a known bug: + * https://bugs.kde.org/show_bug.cgi?id=444962 + */ +- if (width != 0 && height != 0) { ++ if (width != 0 && height != 0 && (window->w != width || window->h != height)) { + window->w = width; + window->h = height; ++ wind->needs_resize_event = SDL_TRUE; + } + + /* This part is good though. */ +- if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { ++ if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && wind->scale_factor != driverdata->scale_factor) { + wind->scale_factor = driverdata->scale_factor; ++ wind->needs_resize_event = SDL_TRUE; + } + } + } +@@ -330,6 +337,7 @@ decoration_frame_configure(struct libdecor_frame *frame, + + enum libdecor_window_state window_state; + int width, height; ++ float scale_factor = wind->scale_factor; + + SDL_bool focused = SDL_FALSE; + SDL_bool fullscreen = SDL_FALSE; +@@ -399,7 +407,7 @@ decoration_frame_configure(struct libdecor_frame *frame, + + /* This part is good though. */ + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { +- wind->scale_factor = driverdata->scale_factor; ++ scale_factor = driverdata->scale_factor; + } + } else if (!(window->flags & SDL_WINDOW_RESIZABLE)) { + width = window->windowed.w; +@@ -427,7 +435,7 @@ decoration_frame_configure(struct libdecor_frame *frame, + } + + /* Do the resize on the SDL side (this will set window->w/h)... */ +- Wayland_HandleResize(window, width, height, wind->scale_factor); ++ Wayland_HandleResize(window, width, height, scale_factor); + wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE; + + /* ... then commit the changes on the libdecor side. */ +@@ -1341,14 +1349,18 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) + { + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoData *viddata = data->waylandData; +- + struct wl_region *region; +- window->w = 0; +- window->h = 0; +- SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); +- window->w = width; +- window->h = height; +- data->scale_factor = scale; ++ ++ if (data->needs_resize_event || window->w != width || window->h != height || data->scale_factor != scale) { ++ /* We may have already updated window w/h (or only adjusted scale factor), ++ * so we must override the deduplication logic in the video core */ ++ window->w = 0; ++ window->h = 0; ++ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); ++ window->w = width; ++ window->h = height; ++ data->needs_resize_event = SDL_FALSE; ++ } + + wl_surface_set_buffer_scale(data->surface, data->scale_factor); + +diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h +index 8ca090f0c..bce1d1855 100644 +--- a/src/video/wayland/SDL_waylandwindow.h ++++ b/src/video/wayland/SDL_waylandwindow.h +@@ -84,6 +84,7 @@ typedef struct { + int num_outputs; + + float scale_factor; ++ SDL_bool needs_resize_event; + } SDL_WindowData; + + extern void Wayland_ShowWindow(_THIS, SDL_Window *window); +-- +2.34.1 + diff --git a/SOURCES/0003-wayland-Fix-building-with-SDL_OPENGL-OFF.patch b/SOURCES/0003-wayland-Fix-building-with-SDL_OPENGL-OFF.patch new file mode 100644 index 0000000..487ab2d --- /dev/null +++ b/SOURCES/0003-wayland-Fix-building-with-SDL_OPENGL-OFF.patch @@ -0,0 +1,96 @@ +From ed3442d7a5a79b3a7357c5bdf54b47ab985ca7f7 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Wed, 19 Jan 2022 15:47:52 -0500 +Subject: [PATCH 03/11] wayland: Fix building with SDL_OPENGL=OFF + +--- + src/video/wayland/SDL_waylandvideo.c | 2 ++ + src/video/wayland/SDL_waylandwindow.c | 8 ++++++-- + src/video/wayland/SDL_waylandwindow.h | 2 ++ + 3 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c +index f009fb7c6..60d7403c7 100644 +--- a/src/video/wayland/SDL_waylandvideo.c ++++ b/src/video/wayland/SDL_waylandvideo.c +@@ -230,6 +230,7 @@ Wayland_CreateDevice(int devindex) + device->WaitEventTimeout = Wayland_WaitEventTimeout; + device->SendWakeupEvent = Wayland_SendWakeupEvent; + ++#if SDL_VIDEO_OPENGL_EGL + device->GL_SwapWindow = Wayland_GLES_SwapWindow; + device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; + device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; +@@ -240,6 +241,7 @@ Wayland_CreateDevice(int devindex) + device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary; + device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; + device->GL_DeleteContext = Wayland_GLES_DeleteContext; ++#endif + + device->CreateSDLWindow = Wayland_CreateWindow; + device->ShowWindow = Wayland_ShowWindow; +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index a4b5933eb..80bb66878 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -21,7 +21,7 @@ + + #include "../../SDL_internal.h" + +-#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL ++#if SDL_VIDEO_DRIVER_WAYLAND + + #include "../SDL_sysvideo.h" + #include "../../events/SDL_windowevents_c.h" +@@ -1309,12 +1309,14 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) + data->egl_window = WAYLAND_wl_egl_window_create(data->surface, + window->w * data->scale_factor, window->h * data->scale_factor); + ++#if SDL_VIDEO_OPENGL_EGL + /* Create the GLES window surface */ + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); + + if (data->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("failed to create an EGL window surface"); + } ++#endif + } + + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +@@ -1517,9 +1519,11 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) + SDL_WindowData *wind = window->driverdata; + + if (data) { ++#if SDL_VIDEO_OPENGL_EGL + if (wind->egl_surface) { + SDL_EGL_DestroySurface(_this, wind->egl_surface); + } ++#endif + if (wind->egl_window) { + WAYLAND_wl_egl_window_destroy(wind->egl_window); + } +@@ -1555,6 +1559,6 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) + window->driverdata = NULL; + } + +-#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */ ++#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + + /* vi: set ts=4 sw=4 expandtab: */ +diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h +index bce1d1855..e8d7d6299 100644 +--- a/src/video/wayland/SDL_waylandwindow.h ++++ b/src/video/wayland/SDL_waylandwindow.h +@@ -63,7 +63,9 @@ typedef struct { + } shell_surface; + struct wl_egl_window *egl_window; + struct SDL_WaylandInput *keyboard_device; ++#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; ++#endif + struct zwp_locked_pointer_v1 *locked_pointer; + struct zwp_confined_pointer_v1 *confined_pointer; + struct zxdg_toplevel_decoration_v1 *server_decoration; +-- +2.34.1 + diff --git a/SOURCES/0004-wayland-Avoid-calling-SetFullscreen-in-libdecor-Show.patch b/SOURCES/0004-wayland-Avoid-calling-SetFullscreen-in-libdecor-Show.patch new file mode 100644 index 0000000..42553cc --- /dev/null +++ b/SOURCES/0004-wayland-Avoid-calling-SetFullscreen-in-libdecor-Show.patch @@ -0,0 +1,54 @@ +From e1b4761c621e9883c3f02971ea74cef14b1d6b87 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Thu, 20 Jan 2022 14:10:56 -0500 +Subject: [PATCH 04/11] wayland: Avoid calling SetFullscreen in libdecor + ShowWindow. + +This caused some weird stuff to happen in the libdecor path, probably because +the window hasn't actually been mapped yet. It ends up calling stuff that +should not yet apply, and so fullscreen in particular would have a really +messed up titlebar. + +The good news is, libdecor is good about tracking fullscreen state, so we can +let the callback do this for us. Keep this for xdg_shell because we actually +map the window ourselves, so we know this call is valid for that path. +--- + src/video/wayland/SDL_waylandwindow.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index 80bb66878..3b21af7be 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -724,7 +724,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + { + SDL_VideoData *c = _this->driverdata; + SDL_WindowData *data = window->driverdata; +- SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + + /* Detach any previous buffers before resetting everything, otherwise when + * calling this a second time you'll get an annoying protocol error +@@ -766,7 +765,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + if (window->flags & SDL_WINDOW_MINIMIZED) { + Wayland_MinimizeWindow(_this, window); + } +- Wayland_SetWindowFullscreen(_this, window, display, (window->flags & SDL_WINDOW_FULLSCREEN) != 0); + + /* We have to wait until the surface gets a "configure" event, or use of + * this surface will fail. This is a new rule for xdg_shell. +@@ -782,6 +780,12 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + } else + #endif + if (c->shell.xdg) { ++ /* Unlike libdecor we need to call this explicitly to prevent a deadlock. ++ * libdecor will call this as part of their configure event! ++ * -flibit ++ */ ++ Wayland_SetWindowFullscreen(_this, window, SDL_GetDisplayForWindow(window), ++ (window->flags & SDL_WINDOW_FULLSCREEN) != 0); + if (data->shell_surface.xdg.surface) { + while (!data->shell_surface.xdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); +-- +2.34.1 + diff --git a/SOURCES/0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch b/SOURCES/0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch new file mode 100644 index 0000000..f014dcb --- /dev/null +++ b/SOURCES/0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch @@ -0,0 +1,41 @@ +From e2d74bcbe524960c17c852466130a6e0a30674a3 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Tue, 25 Jan 2022 11:16:09 -0500 +Subject: [PATCH 05/11] wayland: Detach hidden surfaces in HideWindow, not + ShowWindow + +--- + src/video/wayland/SDL_waylandwindow.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index 3b21af7be..2bf500a91 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -725,12 +725,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + SDL_VideoData *c = _this->driverdata; + SDL_WindowData *data = window->driverdata; + +- /* Detach any previous buffers before resetting everything, otherwise when +- * calling this a second time you'll get an annoying protocol error +- */ +- wl_surface_attach(data->surface, NULL, 0, 0); +- wl_surface_commit(data->surface); +- + /* Create the shell surface and map the toplevel */ + #ifdef HAVE_LIBDECOR_H + if (c->shell.libdecor) { +@@ -862,6 +856,10 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) + wind->shell_surface.xdg.surface = NULL; + } + } ++ ++ /* Be sure to detach after this is done, otherwise ShowWindow crashes! */ ++ wl_surface_attach(wind->surface, NULL, 0, 0); ++ wl_surface_commit(wind->surface); + } + + static void +-- +2.34.1 + diff --git a/SOURCES/0006-wayland-Call-SetFullscreen-directly-in-ShowWindow.patch b/SOURCES/0006-wayland-Call-SetFullscreen-directly-in-ShowWindow.patch new file mode 100644 index 0000000..60aacab --- /dev/null +++ b/SOURCES/0006-wayland-Call-SetFullscreen-directly-in-ShowWindow.patch @@ -0,0 +1,28 @@ +From f0e768da43173cf62732fc20d1f80eb777d6d5c8 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Tue, 25 Jan 2022 13:07:00 -0500 +Subject: [PATCH 06/11] wayland: Call SetFullscreen directly in ShowWindow. + +This cuts out an extra flush when getting the first configure event. +--- + src/video/wayland/SDL_waylandwindow.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index 2bf500a91..d4b89de7a 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -778,8 +778,8 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + * libdecor will call this as part of their configure event! + * -flibit + */ +- Wayland_SetWindowFullscreen(_this, window, SDL_GetDisplayForWindow(window), +- (window->flags & SDL_WINDOW_FULLSCREEN) != 0); ++ SDL_WaylandOutputData *odata = SDL_GetDisplayForWindow(window)->driverdata; ++ SetFullscreen(window, (window->flags & SDL_WINDOW_FULLSCREEN) ? odata->output : NULL); + if (data->shell_surface.xdg.surface) { + while (!data->shell_surface.xdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); +-- +2.34.1 + diff --git a/SOURCES/0007-wayland-Try-to-avoid-committing-before-the-window-is.patch b/SOURCES/0007-wayland-Try-to-avoid-committing-before-the-window-is.patch new file mode 100644 index 0000000..4715f0c --- /dev/null +++ b/SOURCES/0007-wayland-Try-to-avoid-committing-before-the-window-is.patch @@ -0,0 +1,142 @@ +From 68a71f91c6cbb1458dc95e2d994d4522afd92c5e Mon Sep 17 00:00:00 2001 +From: Ethan Lee +Date: Tue, 25 Jan 2022 11:18:04 -0500 +Subject: [PATCH 07/11] wayland: Try to avoid committing before the window is + shown + +--- + src/video/wayland/SDL_waylandwindow.c | 32 +++++++++++++++++---------- + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index d4b89de7a..4c3c60aac 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -42,7 +42,7 @@ + #endif + + static void +-CommitMinMaxDimensions(SDL_Window *window) ++SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) + { + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = wind->waylandData; +@@ -88,12 +88,14 @@ CommitMinMaxDimensions(SDL_Window *window) + xdg_toplevel_set_max_size(wind->shell_surface.xdg.roleobj.toplevel, + max_width, + max_height); +- wl_surface_commit(wind->surface); ++ if (commit) { ++ wl_surface_commit(wind->surface); ++ } + } + } + + static void +-SetFullscreen(SDL_Window *window, struct wl_output *output) ++SetFullscreen(SDL_Window *window, struct wl_output *output, SDL_bool commit) + { + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = wind->waylandData; +@@ -101,7 +103,7 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) + /* The desktop may try to enforce min/max sizes here, so turn them off for + * fullscreen and on (if applicable) for windowed + */ +- CommitMinMaxDimensions(window); ++ SetMinMaxDimensions(window, SDL_FALSE); + + #ifdef HAVE_LIBDECOR_H + if (viddata->shell.libdecor) { +@@ -134,6 +136,9 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) + } else { + xdg_toplevel_unset_fullscreen(wind->shell_surface.xdg.roleobj.toplevel); + } ++ if (commit) { ++ wl_surface_commit(wind->surface); ++ } + } + } + +@@ -215,7 +220,7 @@ handle_configure_xdg_toplevel(void *data, + if (!fullscreen) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { + /* We might need to re-enter fullscreen after being restored from minimized */ +- SetFullscreen(window, driverdata->output); ++ SetFullscreen(window, driverdata->output, SDL_FALSE); + + /* Foolishly do what the compositor says here. If it's wrong, don't + * blame us, we were explicitly instructed to do this. +@@ -364,7 +369,7 @@ decoration_frame_configure(struct libdecor_frame *frame, + if (!fullscreen) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { + /* We might need to re-enter fullscreen after being restored from minimized */ +- SetFullscreen(window, driverdata->output); ++ SetFullscreen(window, driverdata->output, SDL_FALSE); + fullscreen = SDL_TRUE; + floating = SDL_FALSE; + } +@@ -779,7 +784,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + * -flibit + */ + SDL_WaylandOutputData *odata = SDL_GetDisplayForWindow(window)->driverdata; +- SetFullscreen(window, (window->flags & SDL_WINDOW_FULLSCREEN) ? odata->output : NULL); ++ SetFullscreen(window, (window->flags & SDL_WINDOW_FULLSCREEN) ? odata->output : NULL, SDL_TRUE); + if (data->shell_surface.xdg.surface) { + while (!data->shell_surface.xdg.initial_configure_seen) { + WAYLAND_wl_display_flush(c->display); +@@ -791,6 +796,9 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) + if (data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { + data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.roleobj.toplevel); + } ++ } else { ++ /* Nothing to see here, just commit. */ ++ wl_surface_commit(data->surface); + } + + /* Unlike the rest of window state we have to set this _after_ flushing the +@@ -1053,7 +1061,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, + { + struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; +- SetFullscreen(window, fullscreen ? output : NULL); ++ SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE); + + WAYLAND_wl_display_flush(viddata->display); + } +@@ -1125,7 +1133,7 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) + } else + #endif + { +- CommitMinMaxDimensions(window); ++ SetMinMaxDimensions(window, SDL_TRUE); + } + } + +@@ -1338,7 +1346,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) + Wayland_input_lock_pointer(c->input); + } + +- wl_surface_commit(data->surface); ++ /* Moved this call to ShowWindow: wl_surface_commit(data->surface); */ + WAYLAND_wl_display_flush(c->display); + + /* We may need to create an idle inhibitor for this new window */ +@@ -1393,13 +1401,13 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) + void + Wayland_SetWindowMinimumSize(_THIS, SDL_Window * window) + { +- CommitMinMaxDimensions(window); ++ SetMinMaxDimensions(window, SDL_TRUE); + } + + void + Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window) + { +- CommitMinMaxDimensions(window); ++ SetMinMaxDimensions(window, SDL_TRUE); + } + + void Wayland_SetWindowSize(_THIS, SDL_Window * window) +-- +2.34.1 + diff --git a/SOURCES/0008-wayland-Fix-SDL_SetWindowSize-being-dropped-right-af.patch b/SOURCES/0008-wayland-Fix-SDL_SetWindowSize-being-dropped-right-af.patch new file mode 100644 index 0000000..0720db1 --- /dev/null +++ b/SOURCES/0008-wayland-Fix-SDL_SetWindowSize-being-dropped-right-af.patch @@ -0,0 +1,57 @@ +From 77a9ca6ba0ae1973d7bc255a4d785e7f1ba3d111 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Wed, 26 Jan 2022 18:26:07 -0600 +Subject: [PATCH 08/11] wayland: Fix SDL_SetWindowSize() being dropped right + after exiting fullscreen + +If we get a SDL_SetWindowSize() call right after SDL_SetWindowFullscreen() but +before we've gotten a new configure event from the compositor, the attempt to +set our window size will silently fail (when libdecor is enabled). + +Fix this by remembering that we need to commit a new size, so we can do that +in decoration_frame_configure(). +--- + src/video/wayland/SDL_waylandwindow.c | 5 ++++- + src/video/wayland/SDL_waylandwindow.h | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c +index 4c3c60aac..635546af4 100644 +--- a/src/video/wayland/SDL_waylandwindow.c ++++ b/src/video/wayland/SDL_waylandwindow.c +@@ -414,9 +414,10 @@ decoration_frame_configure(struct libdecor_frame *frame, + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + scale_factor = driverdata->scale_factor; + } +- } else if (!(window->flags & SDL_WINDOW_RESIZABLE)) { ++ } else if (!(window->flags & SDL_WINDOW_RESIZABLE) || (floating && wind->floating_resize_pending)) { + width = window->windowed.w; + height = window->windowed.h; ++ wind->floating_resize_pending = SDL_FALSE; + } else { + /* This will never set 0 for width/height unless the function returns false */ + if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) { +@@ -1424,6 +1425,8 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) + if (data->shell.libdecor && + wind->shell_surface.libdecor.frame && + !libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) { ++ /* Commit the resize when we re-enter floating state */ ++ wind->floating_resize_pending = SDL_TRUE; + return; + } + #endif +diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h +index e8d7d6299..90e4d8cf6 100644 +--- a/src/video/wayland/SDL_waylandwindow.h ++++ b/src/video/wayland/SDL_waylandwindow.h +@@ -87,6 +87,7 @@ typedef struct { + + float scale_factor; + SDL_bool needs_resize_event; ++ SDL_bool floating_resize_pending; + } SDL_WindowData; + + extern void Wayland_ShowWindow(_THIS, SDL_Window *window); +-- +2.34.1 + diff --git a/SOURCES/0009-wayland-Round-the-refresh-rate-rather-than-truncatin.patch b/SOURCES/0009-wayland-Round-the-refresh-rate-rather-than-truncatin.patch new file mode 100644 index 0000000..c776e3b --- /dev/null +++ b/SOURCES/0009-wayland-Round-the-refresh-rate-rather-than-truncatin.patch @@ -0,0 +1,36 @@ +From cc40f732f9482eb45a1938a23d4f34265e78a729 Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Wed, 26 Jan 2022 21:09:39 -0600 +Subject: [PATCH 09/11] wayland: Round the refresh rate rather than truncating + it + +A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz. +--- + src/video/wayland/SDL_waylandvideo.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c +index 60d7403c7..61940cca4 100644 +--- a/src/video/wayland/SDL_waylandvideo.c ++++ b/src/video/wayland/SDL_waylandvideo.c +@@ -393,7 +393,7 @@ display_handle_mode(void *data, + mode.w = width; + mode.h = height; + } +- mode.refresh_rate = refresh / 1000; /* mHz to Hz */ ++ mode.refresh_rate = (int)SDL_round(refresh / 1000.0); /* mHz to Hz */ + mode.driverdata = driverdata->output; + if (driverdata->index > -1) { + SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &mode); +@@ -446,7 +446,7 @@ display_handle_done(void *data, + ((float) driverdata->physical_width) / 25.4f, + ((float) driverdata->physical_height) / 25.4f); + } +- mode.refresh_rate = driverdata->refresh / 1000; /* mHz to Hz */ ++ mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ + mode.driverdata = driverdata->output; + + if (driverdata->index > -1) { +-- +2.34.1 + diff --git a/SOURCES/0010-Fix-text_input_v3-preedit-string.patch b/SOURCES/0010-Fix-text_input_v3-preedit-string.patch new file mode 100644 index 0000000..c5e7cdc --- /dev/null +++ b/SOURCES/0010-Fix-text_input_v3-preedit-string.patch @@ -0,0 +1,54 @@ +From a90a2e7582a73f7b69b14437287aa15945bf5989 Mon Sep 17 00:00:00 2001 +From: Weng Xuetian +Date: Sun, 30 Jan 2022 16:44:44 -0800 +Subject: [PATCH 10/11] Fix text_input_v3 preedit string + +For every batch of text_input_v3 updates, if there is no preedit in this +batch, preedit should be cleared. +--- + src/video/wayland/SDL_waylandevents.c | 8 +++++++- + src/video/wayland/SDL_waylandkeyboard.h | 1 + + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c +index bf2aeea5b..85d4edfc8 100644 +--- a/src/video/wayland/SDL_waylandevents.c ++++ b/src/video/wayland/SDL_waylandevents.c +@@ -1505,7 +1505,9 @@ text_input_preedit_string(void *data, + int32_t cursor_begin, + int32_t cursor_end) + { ++ SDL_WaylandTextInput *text_input = data; + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; ++ text_input->has_preedit = SDL_TRUE; + if (text) { + size_t text_bytes = SDL_strlen(text), i = 0; + size_t cursor = 0; +@@ -1557,7 +1559,11 @@ text_input_done(void *data, + struct zwp_text_input_v3 *zwp_text_input_v3, + uint32_t serial) + { +- /* No-op */ ++ SDL_WaylandTextInput *text_input = data; ++ if (!text_input->has_preedit) { ++ SDL_SendEditingText("", 0, 0); ++ } ++ text_input->has_preedit = SDL_FALSE; + } + + static const struct zwp_text_input_v3_listener text_input_listener = { +diff --git a/src/video/wayland/SDL_waylandkeyboard.h b/src/video/wayland/SDL_waylandkeyboard.h +index dd8c146e6..604e0f37f 100644 +--- a/src/video/wayland/SDL_waylandkeyboard.h ++++ b/src/video/wayland/SDL_waylandkeyboard.h +@@ -27,6 +27,7 @@ typedef struct SDL_WaylandTextInput + { + struct zwp_text_input_v3 *text_input; + SDL_Rect cursor_rect; ++ SDL_bool has_preedit; + } SDL_WaylandTextInput; + + extern int Wayland_InitKeyboard(_THIS); +-- +2.34.1 + diff --git a/SOURCES/0011-Only-generate-key-repetition-for-keys-that-should-re.patch b/SOURCES/0011-Only-generate-key-repetition-for-keys-that-should-re.patch new file mode 100644 index 0000000..1da0dcb --- /dev/null +++ b/SOURCES/0011-Only-generate-key-repetition-for-keys-that-should-re.patch @@ -0,0 +1,42 @@ +From b11dfd761181ab5005fe3f5527faa4faf6b56112 Mon Sep 17 00:00:00 2001 +From: Weng Xuetian +Date: Tue, 1 Feb 2022 14:43:26 -0800 +Subject: [PATCH 11/11] Only generate key repetition for keys that should + repeat on wayland. + +This fix repetition on modifier keys, e.g. Control. +--- + src/video/wayland/SDL_waylandevents.c | 4 +++- + src/video/wayland/SDL_waylandsym.h | 1 + + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c +index 85d4edfc8..55893201b 100644 +--- a/src/video/wayland/SDL_waylandevents.c ++++ b/src/video/wayland/SDL_waylandevents.c +@@ -987,7 +987,9 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, + SDL_SendKeyboardText(text); + } + } +- keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); ++ if (input->xkb.keymap && WAYLAND_xkb_keymap_key_repeats(input->xkb.keymap, key + 8)) { ++ keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); ++ } + } + } + +diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h +index 366ce9e94..fa29bedb1 100644 +--- a/src/video/wayland/SDL_waylandsym.h ++++ b/src/video/wayland/SDL_waylandsym.h +@@ -122,6 +122,7 @@ SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, + SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) ) + SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags)) + SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) ) ++SDL_WAYLAND_SYM(int, xkb_keymap_key_repeats, (struct xkb_keymap *keymap, xkb_keycode_t key) ); + SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) ) + SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) ) + SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) ) +-- +2.34.1 + diff --git a/SOURCES/PR5171-split-static-cmake-targets.patch b/SOURCES/PR5171-split-static-cmake-targets.patch deleted file mode 100644 index 2cc6c75..0000000 --- a/SOURCES/PR5171-split-static-cmake-targets.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 7393bdae70b445334157410f61372937b922cdc6 Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Tue, 4 Jan 2022 09:35:41 -0500 -Subject: [PATCH] cmake: Split SDL2-static and SDL2main into their own target - exports - -This makes it so that the generated targets are not interdependent, -which allows Linux distributions to split libraries into the -appropriate subpackages as needed. ---- - CMakeLists.txt | 56 +++++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 44 insertions(+), 12 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 76cc3c516..be15edc74 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2748,7 +2748,6 @@ if(NOT WINDOWS_STORE) - add_library(SDL2::SDL2main ALIAS SDL2main) - target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2main PUBLIC "$" $ $) -- set(_INSTALL_LIBS "SDL2main") - if (NOT ANDROID) - set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") - endif() -@@ -2794,7 +2793,6 @@ if(SDL_SHARED) - endif() - set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") - endif() -- set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) - target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2 PUBLIC "$;$;$") -@@ -2826,7 +2824,6 @@ if(SDL_STATIC) - endif() - # TODO: Win32 platforms keep the same suffix .lib for import and static - # libraries - do we need to consider this? -- set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) - target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2-static BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2-static PUBLIC "$" $ $) -@@ -2848,10 +2845,26 @@ if(SDL_TEST) - endif() - - ##### Installation targets ##### --install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets -- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+if(SDL_SHARED) -+ install(TARGETS SDL2 EXPORT SDL2Targets -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+endif() -+ -+if(NOT WINDOWS_STORE) -+ install(TARGETS SDL2main EXPORT SDL2mainTargets -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+endif() -+ -+if(SDL_STATIC) -+ install(TARGETS SDL2-static EXPORT SDL2staticTargets -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+endif() - - ##### Export files ##### - if (WINDOWS AND NOT MINGW) -@@ -2866,11 +2879,30 @@ write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" - COMPATIBILITY AnyNewerVersion - ) - --install(EXPORT SDL2Targets -- FILE SDL2Targets.cmake -- NAMESPACE SDL2:: -- DESTINATION ${PKG_PREFIX} --) -+if(SDL_SHARED) -+ install(EXPORT SDL2Targets -+ FILE SDL2Targets.cmake -+ NAMESPACE SDL2:: -+ DESTINATION ${PKG_PREFIX} -+ ) -+endif() -+ -+if(NOT WINDOWS_STORE) -+ install(EXPORT SDL2mainTargets -+ FILE SDL2mainTargets.cmake -+ NAMESPACE SDL2:: -+ DESTINATION ${PKG_PREFIX} -+ ) -+endif() -+ -+if(SDL_STATIC) -+ install(EXPORT SDL2staticTargets -+ FILE SDL2staticTargets.cmake -+ NAMESPACE SDL2:: -+ DESTINATION ${PKG_PREFIX} -+ ) -+endif() -+ - install( - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake --- -2.33.1 - diff --git a/SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch b/SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch deleted file mode 100644 index 25c191c..0000000 --- a/SOURCES/SDL2-2.0.18-Fix-build-against-wayland-1.20.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 068c13b1cac4fead98a458b70ef482ddc8205358 Mon Sep 17 00:00:00 2001 -From: David Redondo -Date: Fri, 10 Dec 2021 16:22:34 +0100 -Subject: [PATCH] Fix build against wayland 1.20 - -Fixes #5088 ---- - src/video/wayland/SDL_waylanddyn.h | 2 ++ - src/video/wayland/SDL_waylandsym.h | 4 ++++ - 2 files changed, 6 insertions(+) - -diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h -index 13b0884d076..2268555604a 100644 ---- a/src/video/wayland/SDL_waylanddyn.h -+++ b/src/video/wayland/SDL_waylanddyn.h -@@ -95,6 +95,8 @@ void SDL_WAYLAND_UnloadSymbols(void); - #define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) - #define wl_proxy_set_tag (*WAYLAND_wl_proxy_set_tag) - #define wl_proxy_get_tag (*WAYLAND_wl_proxy_get_tag) -+#define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags) -+#define wl_proxy_marshal_array_flags (*WAYLAND_wl_proxy_marshal_array_flags) - - #define wl_seat_interface (*WAYLAND_wl_seat_interface) - #define wl_surface_interface (*WAYLAND_wl_surface_interface) -diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h -index d6e6a761d39..32e47d26e2d 100644 ---- a/src/video/wayland/SDL_waylandsym.h -+++ b/src/video/wayland/SDL_waylandsym.h -@@ -84,6 +84,10 @@ SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_18) - SDL_WAYLAND_SYM(void, wl_proxy_set_tag, (struct wl_proxy *, const char * const *)) - SDL_WAYLAND_SYM(const char * const *, wl_proxy_get_tag, (struct wl_proxy *)) - -+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20) -+SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...)) -+SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args)) -+ - SDL_WAYLAND_INTERFACE(wl_seat_interface) - SDL_WAYLAND_INTERFACE(wl_surface_interface) - SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) diff --git a/SPECS/SDL2.spec b/SPECS/SDL2.spec index 0e64ccc..5f128f8 100644 --- a/SPECS/SDL2.spec +++ b/SPECS/SDL2.spec @@ -9,8 +9,8 @@ %global libdecor_majver 0 Name: SDL2 -Version: 2.0.18 -Release: 1%{?dist} +Version: 2.0.20 +Release: 2%{?dist} Summary: Cross-platform multimedia library License: zlib and MIT URL: http://www.libsdl.org/ @@ -22,13 +22,22 @@ Patch0: multilib.patch # ptrdiff_t is not the same as khronos defines on 32bit arches Patch1: SDL2-2.0.9-khrplatform.patch -# Backports from upstream -## From: https://github.com/libsdl-org/SDL/commit/e2ade2bfc46d915cd306c63c830b81d800b2575f -Patch100: SDL2-2.0.18-Fix-build-against-wayland-1.20.patch - -# Proposed upstream -## From: https://github.com/libsdl-org/SDL/pull/5171 -Patch500: PR5171-split-static-cmake-targets.patch +# Wayland backports +# From git format-patch release-2.0.20..68dd84f1de159b2e6ae1d5a23f842ee87f8a175a src/video/wayland/ +Patch0101: 0001-wayland-Convert-URI-to-local-path-for-DropFile.patch +Patch0102: 0002-wayland-Avoid-spurious-resize-events.patch +Patch0103: 0003-wayland-Fix-building-with-SDL_OPENGL-OFF.patch +Patch0104: 0004-wayland-Avoid-calling-SetFullscreen-in-libdecor-Show.patch +Patch0105: 0005-wayland-Detach-hidden-surfaces-in-HideWindow-not-Sho.patch +Patch0106: 0006-wayland-Call-SetFullscreen-directly-in-ShowWindow.patch +Patch0107: 0007-wayland-Try-to-avoid-committing-before-the-window-is.patch +Patch0108: 0008-wayland-Fix-SDL_SetWindowSize-being-dropped-right-af.patch +Patch0109: 0009-wayland-Round-the-refresh-rate-rather-than-truncatin.patch +Patch0110: 0010-Fix-text_input_v3-preedit-string.patch +Patch0111: 0011-Only-generate-key-repetition-for-keys-that-should-re.patch + +# From: https://github.com/libsdl-org/SDL/commit/8ceba27d6291f1195e13608033ec439aec621fc6 +Patch0199: 0001-video-Prefer-Wayland-over-X11.patch BuildRequires: git-core BuildRequires: cmake @@ -87,6 +96,8 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Requires: mesa-libEGL-devel%{?_isa} Requires: mesa-libGLES-devel%{?_isa} Requires: libX11-devel%{?_isa} +# Conflict with versions before libSDLmain moved here +Conflicts: %{name}-static < 2.0.18-2 %description devel Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed @@ -98,6 +109,8 @@ developing SDL applications. Summary: Static libraries for SDL2 # Needed to keep CMake happy Requires: %{name}-devel%{?_isa} = %{version}-%{release} +# Conflict with versions before libSDLmain moved to -devel +Conflicts: %{name}-devel < 2.0.18-2 %description static Static libraries for SDL2. @@ -156,20 +169,34 @@ install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/SDL2/SDL_revision.h %doc README.md TODO.txt WhatsNew.txt %{_bindir}/*-config %{_libdir}/lib*.so +%{_libdir}/libSDL2main.a %{_libdir}/pkgconfig/sdl2.pc %dir %{_libdir}/cmake/SDL2 %{_libdir}/cmake/SDL2/SDL2Config*.cmake %{_libdir}/cmake/SDL2/SDL2Targets*.cmake +%{_libdir}/cmake/SDL2/SDL2mainTargets*.cmake %{_includedir}/SDL2 %{_datadir}/aclocal/* %files static %license LICENSE.txt -%{_libdir}/lib*.a -%{_libdir}/cmake/SDL2/SDL2mainTargets*.cmake +%{_libdir}/libSDL2.a %{_libdir}/cmake/SDL2/SDL2staticTargets*.cmake %changelog +* Tue Feb 08 2022 Neal Gompa - 2.0.20-2 +- Backport Wayland fixes with Wayland-by-default from upstream + Resolves: rhbz#2051963 + +* Tue Jan 11 2022 Neal Gompa - 2.0.20-1 +- Update to 2.0.20 + Resolves: rhbz#2039137 +- Drop backported patches included in this release + +* Fri Jan 07 2022 Neal Gompa - 2.0.18-2 +- Move libSDL2main to -devel and refresh split CMake target patch + Resolves: rhbz#2038390 + * Tue Jan 04 2022 Neal Gompa - 2.0.18-1 - Update to 2.0.18 Resolves: rhbz#2028076