From 69a3a0f77e93f1a5b84a29932f47830103ef019d Mon Sep 17 00:00:00 2001 From: Rmys Date: Mon, 11 Oct 2021 14:55:32 +0300 Subject: [PATCH] libsdl2-2.0.16 --- multimedia/misc/libsdl2/actions.py | 2 +- multimedia/misc/libsdl2/files/25cd749.patch | 52 +++ ...ort-pulse-as-an-alias-for-pulseaudio.patch | 48 +++ ...e-EGL_EXT_present_opaque-when-availa.patch | 53 +++ ...and-Add-support-for-high-DPI-cursors.patch | 393 ++++++++++++++++++ ...wayland-Expose-xdg_toplevel-to-SysWM.patch | 75 ++++ ...-ignore-key-events-when-Ctrl-is-held.patch | 26 ++ ...ySymToUcs4-to-replicate-X11-keymap-b.patch | 104 +++++ ...s-forgot-to-assign-cursor-theme-size.patch | 24 ++ multimedia/misc/libsdl2/pspec.xml | 102 +++-- 10 files changed, 824 insertions(+), 55 deletions(-) create mode 100644 multimedia/misc/libsdl2/files/25cd749.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-wayland-Add-support-for-high-DPI-cursors.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch create mode 100644 multimedia/misc/libsdl2/files/fedora/0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch diff --git a/multimedia/misc/libsdl2/actions.py b/multimedia/misc/libsdl2/actions.py index ec141ae87d..cae58ba4c0 100755 --- a/multimedia/misc/libsdl2/actions.py +++ b/multimedia/misc/libsdl2/actions.py @@ -53,4 +53,4 @@ def install(): libtools.preplib() - pisitools.dodoc("BUGS.txt", "CREDITS.txt", "COPYING.txt", "README.txt", "README-SDL.txt", "TODO.txt", "WhatsNew.txt") + pisitools.dodoc("BUGS.txt", "CREDITS.txt", "README*", "README-SDL.txt", "TODO.txt", "WhatsNew.txt") diff --git a/multimedia/misc/libsdl2/files/25cd749.patch b/multimedia/misc/libsdl2/files/25cd749.patch new file mode 100644 index 0000000000..550df81631 --- /dev/null +++ b/multimedia/misc/libsdl2/files/25cd749.patch @@ -0,0 +1,52 @@ +From 25cd749adba77e1a6f3f31f80f8768c0aaaad5b0 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Thu, 12 Aug 2021 15:12:04 +0100 +Subject: [PATCH] x11: Don't change mode if we are already in the correct mode + +If we are already in the desired mode, changing it is a no-op at best, +and harmful at worst: on Xwayland, it sometimes happens that we disable +the crtc and cannot re-enable it. + +Resolves: https://github.com/libsdl-org/SDL/issues/4630 +Signed-off-by: Simon McVittie +--- + src/video/x11/SDL_x11modes.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c +index 8a9cf56ed3..da520e3115 100644 +--- a/src/video/x11/SDL_x11modes.c ++++ b/src/video/x11/SDL_x11modes.c +@@ -1040,11 +1040,20 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode + return SDL_SetError("Couldn't get XRandR crtc info"); + } + ++ if (crtc->mode == modedata->xrandr_mode) { ++#ifdef X11MODES_DEBUG ++ printf("already in desired mode 0x%lx (%ux%u), nothing to do\n", ++ crtc->mode, crtc->width, crtc->height); ++#endif ++ status = Success; ++ goto freeInfo; ++ } ++ + X11_XGrabServer(display); + status = X11_XRRSetCrtcConfig(display, res, output_info->crtc, CurrentTime, + 0, 0, None, crtc->rotation, NULL, 0); + if (status != Success) { +- goto setCrtcError; ++ goto ungrabServer; + } + + mm_width = mode->w * DisplayWidthMM(display, data->screen) / DisplayWidth(display, data->screen); +@@ -1067,8 +1076,9 @@ X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode + crtc->x, crtc->y, modedata->xrandr_mode, crtc->rotation, + &data->xrandr_output, 1); + +-setCrtcError: ++ungrabServer: + X11_XUngrabServer(display); ++freeInfo: + X11_XRRFreeCrtcInfo(crtc); + X11_XRRFreeOutputInfo(output_info); + X11_XRRFreeScreenResources(res); diff --git a/multimedia/misc/libsdl2/files/fedora/0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch b/multimedia/misc/libsdl2/files/fedora/0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch new file mode 100644 index 0000000000..b8fee07199 --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch @@ -0,0 +1,48 @@ +From 3261f7f6ceaaa435a3aca0252b2f7126eeae1bb2 Mon Sep 17 00:00:00 2001 +From: David Gow +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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch b/multimedia/misc/libsdl2/files/fedora/0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch new file mode 100644 index 0000000000..6f54c48efd --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch @@ -0,0 +1,53 @@ +From 5113fedfa0e8592048a66cf8f852a59441e8bc9c Mon Sep 17 00:00:00 2001 +From: Eric Engestrom +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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0001-wayland-Add-support-for-high-DPI-cursors.patch b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Add-support-for-high-DPI-cursors.patch new file mode 100644 index 0000000000..21a6bf0118 --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Add-support-for-high-DPI-cursors.patch @@ -0,0 +1,393 @@ +From 8e54698aa6e3c0cf02d0b628403f047f28ea7fd0 Mon Sep 17 00:00:00 2001 +From: Ethan Lee +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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch new file mode 100644 index 0000000000..1280a364aa --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch @@ -0,0 +1,75 @@ +From b592e78f93b1e698b981ecf5af90e48e52e6387e Mon Sep 17 00:00:00 2001 +From: Cacodemon345 +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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch b/multimedia/misc/libsdl2/files/fedora/0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch new file mode 100644 index 0000000000..7d0ddcc5b3 --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch @@ -0,0 +1,26 @@ +From 1a4e2e5ef7425d44a0faa4ad5535e69f7c0b962c Mon Sep 17 00:00:00 2001 +From: Ethan Lee +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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch new file mode 100644 index 0000000000..380676735c --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch @@ -0,0 +1,104 @@ +From 7ed415d2edfa44e554605a0b5616c836680756ed Mon Sep 17 00:00:00 2001 +From: Ethan Lee +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 ++#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 + #include + #include ++#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 + #include + +-#include "imKStoUCS.h" ++#include "../../events/imKStoUCS.h" + + #ifdef X_HAVE_UTF8_STRING + #include +@@ -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 + diff --git a/multimedia/misc/libsdl2/files/fedora/0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch b/multimedia/misc/libsdl2/files/fedora/0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch new file mode 100644 index 0000000000..e125a59297 --- /dev/null +++ b/multimedia/misc/libsdl2/files/fedora/0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch @@ -0,0 +1,24 @@ +From 9b74623be9a4dc97bac905c69bea042df6e0b1ac Mon Sep 17 00:00:00 2001 +From: Ethan Lee +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 + diff --git a/multimedia/misc/libsdl2/pspec.xml b/multimedia/misc/libsdl2/pspec.xml index f65f342352..8c0e9bda77 100755 --- a/multimedia/misc/libsdl2/pspec.xml +++ b/multimedia/misc/libsdl2/pspec.xml @@ -1,70 +1,76 @@ - - libsdl2 http://www.libsdl.org/ - Mathias Freire - mathiasfreire45@gmail.com + Mustafa Cinasal + muscnsl@gmail.com LGPLv2.1 library Simple Direct Media Layer 2.0 series libsdl is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. - https://www.libsdl.org/release/SDL2-2.0.14.tar.gz + https://www.libsdl.org/release/SDL2-2.0.16.tar.gz - dbus-devel - ibus-devel - libglvnd-devel - libXv-devel - libXt-devel - libX11-devel - libXext-devel DirectFB-devel - mesa-glu-devel alsa-lib-devel audiofile-devel + dbus-devel + ibus-devel + libX11-devel + libXext-devel + libXinerama-devel libXrandr-devel libXrender-devel - libXinerama-devel + libXt-devel + libXv-devel + libglvnd-devel + mesa-glu-devel pulseaudio-libs-devel + + 25cd749.patch + fedora/0001-audio-Support-pulse-as-an-alias-for-pulseaudio.patch + fedora/0001-video-wayland-use-EGL_EXT_present_opaque-when-availa.patch + fedora/0001-wayland-Add-support-for-high-DPI-cursors.patch + fedora/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch + fedora/0001-wayland-For-text-ignore-key-events-when-Ctrl-is-held.patch + fedora/0001-wayland-Reuse-KeySymToUcs4-to-replicate-X11-keymap-b.patch + fedora/0002-wayland-Woops-forgot-to-assign-cursor-theme-size.patch + - - libsdl2-docs + libsdl2 libsdl2 reference documents libsdl2 - /usr/share/man /usr/share/doc + /usr/share/man - libsdl2 + libsdl2 reference documents - libglvnd - libXt - libX11 - libXext DirectFB alsa-lib audiofile + libX11 + libXScrnSaver + libXext + libXinerama libXrandr libXrender - libXinerama - libXScrnSaver + libXt + libglvnd pulseaudio-libs /usr/lib - libsdl2-devel Development files for libsdl2 @@ -74,54 +80,42 @@ /usr/bin /usr/include - /usr/share/aclocal - /usr/lib/pkgconfig - /usr/lib32/pkgconfig /usr/lib/libSDL2main.a + /usr/lib/pkgconfig /usr/lib32/libSDL2main.a + /usr/lib32/pkgconfig + /usr/share/aclocal - libsdl2-32bit - emul32 32-bit shared libraries for libsdl2 - emul32 - - libglvnd-32bit - libXt-32bit - libX11-32bit - libXext-32bit - alsa-lib-32bit - audiofile-32bit - libXrandr-32bit - libXrender-32bit - libXinerama-32bit - libXScrnSaver-32bit - pulseaudio-libs-32bit - - libglvnd-32bit - libXt-32bit - libX11-32bit - libXext-32bit alsa-lib-32bit audiofile-32bit + libX11-32bit + libXScrnSaver-32bit + libXext-32bit + libXinerama-32bit libXrandr-32bit libXrender-32bit - libXinerama-32bit - libXScrnSaver-32bit - libXScrnSaver-32bit - pulseaudio-libs-32bit - + libXt-32bit + libglvnd-32bit libsdl2 + pulseaudio-libs-32bit /usr/lib32 - + + 2021-10-11 + 2.0.16 + Version bump. + Mustafa Cinasal + muscnsl@gmail.com + 2021-05-08 2.0.14