Skip to content

Add "-noborder" launch argument for borderless windowed mode #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ShizCalev
Copy link

@ShizCalev ShizCalev commented Mar 3, 2025

WS_POPUP|WS_VISIBLE being the only flags = noborder.

Currently set to only trigger if both -win & -noborder are set as launch params, can simplify it down to just one of that's preferred.

@DevGeniusCode DevGeniusCode added Enhancement Is new feature or request Minor Severity: Minor < Major < Critical < Blocker labels Mar 3, 2025
@ShizCalev ShizCalev force-pushed the windowless-border branch 2 times, most recently from 773404a to a0d9145 Compare March 4, 2025 10:27
@ShizCalev ShizCalev force-pushed the windowless-border branch from a0d9145 to 42e597b Compare March 4, 2025 10:28
@ShizCalev ShizCalev changed the title Adds a "-noborder" launch argument for borderless windowed mode Feature: Adds a "-noborder" launch argument for borderless windowed mode Mar 4, 2025
@DevGeniusCode DevGeniusCode added Gen Relates to Generals ZH Relates to Zero Hour labels Mar 4, 2025
@xezon xezon changed the title Feature: Adds a "-noborder" launch argument for borderless windowed mode Add "-noborder" launch argument for borderless windowed mode Mar 30, 2025
@helmutbuhler
Copy link

I don't quite understand what this new commandline option is for. In case you want the window to be completely visible, the recently merged PR #541 also addressed that. Would that be good enough?

@ShizCalev
Copy link
Author

ShizCalev commented May 19, 2025

@helmutbuhler That PR has no connection to this one.

This PR removes the title bar / border that's around the game window. Hence, borderless windowed mode.

Without the PR:
2025-05-19_17-37-28-devenv-GeneralsGameCode_-StdAfx h-_Microsoft_Visual_Stu

With the PR:
image

(I also just noticed that the very corners of the client windows are rounded on windows 11 when borders are present, gross lol)

@xezon
Copy link

xezon commented May 20, 2025

What is the benefit of no border?

@ShizCalev
Copy link
Author

ShizCalev commented May 20, 2025

What is the benefit of no border?

....huh? Borderless windowed mode is a pretty standard feature in like 99% of modern games. It's entirely a personal preference/asthetic option, as a large number of folks hate seeing brightly colored title bars.

This does not change the default behavior, it just adds a command line option to enable the option.

@Trax1990
Copy link

What is the benefit of no border?

I seriously hope you’re joking.

@Mauller
Copy link

Mauller commented May 20, 2025

This is not adding a true "Borderless window" mode as the game does not properly support that and it needs to be added internally. The game needs to support scaling the rendering output within the window based on the chosen resolution etc.

With the recent window centering fix, if you run the game in a window and with your resolution matching the desktop it will remove the window borders and fill the screen. This mostly replicates borderless window and allows easy window switching.

@helmutbuhler
Copy link

What is the benefit of no border?

....huh? Borderless windowed mode is a pretty standard feature in like 99% of modern games. It's entirely a personal preference/asthetic option, as a large number of folks hate seeing brightly colored title bars.

This does not change the default behavior, it just adds a command line option to enable the option.

Do you mean Windowed Fullscreen Mode? If this PR is trying to accomplish that, it needs quite a bit of work.
If not, I'm not aware of any game that allows you to hide the border in windowed mode, and Google Search didn't help there either. Can you mention some games that support this?

What is the benefit of no border?

I seriously hope you’re joking.

I don't understand this either.

@ShizCalev
Copy link
Author

ShizCalev commented May 22, 2025

Do you mean Windowed Fullscreen Mode? If this PR is trying to accomplish that, it needs quite a bit of work.

That is not what I mean, no. Windowed borderless is not the same thing as windowed fullscreen mode, those are two different things.

If not, I'm not aware of any game that allows you to hide the border in windowed mode, and Google Search didn't help there either. Can you mention some games that support this?

Age of Chivalry, Alien Swarm, Aperture Tag, Apex Legends, Black Mesa, Blade Symphony, Bloody Good Time, Coastline to Atmosphere, Consortium, Contagion, Counter-Strike: Global Offensive, Counter-Strike: Malvinas, Counter-Strike: Online 2, Counter-Strike: Source, Dark Messiah of Might and Magic, Day of Defeat: Source, Day of Infamy, Deadlock, Dear Esther, Dino D-Day, Dota 2, Dystopia, E.Y.E.: Divine Cybermancy, Empires, Entropy: Zero, Entropy: Zero 2, Eternal Silence, Fistful of Frags, Flipside, Fortress Forever, G String, Garry's Mod, GoldenEye: Source, Half-Life 2, Half-Life 2: Capture the Flag, Half-Life 2: Deathmatch, Half-Life 2: Episode One, Half-Life 2: Episode Two, Half-Life 2: Lost Coast, Half-Life Deathmatch: Source, Half-Life: Source, Hunt Down the Freeman, Hybrid, Infra, Insurgency, Insurgency: Modern Infantry Combat, Iron Grip: The Oppression, JBMod, Jabroni Brawl, Jailbreak Source, Jurassic Life, Klaus Veen's Treason, Korsakovia, Left 4 Dead, Left 4 Dead 2, Mario Kart: Source, Minerva, Multiplayer mods, NeoTokyo, Nightmare House 2, No More Room in Hell, Nuclear Dawn, Operation Black Mesa, Perfect Dark: Source, Pirates, Vikings and Knights II, Portal, Portal 2, Portal Reloaded, Portal Stories: Mel, Portal: Prelude, Portal: Revolution, Postal III, Prospekt, Research and Development, Rexaura, Riot Act, SiN Episodes, SourceForts, Swelter, Synergy, Tactical Intervention, Team Fortress 2, Team Fortress 2 Classic, Terminal 7, The Beginner's Guide, The Hidden, The Ship, The Stanley Parable, Thinking with Time Machine, Titan: XCIX, Titanfall, Titanfall 2, Vampire: The Masquerade – Bloodlines, Vindictus, Zeno Clash, and Zombie Panic! Source -all- support this functionality with the exact same -noborder -windowed (or some variant thereof) launch parameter.

image

@@ -75,6 +75,7 @@
HINSTANCE ApplicationHInstance = NULL; ///< our application instance
HWND ApplicationHWnd = NULL; ///< our application window handle
Bool ApplicationIsWindowed = false;
Bool ApplicationIsBorderless = false; // TheSuperHackers @feature @ShizCalev 04/04/2025 - Borderless Windowed support
Copy link

Choose a reason for hiding this comment

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

ShizCalev

@@ -674,7 +675,8 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin
// Create our main window
windowStyle = WS_POPUP|WS_VISIBLE;
if (runWindowed)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
if(!ApplicationIsBorderless)
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
Copy link

Choose a reason for hiding this comment

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

No WS_SYSMENU when ApplicationIsBorderless ? Fullscreen has WS_SYSMENU.

@xezon xezon dismissed Generalcamo’s stale review May 22, 2025 06:24

Stale review

Copy link

@helmutbuhler helmutbuhler left a comment

Choose a reason for hiding this comment

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

... Source -all- support this functionality with the exact same -noborder -windowed (or some variant thereof) launch parameter.

So, what is this Multiplayer mods game that you listed there? ;)

You could have just said that the Source-Engine has this option and a bunch of games inherit that option from there. So I'm still not convinced this option is that useful, but if you are this invested in it I guess we can take it in.

@@ -926,6 +928,8 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
//added a preparse step for this flag because it affects window creation style
if (stricmp(token,"-win")==0)
ApplicationIsWindowed=true;
if(stricmp(token,"-noborder")==0)

Choose a reason for hiding this comment

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

Can we add this in CommandLine.cpp as well, just as a dummy or comment? Reason being that if someone wants to know which options are available, that is the place to look.

Copy link

Choose a reason for hiding this comment

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

Just a side note: I think it would be neat to implement a logging that prints out all possible arguments when launching it on the command line. In some future change.

@@ -901,6 +903,8 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
//added a preparse step for this flag because it affects window creation style
if (stricmp(token,"-win")==0)
ApplicationIsWindowed=true;
if(stricmp(token,"-noborder")==0)
Copy link

Choose a reason for hiding this comment

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

if (
:)

@@ -926,6 +928,8 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
//added a preparse step for this flag because it affects window creation style
if (stricmp(token,"-win")==0)
ApplicationIsWindowed=true;
if(stricmp(token,"-noborder")==0)
Copy link

Choose a reason for hiding this comment

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

Just a side note: I think it would be neat to implement a logging that prints out all possible arguments when launching it on the command line. In some future change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Is new feature or request Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants