Description
Issue โ3619 opened by fladd at 2022-12-16 15:02:27
In Pygame 2 it is currently not possible anymore to get a "real" fullscreen OpenGL display (i.e. a fullscreen created with the SDL_WINDOW_FULLSCREEN
flag. Due to the code [here](https://github.com/pygame/pygame/blob/75f6251910b0e2e654c1554244fa1ed88186e366/src_c/display.c# L942), Pygame will always create a "desktop" fullscreen window instead (i.e. created with the SDL_WINDOW_FULLSCREEN_DESKTOP
flag) when the windows size corresponds to the entire display size.
The problem with "desktop" fullscreen windows is that under Windows 10 (and possibly under Macos as well) they are subject to the desktop compositor, which forces triple buffering. Only "real" fullscreen displays will bypass the desktop compositor and hence obey a request for double buffering (i.e. the pygame.DOUBLEBUF
flag).
This is a significant deviation from the behaviour of Pygame 1 (which only knew about "real" fullscreen displays), and hence contrary to the comment [here](https://github.com/pygame/pygame/blob/75f6251910b0e2e654c1554244fa1ed88186e366/src_c/display.c# L933), in fact does break compatibility.
Having a forced triple buffer is problematic as it has the same negative consequences for other established scientific software products that rely on Pygame, as forcing adaptive vsync does, which I have described [here](pygame/pygame#3609 issuecomment-1354954957).
Comments
# # fladd commented at 2022-12-16 15:05:06
To be clear, I am in principle fine that the defaults have changed in Pygame 2, but there should at least be a way to get the old behaviour back via an option. Currently, there is no such option.
# # MyreMylar commented at 2022-12-16 19:28:22
We could have an additional pygame flag here that forces pygame to use true full screen called something like FORCE_TRUE_FULLSCREEN
. This would then bypass this block:
if (flags & PGS_FULLSCREEN) {
if (flags & PGS_SCALED) {
sdl_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else if (w == display_mode.w && h == display_mode.h) {
/* No need to change physical resolution.
Borderless fullscreen is preferred when possible */
sdl_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else {
sdl_flags |= SDL_WINDOW_FULLSCREEN;
}
}
...of the current sensible defaults and just do sdl_flags |= SDL_WINDOW_FULLSCREEN;
e.g.
if (flags & PGS_FORCE_TRUE_FULLSCREEN){
sdl_flags |= SDL_WINDOW_FULLSCREEN;
}
else if (flags & PGS_FULLSCREEN) {
if (flags & PGS_SCALED) {
sdl_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else if (w == display_mode.w && h == display_mode.h) {
/* No need to change physical resolution.
Borderless fullscreen is preferred when possible */
sdl_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else {
sdl_flags |= SDL_WINDOW_FULLSCREEN;
}
}
# # ea7kir commented at 2022-12-17 11:44:10
If I ever get pygame installed on python3.11, full-screen will be very important for me too.
# # fladd commented at 2023-01-08 00:33:46
Seeing that the new Pygame release is still not out, could we have this very simple fix already in it once it is released? Having the ability to create proper fullscreen windows that bypass the desktop compositor is absolutely crucial for timing-critical applications.
# # fladd commented at 2023-01-30 20:26:34
I would also like to bring up that even when one gets a proper fullscreen window, then it seems that on MacOS it still does not bypass the compositor (or so it seems at least, as there is still some weird adaptive vsync or tripple buffering going on)!
Comparing between Pygame1 and Pygame2 on the very same MacBook I get proper normal vsync and a doublebuffer for an OpenGL surface, as requested, for Pygame1, but for the same code on Pygame2, I get some adaptive stuff going on (that is with Pygame actually failing to set adaptive vsync, as in pygame/pygame#3609, which is why I think it still goes through the compositor). In either case, I have not found a way to get a proper doublebuffered and vsynced OpenGL fullscreen window with Pygame2 under MacOS yet. Any input on how to achieve this would be very much appreciated!