Merge pull request #1825 from fewtarius/dev
Bump SDL to 2.28.1, always clean SDL2-rotated.
This commit is contained in:
commit
9be00bf390
6 changed files with 106 additions and 219 deletions
|
@ -50,7 +50,7 @@
|
|||
# a BSP kernel and a rotated display when using DEVICE_ROOT.
|
||||
if [ -n "${DEVICE_ROOT}" ]
|
||||
then
|
||||
CLEAN_DEVICE_ROOT="linux u-boot SDL2 retroarch mupen64plus-sa-input-sdl flycast-sa duckstation-sa drastic-sa fileman oga_controls"
|
||||
CLEAN_DEVICE_ROOT="linux u-boot SDL2 SDL2-rotated retroarch mupen64plus-sa-input-sdl flycast-sa duckstation-sa drastic-sa fileman oga_controls"
|
||||
fi
|
||||
|
||||
# additional drivers to install:
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 26fe83205..32a339b05 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -557,7 +557,7 @@ if(USE_GCC OR USE_CLANG)
|
||||
diff -rupN SDL2.orig/CMakeLists.txt SDL2/CMakeLists.txt
|
||||
--- SDL2.orig/CMakeLists.txt 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/CMakeLists.txt 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -663,7 +663,7 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC)
|
||||
check_c_compiler_flag("" HAVE_NO_UNDEFINED)
|
||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||
if(HAVE_NO_UNDEFINED AND NOT (USE_CLANG AND WINDOWS))
|
||||
|
@ -10,12 +9,11 @@ index 26fe83205..32a339b05 100644
|
|||
+ list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,--no-undefined -lrga")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 65ccc55..bf4e3aa 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -22,7 +22,7 @@ CC = @CC@
|
||||
|
||||
diff -rupN SDL2.orig/Makefile.in SDL2/Makefile.in
|
||||
--- SDL2.orig/Makefile.in 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/Makefile.in 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -23,7 +23,7 @@ CXX = @CXX@
|
||||
INCLUDE = @INCLUDE@
|
||||
CFLAGS = @BUILD_CFLAGS@
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
|
@ -24,11 +22,10 @@ index 65ccc55..bf4e3aa 100644
|
|||
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
INSTALL = @INSTALL@
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
index 017372c..cff1b25 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
@@ -29,10 +29,14 @@
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmopengles.c SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmopengles.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmopengles.c 2023-07-26 10:30:42.776858597 +0000
|
||||
@@ -29,11 +29,15 @@
|
||||
#include "SDL_kmsdrmopengles.h"
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
#include <errno.h>
|
||||
|
@ -37,13 +34,14 @@ index 017372c..cff1b25 100644
|
|||
#ifndef EGL_PLATFORM_GBM_MESA
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif
|
||||
+
|
||||
|
||||
+extern rga_info_t src_info;
|
||||
+extern rga_info_t dst_info;
|
||||
|
||||
+
|
||||
/* EGL implementation of SDL OpenGL support */
|
||||
|
||||
@@ -92,6 +96,7 @@
|
||||
void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
|
||||
@@ -92,6 +96,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Wi
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
KMSDRM_FBInfo *fb_info;
|
||||
int ret = 0;
|
||||
|
@ -51,39 +49,38 @@ index 017372c..cff1b25 100644
|
|||
|
||||
/* Always wait for the previous issued flip before issuing a new one,
|
||||
even if you do async flips. */
|
||||
@@ -135,7 +140,26 @@
|
||||
@@ -135,7 +140,26 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Wi
|
||||
}
|
||||
|
||||
/* Get an actual usable fb for the next front buffer. */
|
||||
- fb_info = KMSDRM_FBFromBO(_this, windata->next_bo);
|
||||
+ if (src_info.fd) {
|
||||
+ close(src_info.fd);
|
||||
+ }
|
||||
+ src_info.fd = KMSDRM_gbm_bo_get_fd(windata->next_bo);
|
||||
+ dst_info.fd = viddata->rga_buffer_prime_fds[viddata->rga_buffer_index];
|
||||
+ if (c_RkRgaBlit(&src_info, &dst_info, NULL) < 0) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO,
|
||||
+ "Failed to rga blit\n");
|
||||
+ }
|
||||
+ if (src_info.fd) {
|
||||
+ close(src_info.fd);
|
||||
+ }
|
||||
+ src_info.fd = KMSDRM_gbm_bo_get_fd(windata->next_bo);
|
||||
+ dst_info.fd = viddata->rga_buffer_prime_fds[viddata->rga_buffer_index];
|
||||
+ if (c_RkRgaBlit(&src_info, &dst_info, NULL) < 0) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO,
|
||||
+ "Failed to rga blit\n");
|
||||
+ }
|
||||
+
|
||||
+ rga_buffer = viddata->rga_buffers[viddata->rga_buffer_index];
|
||||
+ fb_info = KMSDRM_FBFromBO(_this, rga_buffer);
|
||||
+ rga_buffer = viddata->rga_buffers[viddata->rga_buffer_index];
|
||||
+ fb_info = KMSDRM_FBFromBO(_this, rga_buffer);
|
||||
+
|
||||
+ if (!fb_info) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ viddata->rga_buffer_index = (viddata->rga_buffer_index + 1) % RGA_BUFFERS_MAX;
|
||||
+ if (!fb_info) {
|
||||
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (!fb_info) {
|
||||
+ viddata->rga_buffer_index = (viddata->rga_buffer_index + 1) % RGA_BUFFERS_MAX;
|
||||
+
|
||||
if (fb_info == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer");
|
||||
return 0;
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmsym.h b/src/video/kmsdrm/SDL_kmsdrmsym.h
|
||||
index 6956232..6d8b3fd 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmsym.h
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmsym.h
|
||||
@@ -123,7 +123,7 @@ SDL_KMSDRM_SYM(struct gbm_surface *,gbm_surface_create,(struct gbm_device *gbm,
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmsym.h SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmsym.h 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -122,7 +122,7 @@ SDL_KMSDRM_SYM(struct gbm_surface *,gbm_
|
||||
SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf))
|
||||
SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf))
|
||||
SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo))
|
||||
|
@ -92,10 +89,9 @@ index 6956232..6d8b3fd 100644
|
|||
|
||||
#undef SDL_KMSDRM_MODULE
|
||||
#undef SDL_KMSDRM_SYM
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
index f7e7648..144f8f9 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.c SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.c 2023-07-26 10:33:34.282693634 +0000
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "SDL_kmsdrmopengles.h"
|
||||
#include "SDL_kmsdrmmouse.h"
|
||||
|
@ -111,18 +107,18 @@ index f7e7648..144f8f9 100644
|
|||
+#include<stdbool.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
static SDL_bool openbsd69orgreater = SDL_FALSE;
|
||||
@@ -70,6 +72,9 @@
|
||||
#ifndef EGL_PLATFORM_GBM_MESA
|
||||
static SDL_bool moderndri = SDL_FALSE;
|
||||
@@ -68,6 +70,9 @@ static char kmsdrm_dri_cardpath[32];
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif
|
||||
+
|
||||
|
||||
+rga_info_t src_info = {0};
|
||||
+rga_info_t dst_info = {0};
|
||||
|
||||
static int
|
||||
check_modestting(int devindex)
|
||||
@@ -330,6 +335,46 @@
|
||||
+
|
||||
static int get_driindex(void)
|
||||
{
|
||||
int available = -ENOENT;
|
||||
@@ -330,6 +335,46 @@ static void KMSDRM_FBDestroyCallback(str
|
||||
SDL_free(fb_info);
|
||||
}
|
||||
|
||||
|
@ -166,10 +162,10 @@ index f7e7648..144f8f9 100644
|
|||
+ rga_set_rect(&dst_info.rect, 0, 0, frameWidth, frameHeight, frameWidth, frameHeight, RK_FORMAT_BGRA_8888);
|
||||
+}
|
||||
+
|
||||
KMSDRM_FBInfo *
|
||||
KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
|
||||
KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
|
||||
{
|
||||
@@ -687,8 +732,8 @@
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
@@ -848,8 +893,8 @@ static void KMSDRM_AddDisplay(_THIS, drm
|
||||
modedata->mode_index = mode_index;
|
||||
|
||||
display.driverdata = dispdata;
|
||||
|
@ -180,7 +176,7 @@ index f7e7648..144f8f9 100644
|
|||
display.desktop_mode.refresh_rate = dispdata->mode.vrefresh;
|
||||
display.desktop_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
display.desktop_mode.driverdata = modedata;
|
||||
@@ -964,7 +1009,8 @@
|
||||
@@ -1124,7 +1169,8 @@ static void KMSDRM_DirtySurfaces(SDL_Win
|
||||
or SetWindowFullscreen, send a fake event for now since the actual
|
||||
recreation is deferred */
|
||||
KMSDRM_GetModeToSet(window, &mode);
|
||||
|
@ -190,7 +186,7 @@ index f7e7648..144f8f9 100644
|
|||
}
|
||||
|
||||
/* This determines the size of the fb, which comes from the GBM surface
|
||||
@@ -1000,13 +1046,13 @@
|
||||
@@ -1159,13 +1205,13 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Win
|
||||
mode that's set in sync with what SDL_video.c thinks is set */
|
||||
KMSDRM_GetModeToSet(window, &dispdata->mode);
|
||||
|
||||
|
@ -202,12 +198,12 @@ index f7e7648..144f8f9 100644
|
|||
display->current_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
|
||||
windata->gs = KMSDRM_gbm_surface_create(viddata->gbm_dev,
|
||||
- dispdata->mode.hdisplay, dispdata->mode.vdisplay,
|
||||
+ dispdata->mode.vdisplay, dispdata->mode.hdisplay,
|
||||
surface_fmt, surface_flags);
|
||||
- dispdata->mode.hdisplay, dispdata->mode.vdisplay,
|
||||
+ dispdata->mode.vdisplay, dispdata->mode.hdisplay,
|
||||
surface_fmt, surface_flags);
|
||||
|
||||
if (!windata->gs) {
|
||||
@@ -1030,7 +1076,7 @@
|
||||
@@ -1189,7 +1235,7 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Win
|
||||
ret = SDL_EGL_MakeCurrent(_this, windata->egl_surface, egl_context);
|
||||
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
|
||||
|
@ -216,7 +212,7 @@ index f7e7648..144f8f9 100644
|
|||
|
||||
windata->egl_surface_dirty = SDL_FALSE;
|
||||
|
||||
@@ -1116,8 +1162,8 @@
|
||||
@@ -1272,8 +1318,8 @@ void KMSDRM_GetDisplayModes(_THIS, SDL_V
|
||||
modedata->mode_index = i;
|
||||
}
|
||||
|
||||
|
@ -227,7 +223,7 @@ index f7e7648..144f8f9 100644
|
|||
mode.refresh_rate = conn->modes[i].vrefresh;
|
||||
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||
mode.driverdata = modedata;
|
||||
@@ -1229,6 +1275,13 @@
|
||||
@@ -1386,6 +1432,13 @@ void KMSDRM_DestroyWindow(_THIS, SDL_Win
|
||||
/*********************************************************************/
|
||||
SDL_free(window->driverdata);
|
||||
window->driverdata = NULL;
|
||||
|
@ -241,7 +237,7 @@ index f7e7648..144f8f9 100644
|
|||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@@ -1248,6 +1301,7 @@
|
||||
@@ -1404,6 +1457,7 @@ int KMSDRM_CreateWindow(_THIS, SDL_Windo
|
||||
NativeDisplayType egl_display;
|
||||
drmModeModeInfo *mode;
|
||||
int ret = 0;
|
||||
|
@ -249,7 +245,7 @@ index f7e7648..144f8f9 100644
|
|||
|
||||
/* Allocate window internal data */
|
||||
windata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
|
||||
@@ -1356,6 +1410,9 @@
|
||||
@@ -1519,6 +1573,9 @@ int KMSDRM_CreateWindow(_THIS, SDL_Windo
|
||||
SDL_SetMouseFocus(window);
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
|
@ -259,11 +255,9 @@ index f7e7648..144f8f9 100644
|
|||
/* Tell the app that the window has moved to top-left. */
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0);
|
||||
|
||||
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
|
||||
index 566fc85..10519e9 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.h SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmvideo.h 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmvideo.h 2023-07-26 10:28:57.254787571 +0000
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <xf86drmMode.h>
|
||||
#include <gbm.h>
|
||||
|
@ -285,4 +279,4 @@ index 566fc85..10519e9 100644
|
|||
+
|
||||
} SDL_VideoData;
|
||||
|
||||
|
||||
typedef struct SDL_DisplayModeData
|
||||
|
|
|
@ -1,30 +1,20 @@
|
|||
From e3faf45fbcf6d274243d5dd1edbd59cfdfa7636a Mon Sep 17 00:00:00 2001
|
||||
From: Johnny on Flame <johnnyonflame@hotmail.com>
|
||||
Date: Tue, 15 Feb 2022 02:17:17 -0300
|
||||
Subject: [PATCH] KMSDRM: Also rotate the cursor.
|
||||
|
||||
---
|
||||
src/video/kmsdrm/SDL_kmsdrmmouse.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c
|
||||
index b22fc8e..c9d7700 100644
|
||||
--- a/src/video/kmsdrm/SDL_kmsdrmmouse.c
|
||||
+++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c
|
||||
@@ -156,6 +156,7 @@
|
||||
diff -rupN SDL2.orig/src/video/kmsdrm/SDL_kmsdrmmouse.c SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c
|
||||
--- SDL2.orig/src/video/kmsdrm/SDL_kmsdrmmouse.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2/src/video/kmsdrm/SDL_kmsdrmmouse.c 2023-07-26 10:27:12.232726116 +0000
|
||||
@@ -150,6 +150,7 @@ static int KMSDRM_DumpCursorToBO(SDL_Vid
|
||||
uint8_t *src_row;
|
||||
|
||||
int i;
|
||||
+ int j;
|
||||
int ret;
|
||||
|
||||
if (!curdata || !dispdata->cursor_bo) {
|
||||
@@ -176,8 +177,10 @@
|
||||
if (curdata == NULL || !dispdata->cursor_bo) {
|
||||
@@ -170,8 +171,10 @@ static int KMSDRM_DumpCursorToBO(SDL_Vid
|
||||
|
||||
/* Copy from the cursor buffer to a buffer that we can dump to the GBM BO. */
|
||||
for (i = 0; i < curdata->h; i++) {
|
||||
- src_row = &((uint8_t*)curdata->buffer)[i * curdata->w * 4];
|
||||
- SDL_memcpy(ready_buffer + (i * bo_stride), src_row, 4 * curdata->w);
|
||||
- src_row = &((uint8_t *)curdata->buffer)[i * curdata->w * 4];
|
||||
- SDL_memcpy(ready_buffer + (i * bo_stride), src_row, (size_t)4 * curdata->w);
|
||||
+ for (j = 0; j < curdata->w; j++) {
|
||||
+ src_row = ((uint32_t*)curdata->buffer)[i * curdata->w + j];
|
||||
+ SDL_memcpy(ready_buffer + ((curdata->w - j + 1) * bo_stride) + i, &src_row, 4);
|
||||
|
@ -32,31 +22,15 @@ index b22fc8e..c9d7700 100644
|
|||
}
|
||||
|
||||
/* Dump the cursor buffer to our GBM BO. */
|
||||
@@ -216,10 +216,10 @@ KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
|
||||
bo_handle = KMSDRM_gbm_bo_get_handle(dispdata->cursor_bo).u32;
|
||||
if (curdata->hot_x == 0 && curdata->hot_y == 0) {
|
||||
ret = KMSDRM_drmModeSetCursor(viddata->drm_fd, dispdata->crtc->crtc_id,
|
||||
- bo_handle, dispdata->cursor_w, dispdata->cursor_h);
|
||||
+ bo_handle, dispdata->cursor_h, dispdata->cursor_w);
|
||||
} else {
|
||||
ret = KMSDRM_drmModeSetCursor2(viddata->drm_fd, dispdata->crtc->crtc_id,
|
||||
- bo_handle, dispdata->cursor_w, dispdata->cursor_h, curdata->hot_x, curdata->hot_y);
|
||||
+ bo_handle, dispdata->cursor_h, dispdata->cursor_w, curdata->hot_y, (curdata->w - curdata->hot_x + 1));
|
||||
}
|
||||
@@ -370,6 +373,7 @@ static int KMSDRM_WarpMouseGlobal(int x,
|
||||
|
||||
if (ret) {
|
||||
@@ -417,9 +417,9 @@ KMSDRM_WarpMouseGlobal(int x, int y)
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
if (mouse && mouse->cur_cursor && mouse->focus) {
|
||||
-
|
||||
SDL_Window *window = mouse->focus;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayForWindow(window)->driverdata;
|
||||
+ KMSDRM_CursorData *curdata = mouse->cur_cursor->driverdata;
|
||||
|
||||
/* Update internal mouse position. */
|
||||
SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
|
||||
@@ -428,7 +428,7 @@ KMSDRM_WarpMouseGlobal(int x, int y)
|
||||
@@ -378,7 +382,7 @@ static int KMSDRM_WarpMouseGlobal(int x,
|
||||
if (dispdata->cursor_bo) {
|
||||
int ret = 0;
|
||||
|
||||
|
@ -65,13 +39,10 @@ index b22fc8e..c9d7700 100644
|
|||
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
@@ -484,16 +484,16 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
|
||||
/* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity!
|
||||
That's why we move the cursor graphic ONLY. */
|
||||
if (mouse && mouse->cur_cursor && mouse->focus) {
|
||||
-
|
||||
@@ -432,13 +436,14 @@ static void KMSDRM_MoveCursor(SDL_Cursor
|
||||
|
||||
SDL_Window *window = mouse->focus;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayForWindow(window)->driverdata;
|
||||
+ KMSDRM_CursorData *curdata = mouse->cur_cursor->driverdata;
|
||||
|
||||
if (!dispdata->cursor_bo) {
|
||||
|
@ -84,6 +55,4 @@ index b22fc8e..c9d7700 100644
|
|||
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
--
|
||||
2.30.2
|
||||
|
||||
Binary files SDL2.orig/src/video/kmsdrm/.SDL_kmsdrmmouse.c.rej.swp and SDL2/src/video/kmsdrm/.SDL_kmsdrmmouse.c.rej.swp differ
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2022-present Fewtarius
|
||||
|
||||
PKG_NAME="SDL2"
|
||||
PKG_VERSION="2.26.5"
|
||||
PKG_VERSION="2.28.1"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://www.libsdl.org/"
|
||||
PKG_URL="https://www.libsdl.org/release/SDL2-${PKG_VERSION}.tar.gz"
|
||||
|
@ -55,7 +55,7 @@ then
|
|||
PKG_DEPENDS_TARGET+=" wayland ${WINDOWMANAGER}"
|
||||
PKG_CMAKE_OPTS_TARGET+=" -DSDL_WAYLAND=ON \
|
||||
-DVIDEO_WAYLAND=ON \
|
||||
-DVIDEO_WAYLAND_QT_TOUCH=OFF \
|
||||
-DVIDEO_WAYLAND_QT_TOUCH=ON \
|
||||
-DWAYLAND_SHARED=ON \
|
||||
-DVIDEO_X11=OFF \
|
||||
-DSDL_X11=OFF"
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
|
||||
index d8210d5fa..4e932f9c7 100644
|
||||
--- a/src/events/SDL_touch.c
|
||||
+++ b/src/events/SDL_touch.c
|
||||
@@ -35,6 +35,7 @@ static SDL_Touch **SDL_touchDevices = NULL;
|
||||
diff -rupN SDL2.orig/src/events/SDL_touch.c SDL2-2.28.1/src/events/SDL_touch.c
|
||||
--- SDL2.orig/src/events/SDL_touch.c 2023-07-01 17:04:05.000000000 +0000
|
||||
+++ SDL2-2.28.1/src/events/SDL_touch.c 2023-07-26 00:04:30.039436068 +0000
|
||||
@@ -34,6 +34,7 @@ static SDL_Touch **SDL_touchDevices = NU
|
||||
#define SYNTHESIZE_TOUCH_TO_MOUSE 1
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
+static SDL_bool cursor_init = SDL_FALSE;
|
||||
static SDL_bool finger_touching = SDL_FALSE;
|
||||
static SDL_FingerID track_fingerid;
|
||||
static SDL_TouchID track_touchid;
|
||||
@@ -261,6 +262,11 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
static SDL_TouchID track_touchid;
|
||||
@@ -245,6 +246,11 @@ int SDL_SendTouch(SDL_TouchID id, SDL_Fi
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -22,7 +21,7 @@ index d8210d5fa..4e932f9c7 100644
|
|||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -275,6 +281,13 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
@@ -259,6 +265,13 @@ int SDL_SendTouch(SDL_TouchID id, SDL_Fi
|
||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
if (window) {
|
||||
|
@ -36,23 +35,23 @@ index d8210d5fa..4e932f9c7 100644
|
|||
if (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
@@ -283,12 +296,12 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
@@ -275,12 +288,12 @@ int SDL_SendTouch(SDL_TouchID id, SDL_Fi
|
||||
if (pos_y > window->h - 1) {
|
||||
pos_y = window->h - 1;
|
||||
}
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
} else {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,6 +396,11 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
@@ -374,6 +387,11 @@ int SDL_SendTouchMotion(SDL_TouchID id,
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -64,12 +63,12 @@ index d8210d5fa..4e932f9c7 100644
|
|||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -398,7 +416,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
@@ -397,7 +415,7 @@ int SDL_SendTouchMotion(SDL_TouchID id,
|
||||
if (pos_y > window->h - 1) {
|
||||
pos_y = window->h - 1;
|
||||
}
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
|
||||
index d8210d5fa..4e932f9c7 100644
|
||||
--- a/src/events/SDL_touch.c
|
||||
+++ b/src/events/SDL_touch.c
|
||||
@@ -35,6 +35,7 @@ static SDL_Touch **SDL_touchDevices = NULL;
|
||||
#define SYNTHESIZE_TOUCH_TO_MOUSE 1
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
+static SDL_bool cursor_init = SDL_FALSE;
|
||||
static SDL_bool finger_touching = SDL_FALSE;
|
||||
static SDL_FingerID track_fingerid;
|
||||
static SDL_TouchID track_touchid;
|
||||
@@ -261,6 +262,11 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!window) {
|
||||
+ // Fallback to the main application window.
|
||||
+ window = SDL_GetWindowFromID(1);
|
||||
+ }
|
||||
+
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -275,6 +281,13 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
if (window) {
|
||||
+ if (cursor_init == SDL_FALSE) {
|
||||
+ // TODO - Initialization hack to reset cursor position to <0, 0>
|
||||
+ SDL_SendMouseMotion(window, 0, SDL_TRUE, -window->w, -window->h);
|
||||
+ mouse->x = 0; mouse->y = 0;
|
||||
+ x = 0.0f; y = 0.0f;
|
||||
+ cursor_init = SDL_TRUE;
|
||||
+ }
|
||||
if (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
@@ -283,12 +296,12 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
} else {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
- SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
+ SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,6 +396,11 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (!window) {
|
||||
+ // Fallback to the main application window.
|
||||
+ window = SDL_GetWindowFromID(1);
|
||||
+ }
|
||||
+
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
@@ -398,7 +416,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
- SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
+ SDL_SendMouseMotion(window, 0, 0, pos_x, pos_y);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue