Opened 10 years ago

Last modified 20 months ago

#2845 new defect

[PATCH] SDL2: Can't set resolution in fullscreen mode

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.

Attachments (2)

fake_fullscreen_option.diff (5.7 KB ) - added by fcxSanya 8 years ago.
fake_fullscreen_option_v2.diff (2.7 KB ) - added by fcxSanya 8 years ago.

Download all attachments as: .zip

Change History (15)

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, 7 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.

comment:10 by Stan, 3 years ago

So I tried replacing

	if (fullscreen)
		flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;

by

	if (fullscreen)
		flags |= SDL_WINDOW_FULLSCREEN;

On Windows 10 and there is still at least one issue.

If you open the game in Windowed mode, then going into full screen forces 1024x768. If you open the game in FullScreen mode, resolution is Desktop's but if you switch to windowed then back to full screen it's now 1024x768

comment:11 by Silier, 3 years ago

Owner: set to fcxSanya

comment:12 by Vladislav Belov, 2 years ago

Refs r26148.

comment:13 by Stan, 20 months ago

Owner: fcxSanya removed

Backlogging due to lack of progress, lack of review, or users going MIA.

Note: See TracTickets for help on using tickets.