File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -375,9 +375,6 @@ _camera = py.extension_module(
375375endif
376376
377377# pygame.scrap
378-
379- # TODO: support SDL3
380- if sdl_api != 3
381378pg_scrap_link = [] # TODO: should this link logic be improved/made meson-ey?
382379if plat == ' win'
383380 pg_scrap_link += [' -luser32' , ' -lgdi32' ]
@@ -392,7 +389,6 @@ scrap = py.extension_module(
392389 install : true ,
393390 subdir : pg,
394391)
395- endif
396392
397393# optional modules
398394
Original file line number Diff line number Diff line change 2727#include <SDL3/SDL.h>
2828#else
2929#include <SDL.h>
30- #endif
31-
3230#include "SDL_syswm.h"
31+ #endif
3332
3433#include "pygame.h"
3534
Original file line number Diff line number Diff line change @@ -158,6 +158,15 @@ _create_dib_buffer(char *data, size_t *count)
158158int
159159pygame_scrap_init (void )
160160{
161+ #if SDL_VERSION_ATLEAST (3 , 0 , 0 )
162+ int retval = 0 ;
163+ window_handle = (HWND )SDL_GetPointerProperty (
164+ SDL_GetWindowProperties (pg_GetDefaultWindow ()),
165+ SDL_PROP_WINDOW_WIN32_HWND_POINTER , NULL );
166+ if (window_handle ) {
167+ retval = 1 ;
168+ }
169+ #else
161170 SDL_SysWMinfo info ;
162171 int retval = 0 ;
163172
@@ -170,6 +179,7 @@ pygame_scrap_init(void)
170179 window_handle = info .info .win .window ;
171180 retval = 1 ;
172181 }
182+ #endif
173183
174184 if (retval )
175185 _scrapinitialized = 1 ;
You can’t perform that action at this time.
0 commit comments