Opened 10 years ago

Last modified 21 months ago

#2845 new defect

[PATCH] SDL2: Can't set resolution in fullscreen mode — at Version 9

Reported by: historic_bruno Owned by:
Priority: Should Have Milestone: Work In Progress
Component: Core engine Keywords: patch
Cc: fcxSanya@… Patch:

Description (last modified by wraitii)

With SDL1, we could set the fullscreen resolution, but not with SDL2, because we create the window with SDL_WINDOW_FULLSCREEN_DESKTOP to work around some issues with true fullscreen mode. Fullscreen desktop is a "fake" fullscreen which is only a borderless window that fills the screen, so it runs at native resolution.

Currently I know of issues on Windows and OS X using SDL_WINDOW_FULLSCREEN (see #2041). Once they are fixed, we can change the flag and fix this regression.

Change History (11)

comment:1 by historic_bruno, 9 years ago

I think we should add a config option to toggle between SDL_WINDOW_FULLSCREEN and ​SDL_WINDOW_FULLSCREEN_DESKTOP. SDL_WINDOW_FULLSCREEN would always be preferable but it's still too buggy to be the default, and sometimes SDL_WINDOW_FULLSCREEN_DESKTOP could be preferred for those who want the desktop resolution in fullscreen mode.

comment:2 by historic_bruno, 9 years ago

Tested the latest SDL Hg version on Windows 7 and the fullscreen transitions are much improved, I didn't find any obvious bugs on my system.

comment:3 by SuperTux95, 8 years ago

I'd like to be able to use the super key or alt+tab to temporarily minimize 0ad on Debian. Currently it is only possible in windowed mode with the added performance impact. Other games like Xonotic allow to be minimized with super/alt+tab in fullscreen when paused.

by fcxSanya, 8 years ago

Attachment: fake_fullscreen_option.diff added

in reply to:  1 comment:4 by fcxSanya, 8 years ago

Added a patch according to Ben's suggestion here:

I think we should add a config option to toggle between SDL_WINDOW_FULLSCREEN and ​SDL_WINDOW_FULLSCREEN_DESKTOP.

By default it preserves the current implementation (SDL_WINDOW_FULLSCREEN_DESKTOP).

Tested on Linux, looks working.

To test: change xres/yres to something different from the current screen resolution, set windowed = false and make sure that:

  1. with fakefullscreen = true (default) the game window is created with the desktop resolution
  2. with fakefullscreen = false the game window is created with xres/yres

comment:5 by fcxSanya, 8 years ago

Cc: fcxSanya@… added
Keywords: rfc patch added
Milestone: BacklogAlpha 22
Summary: SDL2: Can't set resolution in fullscreen mode[PATCH] SDL2: Can't set resolution in fullscreen mode

by fcxSanya, 8 years ago

comment:6 by fcxSanya, 8 years ago

I suddenly realized that it doesn't make sense to pass fakeFullscreen around as method arguments like fullscreen as I do in fake_fullscreen_option.diff​, so I made the second version of the patch (fake_fullscreen_option_v2.diff​) which doesn't add fakeFullscreen params to methods.

comment:7 by wraitii, 8 years ago

Keywords: rfc removed

Patch does what it says, but that doesn't play nice with OSX. Also seems to fail with #2349: hold the screen gets mangled (probably an SDL issue)

If the point is to allow running at a reduced resolution in fullscreen to speed up the game, I would advise instead, as I did on #2349, to decouple the renderer resolution from the real resolution.

Removing rfc in the meantime.

comment:8 by elexis, 7 years ago

Milestone: Alpha 22Work In Progress

Moving to the Work In Progress milestone, since there is a patch asking for feedback, but since it is not strictly bound to a specific release.

comment:9 by wraitii, 5 years ago

Description: modified (diff)

Perhaps after https://code.wildfiregames.com/D1925 we could add support for SDL_WINDOW_FULLSCREEN.

Note: See TracTickets for help on using tickets.