Skip to content

video: Add borderless fullscreen window mode#1371

Open
maininformer wants to merge 3 commits intoomf2097:masterfrom
maininformer:fullscreen-desktop-mode
Open

video: Add borderless fullscreen window mode#1371
maininformer wants to merge 3 commits intoomf2097:masterfrom
maininformer:fullscreen-desktop-mode

Conversation

@maininformer
Copy link
Copy Markdown

@maininformer maininformer commented Apr 7, 2026

Summary

  • Add a new borderless config option for borderless fullscreen (SDL_WINDOW_FULLSCREEN_DESKTOP)
  • fullscreen remains a bool — fully backward compatible with existing configs
  • In-game video menu gets a separate BORDERLESS ON/OFF toggle
  • Borderless fullscreen allows easy Alt-Tab/Cmd-Tab without hijacking the display

Config example

fullscreen=true
borderless=true

Test plan

  • fullscreen=false — game runs windowed
  • fullscreen=true, borderless=false — exclusive fullscreen (existing behavior)
  • fullscreen=true, borderless=true — borderless fullscreen, can Alt-Tab away
  • Old configs with just fullscreen=true still work (borderless defaults to false)
  • Toggle both options via in-game VIDEO settings menu

🤖 Generated with Claude Code

@maininformer
Copy link
Copy Markdown
Author

Closing for now — still WIP. Will reopen when backward compatibility with fullscreen=true configs and menu alignment are addressed.

@maininformer maininformer reopened this Apr 7, 2026

if(fullscreen) {
if(SDL_SetWindowFullscreen(w, SDL_WINDOW_FULLSCREEN) != 0) {
Uint32 fs_flag = borderless ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the SDL int types.

Comment thread src/game/scenes/mainmenu/menu_video.c Outdated
menu_attach(menu, textselector_create_bind_opts("FULLSCREEN", "Run the game in a fullscreen window.", NULL, NULL,
&setting->video.fullscreen, offon_opts, 2));
menu_attach(menu,
textselector_create_bind_opts("BORDERLESS", "Use borderless fullscreen for easy Alt-Tab switching.",
Copy link
Copy Markdown
Member

@katajakasa katajakasa Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to how little room we have in the UI, the fullscreen option should be multi-option toggleable. Also, the code could use enum for the variable type. To avoid compatibility issues, the option in configs should be called something new (e.g. window_mode or somesuch).

EDIT: clarified a bit

@katajakasa
Copy link
Copy Markdown
Member

Note that since we now started receiving AI code PR's, we are currently considering the AI policy. This PR is probably going to have to wait until we have some idea how we want to handle them.

@maininformer
Copy link
Copy Markdown
Author

maininformer commented Apr 9, 2026

Thank you.

Note that since we now started receiving AI code PR's, we are currently considering the AI policy. This PR is probably going to have to wait until we have some idea how we want to handle them.

This sounds good to me; please let me know if I can be of help.

I Will address the comments.

One question, should the borderless be the default behavior of fullscreen? Adding a new enum works. The issue is many players may not know what "borderless" means. Plus the word "borderless" is too long for the UI and mangles it. Can try shorter words but that would be even more mysterious.

@katajakasa
Copy link
Copy Markdown
Member

Thank you.

Note that since we now started receiving AI code PR's, we are currently considering the AI policy. This PR is probably going to have to wait until we have some idea how we want to handle them.

This sounds good to me; please let me know if I can be of help.

I Will address the comments.

One question, should the borderless be the default behavior of fullscreen? Adding a new enum works. The issue is many players may not know what "borderless" means. Plus the word "borderless" is too long for the UI and mangles it. Can try shorter words but that would be even more mysterious.

I would just use:
FULLSCREEN: OFF
FULLSCREEN: WINDOWED
FULLSCREEN: EXCLUSIVE

and then explain the modes in description. If there is need to shorten, then "FULLSCREEN" can just be "FS" or "FS MODE" or somesuch (with description explanation).

Comment thread src/game/utils/settings.h
WINDOW_MODE_WINDOWED,
WINDOW_MODE_BORDERLESS,
WINDOW_MODE_FULLSCREEN
} window_mode;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should also be a typedef for this, and that should be used as a function argument type, if possible.

@katajakasa
Copy link
Copy Markdown
Member

Right, the AI policy is now at https://github.com/omf2097/openomf/blob/master/CONTRIBUTING.md#ai--coding-assistant-policy -- please check it out.

…ve fullscreen

Replace the simple fullscreen toggle with a three-way window_mode enum
(WINDOWED, BORDERLESS, FULLSCREEN). Borderless mode uses
SDL_WINDOW_FULLSCREEN_DESKTOP for easy Alt-Tab switching without
hijacking the display. Also replaces SDL Uint32 types with standard C
types per project conventions.

Assisted-by: Claude Code (Claude Opus 4.6)
@maininformer maininformer force-pushed the fullscreen-desktop-mode branch from ba44e26 to 8157369 Compare April 17, 2026 22:32
@maininformer
Copy link
Copy Markdown
Author

Addressed.

}

bool create_window(SDL_Window **window, int width, int height, bool fullscreen) {
bool create_window(SDL_Window **window, int width, int height, int window_mode) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need to use the new type. For example this would be "window_mode window_mode" instead of "int window_mode". Idea is that we declare by type that this variable can only contain the three types defined by the typedef. This goes for all functions where this is used.

Replace int with the window_mode enum typedef in all function
signatures, function pointer typedefs, and local variables that
hold window mode values.

Assisted-by: Claude Code (Claude Opus 4.6)
@maininformer
Copy link
Copy Markdown
Author

Updated to use the window_mode typedef instead of int in all function signatures, function pointer typedefs, and local variables. The settings_video struct field remains int because the GUI textselector widget binds to it as int *.

Also updated the commit trailers to use Assisted-by per the new AI policy.

Reformat two manually-broken multi-line constructs to satisfy the
clang-format-18 style check that runs in CI. No semantic changes.

Assisted-by: Claude Code (Claude Opus 4.7)
@katajakasa
Copy link
Copy Markdown
Member

Issue: Switching to fullscreen exclusive seems to break 4:3 aspect ratio with black sides.

@maininformer
Copy link
Copy Markdown
Author

maininformer commented Apr 30, 2026

@katajakasa cannot reproduce this. Could you please share an image? and is this behavior absent on master?

@katajakasa
Copy link
Copy Markdown
Member

katajakasa commented May 4, 2026

@katajakasa cannot reproduce this. Could you please share an image? and is this behavior absent on master?

Sorry, took me a while to get back to this. So after some poking, it seems that the fullscreen aspect ratio stuff is broken in master also. What /should/ happen is that when 4:3 is selected, and fullscreen is enabled (any fullscreen mode), and a 16:9 or 16:10 resolution is selected, there should be black bars in the right and the left of the screen. I think we can consider that a separate issue though.

Edit: Otherwise I think this seems fine now. One more squash so that things are in a single commit, and I think we can merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants