Skip to content

Commit 6a389a0

Browse files
committed
sdl3(display): handle SDL_GL_* updates
1 parent dec3aa0 commit 6a389a0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src_c/display.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,12 +2370,25 @@ pg_is_vsync(PyObject *self, PyObject *_null)
23702370
}
23712371

23722372
if (state->using_gl) {
2373+
#if SDL_VERSION_ATLEAST(3, 0, 0)
2374+
int interval;
2375+
if (!SDL_GL_GetSwapInterval(&interval)) {
2376+
return RAISE(pgExc_SDLError, SDL_GetError());
2377+
}
2378+
if (interval != 0) {
2379+
Py_RETURN_TRUE;
2380+
}
2381+
else {
2382+
Py_RETURN_FALSE;
2383+
}
2384+
#else
23732385
if (SDL_GL_GetSwapInterval() != 0) {
23742386
Py_RETURN_TRUE;
23752387
}
23762388
else {
23772389
Py_RETURN_FALSE;
23782390
}
2391+
#endif
23792392
}
23802393

23812394
Py_RETURN_FALSE;
@@ -2534,7 +2547,11 @@ pg_toggle_fullscreen(PyObject *self, PyObject *_null)
25342547
*/
25352548
if (state->using_gl) {
25362549
p_glViewport = (GL_glViewport_Func)SDL_GL_GetProcAddress("glViewport");
2550+
#if SDL_VERSION_ATLEAST(3, 0, 0)
2551+
SDL_GetWindowSizeInPixels(win, &w, &h);
2552+
#else
25372553
SDL_GL_GetDrawableSize(win, &w, &h);
2554+
#endif
25382555
}
25392556
else {
25402557
w = display_surface->surf->w;

0 commit comments

Comments
 (0)