From c105540bb10df5d29a101f593f2a3801c1fa0799 Mon Sep 17 00:00:00 2001 From: gernot steinegger 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;