Skip to content

Add support for getting and setting window states with size overload#3501

Draft
eXpl0it3r wants to merge 3 commits into
masterfrom
feature/set_states_with_size
Draft

Add support for getting and setting window states with size overload#3501
eXpl0it3r wants to merge 3 commits into
masterfrom
feature/set_states_with_size

Conversation

@eXpl0it3r
Copy link
Copy Markdown
Member

@eXpl0it3r eXpl0it3r commented May 3, 2025

Description

This is an alternative/extended API design for #3496.
Main description & discussion on the other PR

sf::WindowBase implements the following three functions:

  • setState(sf::State state)
  • setState(sf::State state, sf::Vector2u size)
  • sf::State getState()

Comment thread include/SFML/Window/WindowBase.hpp Outdated
Comment thread include/SFML/Window/WindowBase.hpp Outdated
Comment thread include/SFML/Window/WindowBase.hpp Outdated
@ChrisThrasher ChrisThrasher force-pushed the feature/set_states_with_size branch from 7f72379 to 9412d67 Compare June 8, 2025 17:09
@ChrisThrasher
Copy link
Copy Markdown
Member

I implemented setState on macOS.

@ChrisThrasher ChrisThrasher force-pushed the feature/set_states_with_size branch 2 times, most recently from 4a88208 to 12a4516 Compare June 8, 2025 17:24
@github-project-automation github-project-automation Bot moved this to Planned in SFML 3.2.0 Jun 19, 2025
@eXpl0it3r eXpl0it3r added this to the 3.2 milestone Aug 28, 2025
@JonnyPtn
Copy link
Copy Markdown
Contributor

JonnyPtn commented Feb 7, 2026

So one of the problems this highlights on Mac is that SFML doesn't properly handle the two different "fullscreen" options on Mac:

  • Classic fullscreen, as SFML currently uses, where it's a fullscreen window on the main desktop akin to borderless fullscreen
  • Fullscreen space, the more modern approach to fullscreen on Mac where the app gets it's own space/desktop to itself

This is really an existing bug, as you can make the window fullscreen via the Mac menu bar, keyboard shortcut or window button but internally SFML still thinks it's not fullscreen (although you do get a resized event)

This API highlights the problem more, as you can get the window state which won't say it's fullscreen if you've made it a fullscreen space. Options are:

  • Maintain the existing behaviour but disable the default NSWindow fullscreen menu option so users can't use the fullscreen space
  • Change to use fullscreen space only and remove the legacy behaviour
  • Expose the option to the users via some flag (build or runtime)

Personally I would rule out the first option, as it's the worst user experience on Mac. For reference, SDL gives the user the choice via a hint: https://wiki.libsdl.org/SDL2/SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Planned

Development

Successfully merging this pull request may close these issues.

3 participants