Ensure current desktop mode is also a fullscreen mode

Port of PR #3331
This commit is contained in:
Chris Thrasher 2024-12-12 17:08:36 -07:00
parent 71a8ac7e70
commit cb38877a8c
2 changed files with 4 additions and 5 deletions

View File

@ -88,7 +88,7 @@ For a closer look at breaking changes and how to migrate from SFML 2, check out
- [Windows] Fixed F13-F24 and consumer key names not being returned on Windows (#2873)
- [Windows] Changed `sf::Context::getFunction` to return `nullptr` when called on Windows without an active context (#2925)
- [Linux] Fixed broken joystick axis mappings under Linux (#3167)
- [macOS] Fixed how macOS fullscreen video modes are detected (#3151)
- [macOS] Fixed how macOS fullscreen video modes are detected (#3151, #3348)
- [macOS] Avoided unnecessary permission request prompts (#3232)
- [Linux] Fixed DRM mode setting to use SFML window dimensions (#3310)

View File

@ -40,18 +40,17 @@ namespace sf::priv
////////////////////////////////////////////////////////////
std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
{
std::vector<VideoMode> modes;
// Retrieve all modes available for main screen only.
CFArrayRef cgmodes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr);
if (cgmodes == nullptr)
{
sf::err() << "Couldn't get VideoMode for main display." << std::endl;
return modes;
return {};
}
const VideoMode desktop = getDesktopMode();
const VideoMode desktop = getDesktopMode();
std::vector<VideoMode> modes = {desktop};
// Loop on each mode and convert it into a sf::VideoMode object.
const CFIndex modesCount = CFArrayGetCount(cgmodes);