From cb38877a8c1af45da663c8a09c4fe5e7da4818cb Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Thu, 12 Dec 2024 17:08:36 -0700 Subject: [PATCH] Ensure current desktop mode is also a fullscreen mode Port of PR #3331 --- changelog.md | 2 +- src/SFML/Window/macOS/VideoModeImpl.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 999a703ea..ad9f9221d 100644 --- a/changelog.md +++ b/changelog.md @@ -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) diff --git a/src/SFML/Window/macOS/VideoModeImpl.cpp b/src/SFML/Window/macOS/VideoModeImpl.cpp index 371558dee..f32b5b804 100644 --- a/src/SFML/Window/macOS/VideoModeImpl.cpp +++ b/src/SFML/Window/macOS/VideoModeImpl.cpp @@ -40,18 +40,17 @@ namespace sf::priv //////////////////////////////////////////////////////////// std::vector VideoModeImpl::getFullscreenModes() { - std::vector 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 modes = {desktop}; // Loop on each mode and convert it into a sf::VideoMode object. const CFIndex modesCount = CFArrayGetCount(cgmodes);