Skip to content

Commit 2afed54

Browse files
committed
Port surflock.c to SDL3
1 parent 96c033c commit 2afed54

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src_c/meson.build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ surface = py.extension_module(
144144
endif
145145

146146
# TODO: support SDL3
147-
if sdl_api != 3
148147
surflock = py.extension_module(
149148
'surflock',
150149
'surflock.c',
@@ -153,7 +152,6 @@ surflock = py.extension_module(
153152
install: true,
154153
subdir: pg,
155154
)
156-
endif
157155

158156
# TODO: support SDL3
159157
if sdl_api != 3

src_c/surflock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ pgSurface_LockBy(pgSurfaceObject *surfobj, PyObject *lockobj)
9999
if (surf->subsurface != NULL) {
100100
pgSurface_Prep(surfobj);
101101
}
102+
#if SDL_VERSION_ATLEAST(3, 0, 0)
103+
if (!SDL_LockSurface(surf->surf)) {
104+
#else
102105
if (SDL_LockSurface(surf->surf) == -1) {
106+
#endif
103107
PyErr_SetString(PyExc_RuntimeError, "error locking surface");
104108
return 0;
105109
}

0 commit comments

Comments
 (0)