video: Add borderless fullscreen window mode#1371
video: Add borderless fullscreen window mode#1371maininformer wants to merge 3 commits intoomf2097:masterfrom
Conversation
|
Closing for now — still WIP. Will reopen when backward compatibility with |
|
|
||
| if(fullscreen) { | ||
| if(SDL_SetWindowFullscreen(w, SDL_WINDOW_FULLSCREEN) != 0) { | ||
| Uint32 fs_flag = borderless ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN; |
There was a problem hiding this comment.
We don't use the SDL int types.
| 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.", |
There was a problem hiding this comment.
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
|
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. |
|
Thank you.
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: 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). |
| WINDOW_MODE_WINDOWED, | ||
| WINDOW_MODE_BORDERLESS, | ||
| WINDOW_MODE_FULLSCREEN | ||
| } window_mode; |
There was a problem hiding this comment.
there should also be a typedef for this, and that should be used as a function argument type, if possible.
|
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)
ba44e26 to
8157369
Compare
|
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) { |
There was a problem hiding this comment.
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)
|
Updated to use the Also updated the commit trailers to use |
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)
|
Issue: Switching to fullscreen exclusive seems to break 4:3 aspect ratio with black sides. |
|
@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. |
Summary
borderlessconfig option for borderless fullscreen (SDL_WINDOW_FULLSCREEN_DESKTOP)fullscreenremains a bool — fully backward compatible with existing configsConfig example
Test plan
fullscreen=false— game runs windowedfullscreen=true, borderless=false— exclusive fullscreen (existing behavior)fullscreen=true, borderless=true— borderless fullscreen, can Alt-Tab awayfullscreen=truestill work (borderless defaults to false)🤖 Generated with Claude Code