import SDL2-2.0.20-2.el9

This commit is contained in:
CentOS Sources 2022-05-17 04:56:20 -04:00 committed by Stepan Oksanichenko
commit eb2dae7fca
19 changed files with 1575 additions and 0 deletions

1
.SDL2.metadata Normal file
View File

@ -0,0 +1 @@
18ce006cbf07502f48abfedc088c14404091f3d3 SOURCES/SDL2-2.0.20.tar.gz

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/SDL2-2.0.20.tar.gz

View File

@ -0,0 +1,72 @@
From 8ceba27d6291f1195e13608033ec439aec621fc6 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,182 @@
From 9a2bbd8acbebcde56dd2f89ebca3b196c2b38914 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,133 @@
From d3952a8a2c8a32d4f6f521402427052a4b756f9f Mon Sep 17 00:00:00 2001
From: Cameron Gutman <aicommander@gmail.com>
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

View File

@ -0,0 +1,96 @@
From ed3442d7a5a79b3a7357c5bdf54b47ab985ca7f7 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,54 @@
From e1b4761c621e9883c3f02971ea74cef14b1d6b87 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,41 @@
From e2d74bcbe524960c17c852466130a6e0a30674a3 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,28 @@
From f0e768da43173cf62732fc20d1f80eb777d6d5c8 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,142 @@
From 68a71f91c6cbb1458dc95e2d994d4522afd92c5e Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
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

View File

@ -0,0 +1,57 @@
From 77a9ca6ba0ae1973d7bc255a4d785e7f1ba3d111 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <aicommander@gmail.com>
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

View File

@ -0,0 +1,36 @@
From cc40f732f9482eb45a1938a23d4f34265e78a729 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <aicommander@gmail.com>
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

View File

@ -0,0 +1,54 @@
From a90a2e7582a73f7b69b14437287aa15945bf5989 Mon Sep 17 00:00:00 2001
From: Weng Xuetian <wengxt@gmail.com>
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

View File

@ -0,0 +1,42 @@
From b11dfd761181ab5005fe3f5527faa4faf6b56112 Mon Sep 17 00:00:00 2001
From: Weng Xuetian <wengxt@gmail.com>
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

View File

@ -0,0 +1,15 @@
diff -up SDL2-2.0.9/include/SDL_opengl_glext.h.khrplatform SDL2-2.0.9/include/SDL_opengl_glext.h
--- SDL2-2.0.9/include/SDL_opengl_glext.h.khrplatform 2019-02-15 20:22:39.173773779 -0500
+++ SDL2-2.0.9/include/SDL_opengl_glext.h 2019-02-15 20:22:58.176399330 -0500
@@ -469,8 +469,9 @@ GLAPI void APIENTRY glBlendEquation (GLe
typedef long GLsizeiptr;
typedef long GLintptr;
#else
-typedef ptrdiff_t GLsizeiptr;
-typedef ptrdiff_t GLintptr;
+#include <KHR/khrplatform.h>
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
#endif
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765

83
SOURCES/SDL_config.h Normal file
View File

@ -0,0 +1,83 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
* This SDL_config.h is a wrapper include file for the original SDL_config.h,
* which has been renamed to SDL_config-<arch>.h. There are conflicts for the
* original SDL_config.h on multilib systems, which result from arch-specific
* configuration options. Please do not use the arch-specific file directly.
*
* Copyright (C) 2013 Igor Gnatenko
* Igor Gnatenko <i.gnatenko.brain@gmail.com>
*/
/**
* \file SDL_config.h
*/
#ifdef SDL_config_wrapper_h
#error "SDL_config_wrapper_h should not be defined!"
#endif
#define SDL_config_wrapper_h
#if defined(__i386__)
#include "SDL_config-i386.h"
#elif defined(__ia64__)
#include "SDL_config-ia64.h"
#elif defined(__powerpc64__)
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#include "SDL_config-ppc64.h"
# else
#include "SDL_config-ppc64le.h"
# endif
#elif defined(__powerpc__)
#include "SDL_config-ppc.h"
#elif defined(__s390x__)
#include "SDL_config-s390x.h"
#elif defined(__s390__)
#include "SDL_config-s390.h"
#elif defined(__x86_64__)
#include "SDL_config-x86_64.h"
#elif defined(__arm__)
#include "SDL_config-arm.h"
#elif defined(__alpha__)
#include "SDL_config-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "SDL_config-sparc64.h"
#elif defined(__sparc__)
#include "SDL_config-sparc.h"
#elif defined(__aarch64__)
#include "SDL_config-aarch64.h"
#elif defined(__mips64) && defined(__MIPSEL__)
#include "SDL_config-mips64el.h"
#elif defined(__mips64)
#include "SDL_config-mips64.h"
#elif defined(__mips) && defined(__MIPSEL__)
#include "SDL_config-mipsel.h"
#elif defined(__mips)
#include "SDL_config-mips.h"
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#include "SDL_config-riscv64.h"
#else
#error "The SDL2-devel package is not usable with the architecture."
#endif
#undef SDL_config_wrapper_h

83
SOURCES/SDL_revision.h Normal file
View File

@ -0,0 +1,83 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
* This SDL_revision.h is a wrapper include file for the original SDL_revision.h,
* which has been renamed to SDL_revision-<arch>.h. There are conflicts for the
* original SDL_revision.h on multilib systems, which result from REVISION
* inconsistency between architecture builds, though, I'm not sure why.
* Computers are weird.
*
* Copyright (C) 2021 Tom Callaway <spotrh@gmail.com>
*/
/**
* \file SDL_revision.h
*/
#ifdef SDL_revision_wrapper_h
#error "SDL_revision_wrapper_h should not be defined!"
#endif
#define SDL_revision_wrapper_h
#if defined(__i386__)
#include "SDL_revision-i386.h"
#elif defined(__ia64__)
#include "SDL_revision-ia64.h"
#elif defined(__powerpc64__)
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#include "SDL_revision-ppc64.h"
# else
#include "SDL_revision-ppc64le.h"
# endif
#elif defined(__powerpc__)
#include "SDL_revision-ppc.h"
#elif defined(__s390x__)
#include "SDL_revision-s390x.h"
#elif defined(__s390__)
#include "SDL_revision-s390.h"
#elif defined(__x86_64__)
#include "SDL_revision-x86_64.h"
#elif defined(__arm__)
#include "SDL_revision-arm.h"
#elif defined(__alpha__)
#include "SDL_revision-alpha.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "SDL_revision-sparc64.h"
#elif defined(__sparc__)
#include "SDL_revision-sparc.h"
#elif defined(__aarch64__)
#include "SDL_revision-aarch64.h"
#elif defined(__mips64) && defined(__MIPSEL__)
#include "SDL_revision-mips64el.h"
#elif defined(__mips64)
#include "SDL_revision-mips64.h"
#elif defined(__mips) && defined(__MIPSEL__)
#include "SDL_revision-mipsel.h"
#elif defined(__mips)
#include "SDL_revision-mips.h"
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#include "SDL_revision-riscv64.h"
#else
#error "The SDL2-devel package is not usable with the architecture."
#endif
#undef SDL_revision_wrapper_h

25
SOURCES/multilib.patch Normal file
View File

@ -0,0 +1,25 @@
diff -up SDL2-2.0.14/sdl2-config.in.orig SDL2-2.0.14/sdl2-config.in
--- SDL2-2.0.14/sdl2-config.in.orig 2020-12-21 17:44:36.000000000 +0000
+++ SDL2-2.0.14/sdl2-config.in 2021-01-21 16:26:35.663960042 +0000
@@ -3,7 +3,6 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
-libdir=@libdir@
@ENABLE_STATIC_FALSE@usage="\
@ENABLE_STATIC_FALSE@Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
@@ -45,11 +44,11 @@ while test $# -gt 0; do
echo -I@includedir@/SDL2 @SDL_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo @SDL_RLD_FLAGS@ @SDL_LIBS@
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)
-@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@ echo @SDL_LIBS@ @SDL_STATIC_LIBS@
@ENABLE_STATIC_TRUE@ ;;
*)
echo "${usage}" 1>&2

430
SPECS/SDL2.spec Normal file
View File

@ -0,0 +1,430 @@
# For the generated library symbol suffix
%if 0%{?__isa_bits} == 32
%global libsymbolsuffix %{nil}
%else
%global libsymbolsuffix ()(%{__isa_bits}bit)
%endif
# For declaring rich dependency on libdecor
%global libdecor_majver 0
Name: SDL2
Version: 2.0.20
Release: 2%{?dist}
Summary: Cross-platform multimedia library
License: zlib and MIT
URL: http://www.libsdl.org/
Source0: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
Source1: SDL_config.h
Source2: SDL_revision.h
Patch0: multilib.patch
# ptrdiff_t is not the same as khronos defines on 32bit arches
Patch1: SDL2-2.0.9-khrplatform.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
BuildRequires: make
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: alsa-lib-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
BuildRequires: mesa-libEGL-devel
BuildRequires: mesa-libGLES-devel
BuildRequires: libXext-devel
BuildRequires: libX11-devel
BuildRequires: libXi-devel
BuildRequires: libXrandr-devel
BuildRequires: libXrender-devel
BuildRequires: libXScrnSaver-devel
BuildRequires: libusb-devel
BuildRequires: libXinerama-devel
BuildRequires: libXcursor-devel
BuildRequires: systemd-devel
# PulseAudio
BuildRequires: pkgconfig(libpulse-simple)
# Jack
BuildRequires: pkgconfig(jack)
# PipeWire
BuildRequires: pkgconfig(libpipewire-0.3)
# D-Bus
BuildRequires: pkgconfig(dbus-1)
# IBus
BuildRequires: pkgconfig(ibus-1.0)
# Wayland
BuildRequires: pkgconfig(libdecor-%{libdecor_majver})
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-egl)
BuildRequires: pkgconfig(wayland-cursor)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(wayland-scanner)
BuildRequires: pkgconfig(xkbcommon)
# Vulkan
BuildRequires: vulkan-devel
# KMS
BuildRequires: mesa-libgbm-devel
BuildRequires: libdrm-devel
# Ensure libdecor is pulled in when libwayland-client is (rhbz#1992804)
Requires: (libdecor-%{libdecor_majver}.so.%{libdecor_majver}%{libsymbolsuffix} if libwayland-client)
%description
Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed
to provide fast access to the graphics frame buffer and audio device.
%package devel
Summary: Files needed to develop Simple DirectMedia Layer applications
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
to provide fast access to the graphics frame buffer and audio device. This
package provides the libraries, include files, and other resources needed for
developing SDL applications.
%package static
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.
%prep
%autosetup -S git
sed -i -e 's/\r//g' TODO.txt README.md WhatsNew.txt BUGS.txt LICENSE.txt CREDITS.txt README-SDL.txt
%build
# Deal with new CMake policy around whitespace in LDFLAGS...
export LDFLAGS="%{shrink:%{build_ldflags}}"
%cmake \
-DSDL_DLOPEN=ON \
-DSDL_VIDEO_KMSDRM=ON \
-DSDL_ARTS=OFF \
-DSDL_ESD=OFF \
-DSDL_NAS=OFF \
-DSDL_PULSEAUDIO_SHARED=ON \
-DSDL_JACK_SHARED=ON \
-DSDL_PIPEWIRE_SHARED=ON \
-DSDL_ALSA=ON \
-DSDL_VIDEO_WAYLAND=ON \
-DSDL_LIBDECOR_SHARED=ON \
-DSDL_VIDEO_VULKAN=ON \
-DSDL_SSE3=OFF \
-DSDL_RPATH=OFF \
-DSDL_STATIC=ON \
-DSDL_STATIC_PIC=ON \
%ifarch ppc64le
-DSDL_ALTIVEC=OFF \
%endif
%cmake_build
%install
%cmake_install
# Rename SDL_config.h to SDL_config-<arch>.h to avoid file conflicts on
# multilib systems and install SDL_config.h wrapper
mv %{buildroot}%{_includedir}/SDL2/SDL_config.h %{buildroot}%{_includedir}/SDL2/SDL_config-%{_arch}.h
install -p -m 644 %{SOURCE1} %{buildroot}%{_includedir}/SDL2/SDL_config.h
# Rename SDL_revision.h to SDL_revision-<arch>.h to avoid file conflicts on
# multilib systems and install SDL_revision.h wrapper
# TODO: Figure out how in the hell the SDL_REVISION changes between architectures on the same SRPM.
mv %{buildroot}%{_includedir}/SDL2/SDL_revision.h %{buildroot}%{_includedir}/SDL2/SDL_revision-%{_arch}.h
install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/SDL2/SDL_revision.h
%files
%license LICENSE.txt
%doc BUGS.txt CREDITS.txt README-SDL.txt
%{_libdir}/libSDL2-2.0.so.0*
%files devel
%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}/libSDL2.a
%{_libdir}/cmake/SDL2/SDL2staticTargets*.cmake
%changelog
* Tue Feb 08 2022 Neal Gompa <ngompa@centosproject.org> - 2.0.20-2
- Backport Wayland fixes with Wayland-by-default from upstream
Resolves: rhbz#2051963
* Tue Jan 11 2022 Neal Gompa <ngompa@centosproject.org> - 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 <ngompa@centosproject.org> - 2.0.18-2
- Move libSDL2main to -devel and refresh split CMake target patch
Resolves: rhbz#2038390
* Tue Jan 04 2022 Neal Gompa <ngompa@centosproject.org> - 2.0.18-1
- Update to 2.0.18
Resolves: rhbz#2028076
- Fix multilib conflict with SDL_revision.h (rhbz#2008838)
- Backport fix for building against wayland-1.20+
- Add patch to split SDL2 CMake targets for static libraries (rhbz#1965359)
* Wed Dec 01 2021 Neal Gompa <ngompa@centosproject.org> - 2.0.16-5
- Re-enable libdecor support now that it's available in RHEL 9
Resolves: rhbz#2003471
* Thu Aug 26 2021 Wim Taymans <wtaymans@redhat.com> - 2.0.16-4
- Build with SDL_STATIC_PIC and SDL_STATIC to actually make the
static version of SDL2
* Thu Aug 26 2021 Wim Taymans <wtaymans@redhat.com> - 2.0.16-3
- Build with SDL_STATIC_PIC instead of SDL_STATIC
* Thu Aug 26 2021 Wim Taymans <wtaymans@redhat.com> - 2.0.16-2
- Disable libdecor until it is added to centos/RHEL9
* Thu Aug 26 2021 Neal Gompa <ngompa@fedoraproject.org> - 2.0.16-1
- Update to 2.0.16
* Thu Aug 26 2021 Tom Callaway <spot@fedoraproject.org> - 2.0.14-7
- add -static Requires to -devel to make CMake stop failing on missing files (bz1965359)
* Thu Aug 26 2021 Neal Gompa <ngompa13@gmail.com> - 2.0.14-6
- Switch to CMake to build SDL2
- Build JACK support unconditionally since PipeWire-JACK exists in RHEL 9
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.14-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.14-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Feb 22 2021 Hans de Goede <hdegoede@redhat.com> - 2.0.14-3
- SDL2 no longer uses audiofile, drop the audiofile-devel BuildRequires
* Mon Jan 25 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 21 2021 Pete Walter <pwalter@fedoraproject.org> - 2.0.14-1
- Update to 2.0.14
- Rebase multilib.patch
- Don't use globs in the form of libFOO.so.* for listing files
* Tue Jan 12 2021 Wim Taymans <wtaymans@redhat.com> - 2.0.12-5
- Disable JACK on rhel >= 8
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 2.0.12-2
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Wed Mar 11 2020 Pete Walter <pwalter@fedoraproject.org> - 2.0.12-1
- Update to 2.0.12
* Tue Feb 11 2020 Tom Callaway <spot@fedoraproject.org> - 2.0.10-3
- apply upstream fix for FTBFS
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jul 26 2019 Pete Walter <pwalter@fedoraproject.org> - 2.0.10-1
- Update to 2.0.10
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 15 2019 Tom Callaway <spot@fedoraproject.org> - 2.0.9-3
- use khrplatform defines, not ptrdiff_t
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Nov 2 2018 Tom Callaway <spot@fedoraproject.org> - 2.0.9-1
- update to 2.0.9
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon May 21 2018 Adam Jackson <ajax@redhat.com> - 2.0.8-5
- Backport a crash/hang fix from 2.0.9 (#1580541)
* Wed Apr 11 2018 Tom Callaway <spot@fedoraproject.org> - 2.0.8-4
- enable video-kmsdrm
* Fri Mar 30 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> - 2.0.8-3
- Add riscv64 to SDL_config.h
* Sun Mar 04 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.8-2
- Disable altivec on ppc64le (RHBZ #1551338)
* Sun Mar 4 2018 Peter Robinson <pbrobinson@fedoraproject.org> 2.0.8-1
- Update to 2.0.8
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jan 31 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.7-3
- Switch to %%ldconfig_scriptlets
* Sun Nov 05 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.7-2
- Fix IBus
* Tue Oct 24 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.7-1
- Update to 2.0.7
* Thu Oct 19 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.6-4
- Fully fix last overflow
* Wed Oct 11 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.6-3
- Fix potential overflow in surface allocation
* Thu Oct 05 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.6-2
- Fix invalid dbus arguments
* Sat Sep 23 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.6-1
- Update to 2.0.6
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Jan 27 2017 Igor Gnatenko <ignatenko@redhat.com> - 2.0.5-3
- Fix NULL dereference (RHBZ #1416945)
* Wed Oct 26 2016 Dan Horák <dan[at]danny.cz> - 2.0.5-2
- fix FTBFS on ppc64/ppc64le
* Thu Oct 20 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.5-1
- Update to 2.0.5 (RHBZ #1387238)
* Mon Sep 05 2016 Kalev Lember <klember@redhat.com> - 2.0.4-9
- Backport Wayland fixes from upstream
* Sun Aug 14 2016 Igor Gnatenko <ignatenko@redhat.com> - 2.0.4-8
- Fix whitespaces in CMake file (RHBZ #1366868)
* Sun Jul 10 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.4-7
- Remove useless Requirements from -devel subpkg
* Sun Jul 10 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.4-6
- Add ibus support
* Sun Jul 10 2016 Joseph Mullally <jwmullally@gmail.com> - 2.0.4-5
- fix Wayland dynamic symbol loading (bz1354155)
* Thu Feb 25 2016 Tom Callaway <spot@fedoraproject.org> - 2.0.4-4
- enable static subpackage (bz1253930)
* Fri Feb 5 2016 Tom Callaway <spot@fedoraproject.org> - 2.0.4-3
- fix compile against latest wayland
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Jan 04 2016 Tom Callaway <spot@fedoraproject.org> - 2.0.4-1
- update to 2.0.4
* Fri Sep 04 2015 Michal Toman <mtoman@fedoraproject.org> - 2.0.3-7
- Add support for MIPS architecture to SDL_config.h
* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Jun 2 2015 Tom Callaway <spot@fedoraproject.org> - 2.0.3-5
- remove code preventing builds with ancient gcc
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Jun 11 2014 Karsten Hopp <karsten@redhat.com> 2.0.3-3
- fix filename of SDL_config.h for ppc64le
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Mar 19 2014 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.3-1
- 2.0.3 upstream release
* Sat Mar 08 2014 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.2-1
- 2.0.2 upstream release
- Enable wayland backend
* Tue Dec 10 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.1-2
- Add libXinerama, libudev, libXcursor support (RHBZ #1039702)
* Thu Oct 24 2013 Tom Callaway <spot@fedoraproject.org> - 2.0.1-1
- update to 2.0.1
* Sat Aug 24 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-3
- Fix multilib issues
* Tue Aug 13 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-2
- SDL2 is released. Announce:
- http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-August/089854.html
* Sat Aug 10 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-1.rc4
- Update to latest SDL2 (08.08.2013)
* Tue Jul 30 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-1.rc3
- Fix Licenses
- some cleanups in spec
* Tue Jul 30 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-1.rc2
- Delete -static package
- Fix License tag
- Fix end-of-line in documents
- Remove all spike-nails EL-specify (if someone will want to do - 'patches are welcome')
- Change Release tag to .rcX%%{?dist} (maintainer has changed released tarballs)
* Mon Jul 29 2013 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.0.0-1.rc1
- Some fixes in spec and cleanup
* Mon Jul 29 2013 Jon Ciesla <limburgher@gmail.com> - 2.0.0-1
- Ported from SDL 1.2.15-10