pygame: apply fix for SDL CreateWindowFrom in module.

This commit is contained in:
Ark74 2024-03-31 22:13:36 -06:00
parent 46e3d5e4e2
commit 4ef822a84f
3 changed files with 35 additions and 3 deletions

View file

@ -0,0 +1,26 @@
From c105540bb10df5d29a101f593f2a3801c1fa0799 Mon Sep 17 00:00:00 2001
From: gernot steinegger <gernot.steinegger@gmail.com>
Date: Sun, 9 Jan 2022 13:01:25 +0100
Subject: [PATCH] "SDL_CreateWindowFrom" in "display" module
if the environment variable "SDL_WINDOWID" is set, use "SDL_CreateWindowFrom" to create the window in "display.set_mode"
---
src_c/display.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src_c/display.c b/src_c/display.c
index d37c29765a..26f07f77e9 100644
--- a/src_c/display.c
+++ b/src_c/display.c
@@ -1096,7 +1096,10 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
if (!win) {
/*open window*/
- win = SDL_CreateWindow(title, x, y, w_1, h_1, sdl_flags);
+ const char *window_handle = SDL_getenv("SDL_WINDOWID");
+ win = window_handle
+ ? SDL_CreateWindowFrom((const void*)atoll(window_handle))
+ : SDL_CreateWindow(title, x, y, w_1, h_1, sdl_flags);
if (!win)
return RAISE(pgExc_SDLError, SDL_GetError());
init_flip = 1;

View file

@ -17,13 +17,19 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=0
VERSION=1
BUILD_UNTIL=11.0
. ./config
patch --no-backup-if-mismatch -p1 < $DATA/update_surface_test.patch
# 01_Rebuild to use the latest SDL support on aramo.
# 02_SDL_CreateWindowFrom in "display" module
for patch in $(ls -v ${DATA}/*.patch)
do
echo "Applying $patch"
patch --no-backup-if-mismatch -Np1 < $patch
done
changelog "Rebuild to use the latest SDL support on aramo."
changelog "Rebuild to use the latest SDL support on aramo. | Fix 'SDL_CreateWindowFrom' in 'display' module"
package