Update to 2.0.18

This commit is contained in:
Neal Gompa 2021-12-01 07:39:25 -05:00
parent c93d591871
commit 0906fd7d1c
11 changed files with 8 additions and 782 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@
/SDL2-2.0.12.tar.gz
/SDL2-2.0.14.tar.gz
/SDL2-2.0.16.tar.gz
/SDL2-2.0.18.tar.gz

View File

@ -1,48 +0,0 @@
From 3261f7f6ceaaa435a3aca0252b2f7126eeae1bb2 Mon Sep 17 00:00:00 2001
From: David Gow <david@ingeniumdigital.com>
Date: Thu, 26 Aug 2021 16:15:30 +0800
Subject: [PATCH] audio: Support "pulse" as an alias for "pulseaudio"
Originally, SDL 1.2 used "pulse" as the name for its PulseAudio driver.
While it now supports "pulseaudio" as well for compatibility with SDL
2.0 [1], there are still scripts and distro packages which set
SDL_AUDIODRIVER=pulse [2]. While it's possible to remove this in most
circumstances or replace it with "pulseaudio" or a comma-separated list,
this may still conflict if the environment variable is set globally and
old binary builds of SDL 1.2 (e.g. packaged with older games) are being
used.
To fix this on SDL 2.0, add a hardcoded check for "pulse" as an audio
driver name, and replace it with "pulseaudio". This mimics what SDL 1.2
does (but in reverse). Note that setting driver_attempt{,_len} is safe
here as they're reset correctly based on driver_attempt_end on the next
loop.
[1] https://github.com/libsdl-org/SDL-1.2/commit/d9514097846381cd30fe08df65dbdd48de92a058
[2] https://bugzilla.opensuse.org/show_bug.cgi?id=1189778
---
src/audio/SDL_audio.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 69cddd535..972207d36 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -978,6 +978,14 @@ SDL_AudioInit(const char *driver_name)
const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
: SDL_strlen(driver_attempt);
+#if SDL_AUDIO_DRIVER_PULSEAUDIO
+ /* SDL 1.2 uses the name "pulse", so we'll support both. */
+ if (driver_attempt_len == SDL_strlen("pulse") &&
+ (SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) {
+ driver_attempt = "pulseaudio";
+ driver_attempt_len = SDL_strlen("pulseaudio");
+ }
+#endif
for (i = 0; bootstrap[i]; ++i) {
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
--
2.32.0

View File

@ -1,53 +0,0 @@
From 5113fedfa0e8592048a66cf8f852a59441e8bc9c Mon Sep 17 00:00:00 2001
From: Eric Engestrom <eric@engestrom.ch>
Date: Mon, 2 Aug 2021 23:01:12 +0100
Subject: [PATCH] video/wayland: use EGL_EXT_present_opaque when available
---
src/video/SDL_egl.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 87d693e8d..41966db45 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -43,6 +43,11 @@
#endif
#endif /* EGL_KHR_create_context */
+#ifndef EGL_EXT_present_opaque
+#define EGL_EXT_present_opaque 1
+#define EGL_PRESENT_OPAQUE_EXT 0x31DF
+#endif /* EGL_EXT_present_opaque */
+
#if SDL_VIDEO_DRIVER_RPI
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
@@ -1182,8 +1187,8 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
EGLint format_wanted;
EGLint format_got;
#endif
- /* max 2 values plus terminator. */
- EGLint attribs[3];
+ /* max 2 key+value pairs, plus terminator. */
+ EGLint attribs[5];
int attr = 0;
EGLSurface * surface;
@@ -1216,6 +1221,13 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
}
}
+#ifdef EGL_EXT_present_opaque
+ if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_EXT_present_opaque")) {
+ attribs[attr++] = EGL_PRESENT_OPAQUE_EXT;
+ attribs[attr++] = EGL_TRUE;
+ }
+#endif
+
attribs[attr++] = EGL_NONE;
surface = _this->egl_data->eglCreateWindowSurface(
--
2.32.0

View File

@ -1,393 +0,0 @@
From 8e54698aa6e3c0cf02d0b628403f047f28ea7fd0 Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
Date: Wed, 22 Sep 2021 13:26:44 -0400
Subject: [PATCH 1/2] wayland: Add support for high-DPI cursors
---
src/video/wayland/SDL_waylandmouse.c | 230 ++++++++++++++++-----------
src/video/wayland/SDL_waylandmouse.h | 2 +-
src/video/wayland/SDL_waylandvideo.c | 6 +-
src/video/wayland/SDL_waylandvideo.h | 8 +-
4 files changed, 147 insertions(+), 99 deletions(-)
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index a0df26bdf..23663ebe1 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -47,11 +47,110 @@ typedef struct {
int hot_x, hot_y;
int w, h;
- /* Either a preloaded cursor, or one we created ourselves */
- struct wl_cursor *cursor;
+ /* shm_data is non-NULL for custom cursors.
+ * When shm_data is NULL, system_cursor must be valid
+ */
+ SDL_SystemCursor system_cursor;
void *shm_data;
} Wayland_CursorData;
+static SDL_bool
+wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float *scale)
+{
+ struct wl_cursor_theme *theme = NULL;
+ struct wl_cursor *cursor;
+
+ SDL_Window *focus;
+ SDL_WindowData *focusdata;
+ int i;
+
+ /* FIXME: We need to be able to query the cursor size from the desktop at
+ * some point! For a while this was 32, but when testing on real desktops it
+ * seems like most of them default to 24. We'll need a protocol to get this
+ * for real, but for now this is a pretty safe bet.
+ * -flibit
+ */
+ int size = 24;
+
+ /* First, find the appropriate theme based on the current scale... */
+ focus = SDL_GetMouse()->focus;
+ if (focus == NULL) {
+ /* Nothing to see here, bail. */
+ return SDL_FALSE;
+ }
+ focusdata = focus->driverdata;
+ *scale = focusdata->scale_factor;
+ size *= focusdata->scale_factor;
+ for (i = 0; i < vdata->num_cursor_themes; i += 1) {
+ if (vdata->cursor_themes[i].size == size) {
+ theme = vdata->cursor_themes[i].theme;
+ break;
+ }
+ }
+ if (theme == NULL) {
+ vdata->cursor_themes = SDL_realloc(vdata->cursor_themes,
+ sizeof(SDL_WaylandCursorTheme) * (vdata->num_cursor_themes + 1));
+ if (vdata->cursor_themes == NULL) {
+ SDL_OutOfMemory();
+ return SDL_FALSE;
+ }
+ theme = WAYLAND_wl_cursor_theme_load(NULL, size, vdata->shm);
+ vdata->cursor_themes[vdata->num_cursor_themes++].theme = theme;
+ }
+
+ /* Next, find the cursor from the theme... */
+ switch(cdata->system_cursor)
+ {
+ case SDL_SYSTEM_CURSOR_ARROW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr");
+ break;
+ case SDL_SYSTEM_CURSOR_IBEAM:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "xterm");
+ break;
+ case SDL_SYSTEM_CURSOR_WAIT:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch");
+ break;
+ case SDL_SYSTEM_CURSOR_CROSSHAIR:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_WAITARROW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENWSE:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENESW:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEWE:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZENS:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_SIZEALL:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ case SDL_SYSTEM_CURSOR_NO:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "xterm");
+ break;
+ case SDL_SYSTEM_CURSOR_HAND:
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand1");
+ break;
+ default:
+ SDL_assert(0);
+ return SDL_FALSE;
+ }
+
+ /* ... Set the cursor data, finally. */
+ cdata->buffer = WAYLAND_wl_cursor_image_get_buffer(cursor->images[0]);
+ cdata->hot_x = cursor->images[0]->hotspot_x;
+ cdata->hot_y = cursor->images[0]->hotspot_y;
+ cdata->w = cursor->images[0]->width;
+ cdata->h = cursor->images[0]->height;
+ return SDL_TRUE;
+}
+
static int
wayland_create_tmp_file(off_t size)
{
@@ -192,30 +291,30 @@ Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
}
static SDL_Cursor *
-CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
+Wayland_CreateSystemCursor(SDL_SystemCursor id)
{
+ SDL_VideoData *data = SDL_GetVideoDevice()->driverdata;
SDL_Cursor *cursor;
cursor = SDL_calloc(1, sizeof (*cursor));
if (cursor) {
- Wayland_CursorData *data = SDL_calloc (1, sizeof (Wayland_CursorData));
- if (!data) {
+ Wayland_CursorData *cdata = SDL_calloc (1, sizeof (Wayland_CursorData));
+ if (!cdata) {
SDL_OutOfMemory();
SDL_free(cursor);
return NULL;
}
- cursor->driverdata = (void *) data;
+ cursor->driverdata = (void *) cdata;
- data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]);
- data->surface = wl_compositor_create_surface(d->compositor);
- wl_surface_set_user_data(data->surface, NULL);
- data->hot_x = wlcursor->images[0]->hotspot_x;
- data->hot_y = wlcursor->images[0]->hotspot_y;
- data->w = wlcursor->images[0]->width;
- data->h = wlcursor->images[0]->height;
- data->cursor= wlcursor;
+ cdata->surface = wl_compositor_create_surface(data->compositor);
+ wl_surface_set_user_data(cdata->surface, NULL);
+
+ /* Note that we can't actually set any other cursor properties, as this
+ * is output-specific. See wayland_get_system_cursor for the rest!
+ */
+ cdata->system_cursor = id;
} else {
- SDL_OutOfMemory ();
+ SDL_OutOfMemory();
}
return cursor;
@@ -224,66 +323,7 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
static SDL_Cursor *
Wayland_CreateDefaultCursor()
{
- SDL_VideoDevice *device = SDL_GetVideoDevice();
- SDL_VideoData *data = device->driverdata;
-
- return CreateCursorFromWlCursor (data,
- WAYLAND_wl_cursor_theme_get_cursor(data->cursor_theme,
- "left_ptr"));
-}
-
-static SDL_Cursor *
-Wayland_CreateSystemCursor(SDL_SystemCursor id)
-{
- SDL_VideoDevice *vd = SDL_GetVideoDevice();
- SDL_VideoData *d = vd->driverdata;
-
- struct wl_cursor *cursor = NULL;
-
- switch(id)
- {
- default:
- SDL_assert(0);
- return NULL;
- case SDL_SYSTEM_CURSOR_ARROW:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
- break;
- case SDL_SYSTEM_CURSOR_IBEAM:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
- break;
- case SDL_SYSTEM_CURSOR_WAIT:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "watch");
- break;
- case SDL_SYSTEM_CURSOR_CROSSHAIR:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_WAITARROW:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "watch");
- break;
- case SDL_SYSTEM_CURSOR_SIZENWSE:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_SIZENESW:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_SIZEWE:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_SIZENS:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_SIZEALL:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- case SDL_SYSTEM_CURSOR_NO:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
- break;
- case SDL_SYSTEM_CURSOR_HAND:
- cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
- break;
- }
-
- return CreateCursorFromWlCursor(d, cursor);
+ return Wayland_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
}
static void
@@ -300,14 +340,14 @@ Wayland_FreeCursor(SDL_Cursor *cursor)
if (!d)
return;
- if (d->buffer && !d->cursor)
+ if (d->buffer && d->shm_data)
wl_buffer_destroy(d->buffer);
if (d->surface)
wl_surface_destroy(d->surface);
/* Not sure what's meant to happen to shm_data */
- SDL_free (cursor->driverdata);
+ SDL_free(cursor->driverdata);
SDL_free(cursor);
}
@@ -317,8 +357,8 @@ Wayland_ShowCursor(SDL_Cursor *cursor)
SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *d = vd->driverdata;
struct SDL_WaylandInput *input = d->input;
-
struct wl_pointer *pointer = d->pointer;
+ float scale = 1.0f;
if (!pointer)
return -1;
@@ -327,22 +367,26 @@ Wayland_ShowCursor(SDL_Cursor *cursor)
{
Wayland_CursorData *data = cursor->driverdata;
- wl_pointer_set_cursor (pointer,
- input->pointer_enter_serial,
- data->surface,
- data->hot_x,
- data->hot_y);
+ /* TODO: High-DPI custom cursors? -flibit */
+ if (data->shm_data == NULL) {
+ if (!wayland_get_system_cursor(d, data, &scale)) {
+ return -1;
+ }
+ }
+
+ wl_surface_set_buffer_scale(data->surface, scale);
+ wl_pointer_set_cursor(pointer,
+ input->pointer_enter_serial,
+ data->surface,
+ data->hot_x / scale,
+ data->hot_y / scale);
wl_surface_attach(data->surface, data->buffer, 0, 0);
wl_surface_damage(data->surface, 0, 0, data->w, data->h);
wl_surface_commit(data->surface);
}
else
{
- wl_pointer_set_cursor (pointer,
- input->pointer_enter_serial,
- NULL,
- 0,
- 0);
+ wl_pointer_set_cursor(pointer, input->pointer_enter_serial, NULL, 0, 0);
}
return 0;
@@ -389,10 +433,12 @@ Wayland_InitMouse(void)
}
void
-Wayland_FiniMouse(void)
+Wayland_FiniMouse(SDL_VideoData *data)
{
- /* This effectively assumes that nobody else
- * touches SDL_Mouse which is effectively
- * a singleton */
+ int i;
+ for (i = 0; i < data->num_cursor_themes; i += 1) {
+ WAYLAND_wl_cursor_theme_destroy(data->cursor_themes[i].theme);
+ }
+ SDL_free(data->cursor_themes);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
diff --git a/src/video/wayland/SDL_waylandmouse.h b/src/video/wayland/SDL_waylandmouse.h
index 51bfaf5d0..79efaf7e8 100644
--- a/src/video/wayland/SDL_waylandmouse.h
+++ b/src/video/wayland/SDL_waylandmouse.h
@@ -26,6 +26,6 @@
#if SDL_VIDEO_DRIVER_WAYLAND
extern void Wayland_InitMouse(void);
-extern void Wayland_FiniMouse(void);
+extern void Wayland_FiniMouse(SDL_VideoData *data);
#endif
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 1cd67aaf4..03464d193 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -495,7 +495,6 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL);
} else if (SDL_strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
- d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
} else if (SDL_strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
Wayland_display_add_relative_pointer_manager(d, id);
} else if (SDL_strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
@@ -618,7 +617,7 @@ Wayland_VideoQuit(_THIS)
SDL_VideoData *data = _this->driverdata;
int i, j;
- Wayland_FiniMouse ();
+ Wayland_FiniMouse(data);
for (i = 0; i < _this->num_displays; ++i) {
SDL_VideoDisplay *display = &_this->displays[i];
@@ -671,9 +670,6 @@ Wayland_VideoQuit(_THIS)
if (data->shm)
wl_shm_destroy(data->shm);
- if (data->cursor_theme)
- WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
-
if (data->shell.xdg)
xdg_wm_base_destroy(data->shell.xdg);
diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h
index 60336b6cc..2d8b6323a 100644
--- a/src/video/wayland/SDL_waylandvideo.h
+++ b/src/video/wayland/SDL_waylandvideo.h
@@ -41,13 +41,19 @@ struct qt_surface_extension;
struct qt_windowmanager;
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+typedef struct {
+ struct wl_cursor_theme *theme;
+ int size;
+} SDL_WaylandCursorTheme;
+
typedef struct {
struct wl_display *display;
int display_disconnected;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shm *shm;
- struct wl_cursor_theme *cursor_theme;
+ SDL_WaylandCursorTheme *cursor_themes;
+ int num_cursor_themes;
struct wl_pointer *pointer;
struct {
struct xdg_wm_base *xdg;
--
2.32.0

View File

@ -1,75 +0,0 @@
From b592e78f93b1e698b981ecf5af90e48e52e6387e Mon Sep 17 00:00:00 2001
From: Cacodemon345 <wahil1976@outlook.com>
Date: Sat, 25 Sep 2021 12:55:41 +0600
Subject: [PATCH] wayland: Expose xdg_toplevel to SysWM
---
include/SDL_syswm.h | 1 +
src/video/wayland/SDL_waylanddyn.h | 1 +
src/video/wayland/SDL_waylandsym.h | 1 +
src/video/wayland/SDL_waylandwindow.c | 7 +++++++
4 files changed, 10 insertions(+)
diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index 046a096ee..0936727b1 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -292,6 +292,7 @@ struct SDL_SysWMinfo
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
+ struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
} wl;
#endif
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 6cd527316..13b0884d0 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -140,6 +140,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
#define libdecor_frame_set_parent (*WAYLAND_libdecor_frame_set_parent)
#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
+#define libdecor_frame_get_xdg_toplevel (*WAYLAND_libdecor_frame_get_xdg_toplevel)
#define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
#define libdecor_state_new (*WAYLAND_libdecor_state_new)
#define libdecor_state_free (*WAYLAND_libdecor_state_free)
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index 10602740b..40e6c99a1 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -182,6 +182,7 @@ SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
SDL_WAYLAND_SYM(void, libdecor_frame_set_parent, (struct libdecor_frame *,\
struct libdecor_frame *))
SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
+SDL_WAYLAND_SYM(struct xdg_toplevel *, libdecor_frame_get_xdg_toplevel, (struct libdecor_frame *))
SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
SDL_WAYLAND_SYM(void, libdecor_state_free, (struct libdecor_state *))
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 451d33b76..2dd251aba 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -639,12 +639,19 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
#ifdef HAVE_LIBDECOR_H
if (viddata->shell.libdecor && data->shell_surface.libdecor.frame != NULL) {
info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame);
+ if (version >= SDL_VERSIONNUM(2, 0, 17)) {
+ info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame);
+ }
} else
#endif
if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
+ if (version >= SDL_VERSIONNUM(2, 0, 17)) {
+ info->info.wl.xdg_toplevel = data->shell_surface.xdg.roleobj.toplevel;
+ }
} else {
info->info.wl.xdg_surface = NULL;
+ info->info.wl.xdg_toplevel = NULL;
}
}
--
2.32.0

View File

@ -1,26 +0,0 @@
From 1a4e2e5ef7425d44a0faa4ad5535e69f7c0b962c Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
Date: Thu, 23 Sep 2021 14:31:54 -0400
Subject: [PATCH] wayland: For text, ignore key events when Ctrl is held
Fixes #4695
---
src/video/wayland/SDL_waylandevents.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index f021c3adc..82df0fb05 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -839,7 +839,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
}
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- if (has_text) {
+ if (has_text && !(SDL_GetModState() & KMOD_CTRL)) {
Wayland_data_device_set_serial(input->data_device, serial);
if (!handled_by_ime) {
SDL_SendKeyboardText(text);
--
2.32.0

View File

@ -1,104 +0,0 @@
From 7ed415d2edfa44e554605a0b5616c836680756ed Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
Date: Thu, 23 Sep 2021 14:07:38 -0400
Subject: [PATCH] wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior
---
src/{video/x11 => events}/imKStoUCS.c | 7 +++----
src/{video/x11 => events}/imKStoUCS.h | 2 +-
src/video/wayland/SDL_waylandevents.c | 3 ++-
src/video/x11/SDL_x11keyboard.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
rename src/{video/x11 => events}/imKStoUCS.c (99%)
rename src/{video/x11 => events}/imKStoUCS.h (96%)
diff --git a/src/video/x11/imKStoUCS.c b/src/events/imKStoUCS.c
similarity index 99%
rename from src/video/x11/imKStoUCS.c
rename to src/events/imKStoUCS.c
index 40e224243..4aa85d423 100644
--- a/src/video/x11/imKStoUCS.c
+++ b/src/events/imKStoUCS.c
@@ -24,10 +24,9 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
-#include "../../SDL_internal.h"
+#include "../SDL_internal.h"
-#if SDL_VIDEO_DRIVER_X11
-#include <X11/X.h>
+#if SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND
#include "imKStoUCS.h"
static unsigned short const keysym_to_unicode_1a1_1ff[] = {
@@ -294,7 +293,7 @@ static unsigned short const keysym_to_unicode_20a0_20ac[] = {
};
unsigned int
-X11_KeySymToUcs4(KeySym keysym)
+SDL_KeySymToUcs4(Uint32 keysym)
{
/* 'Unicode keysym' */
if ((keysym & 0xff000000) == 0x01000000)
diff --git a/src/video/x11/imKStoUCS.h b/src/events/imKStoUCS.h
similarity index 96%
rename from src/video/x11/imKStoUCS.h
rename to src/events/imKStoUCS.h
index fe4381d98..485ace59f 100644
--- a/src/video/x11/imKStoUCS.h
+++ b/src/events/imKStoUCS.h
@@ -27,6 +27,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
-extern unsigned int X11_KeySymToUcs4(KeySym keysym);
+extern unsigned int SDL_KeySymToUcs4(Uint32 keysym);
#endif /* _imKStoUCS_h */
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 82df0fb05..4cfd0f1cd 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -60,6 +60,7 @@
#include <unistd.h>
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-compose.h>
+#include "../../events/imKStoUCS.h"
/* Weston uses a ratio of 10 units per scroll tick */
#define WAYLAND_WHEEL_AXIS_UNIT 10
@@ -870,7 +871,7 @@ Wayland_keymap_iter(struct xkb_keymap *keymap, xkb_keycode_t key, void *data)
}
if (WAYLAND_xkb_keymap_key_get_syms_by_level(keymap, key, sdlKeymap->layout, 0, &syms) > 0) {
- uint32_t keycode = WAYLAND_xkb_keysym_to_utf32(syms[0]);
+ uint32_t keycode = SDL_KeySymToUcs4(syms[0]);
if (keycode) {
sdlKeymap->keymap[scancode] = keycode;
} else {
diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c
index bcc994f9f..2d8c24ccc 100644
--- a/src/video/x11/SDL_x11keyboard.c
+++ b/src/video/x11/SDL_x11keyboard.c
@@ -31,7 +31,7 @@
#include <X11/keysym.h>
#include <X11/XKBlib.h>
-#include "imKStoUCS.h"
+#include "../../events/imKStoUCS.h"
#ifdef X_HAVE_UTF8_STRING
#include <locale.h>
@@ -205,7 +205,7 @@ X11_KeyCodeToUcs4(_THIS, KeyCode keycode, unsigned char group)
return 0;
}
- return X11_KeySymToUcs4(keysym);
+ return SDL_KeySymToUcs4(keysym);
}
KeySym
--
2.32.0

View File

@ -1,24 +0,0 @@
From 9b74623be9a4dc97bac905c69bea042df6e0b1ac Mon Sep 17 00:00:00 2001
From: Ethan Lee <flibitijibibo@gmail.com>
Date: Wed, 22 Sep 2021 13:52:36 -0400
Subject: [PATCH 2/2] wayland: Woops, forgot to assign cursor theme size...
---
src/video/wayland/SDL_waylandmouse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 23663ebe1..ead346ee2 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -95,6 +95,7 @@ wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float
return SDL_FALSE;
}
theme = WAYLAND_wl_cursor_theme_load(NULL, size, vdata->shm);
+ vdata->cursor_themes[vdata->num_cursor_themes].size = size;
vdata->cursor_themes[vdata->num_cursor_themes++].theme = theme;
}
--
2.32.0

View File

@ -1,41 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26fe83205..9b7ae7098 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2662,15 +2662,15 @@ endif()
##### Installation targets #####
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
##### Export files #####
if (WINDOWS)
set(PKG_PREFIX "cmake")
else ()
- set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/SDL2")
+ set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2")
endif ()
include(CMakePackageConfigHelpers)
@@ -2717,7 +2717,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW))
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\"
WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")")
- install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}")
+ install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()
if(FREEBSD)
@@ -2725,7 +2725,7 @@ if(NOT (WINDOWS OR CYGWIN OR MINGW))
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig")
else()
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
- DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/pkgconfig")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif()
install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}")
# TODO: what about the .spec file? Is it only needed for RPM creation?

View File

@ -9,8 +9,8 @@
%global libdecor_majver 0
Name: SDL2
Version: 2.0.16
Release: 4%{?dist}
Version: 2.0.18
Release: 1%{?dist}
Summary: Cross-platform multimedia library
License: zlib and MIT
URL: http://www.libsdl.org/
@ -23,21 +23,6 @@ Patch0: multilib.patch
Patch1: SDL2-2.0.9-khrplatform.patch
# Backports from upstream
## Fix CMake GNUInstallDirs usage
Patch0010: SDL2-2.0.16-PR4622.patch
## Support legacy 'pulse' alias for PulseAudio driver
Patch0011: 0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch
## Add support for HiDPI cursors on Wayland
Patch0012: 0001-wayland-Add-support-for-high-DPI-cursors.patch
Patch0013: 0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch
## Fix handling of Ctrl key on Wayland
Patch0014: 0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch
## Fix keymap support on Wayland (rhbz#2007969)
Patch0015: 0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch
## Use EGL_EXT_present_opaque when available on Wayland
Patch0016: 0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch
## Expose xdg_toplevel to SysWM on Wayland
Patch0017: 0001-wayland-Expose-xdg_toplevel-to-SysWM.patch
BuildRequires: git-core
BuildRequires: cmake
@ -135,6 +120,7 @@ export LDFLAGS="%{shrink:%{build_ldflags}}"
-DSSE3=OFF \
-DRPATH=OFF \
-DSDL_STATIC=ON \
-DSDL_STATIC_PIC=ON \
%ifarch ppc64le
-DALTIVEC=OFF \
%endif
@ -174,6 +160,9 @@ install -p -m 644 %{SOURCE2} %{buildroot}%{_includedir}/SDL2/SDL_revision.h
%{_libdir}/lib*.a
%changelog
* Wed Dec 01 2021 Neal Gompa <ngompa@fedoraproject.org> - 2.0.18-1
- Update to 2.0.18
* Wed Oct 6 2021 Tom Callaway <spot@fedoraproject.org> - 2.0.16-4
- fix multilib conflict with SDL_revision.h (bz 2008838)

View File

@ -1 +1 @@
SHA512 (SDL2-2.0.16.tar.gz) = ec75ef8526792650c2647b78bb0244f973774418aeae33a2182d90ce696b30acb652f8be9c2012a16c1c5d5622f7630ff2e1eadae27ea3dc78ab47730cf5e62f
SHA512 (SDL2-2.0.18.tar.gz) = 8688b855ce15d574fb0726dd2a44109bb7b34d81c652c51025a32bf7eb7015ceb685834cf9fc3f97a2f5f5a3203f548ce6845420fafae7e5dc6bb9d11ce1740d