Skip to content

Commit 195b2b5

Browse files
committed
Adds a "-noborder" launch argument for borderless windowed mode
1 parent 0a05454 commit 195b2b5

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

Generals/Code/Main/WinMain.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
HINSTANCE ApplicationHInstance = NULL; ///< our application instance
7676
HWND ApplicationHWnd = NULL; ///< our application window handle
7777
Bool ApplicationIsWindowed = false;
78+
79+
// =================== Community Fix Start =================
80+
// Borderless Support - PR #327 //
81+
Bool ApplicationIsBorderless = false;
82+
// =================== Community Fix End =================
83+
7884
Win32Mouse *TheWin32Mouse= NULL; ///< for the WndProc() only
7985
DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows.
8086

@@ -674,7 +680,12 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin
674680
// Create our main window
675681
windowStyle = WS_POPUP|WS_VISIBLE;
676682
if (runWindowed)
677-
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
683+
// =================== Community Fix Start =================
684+
// Borderless Support - PR #327 //
685+
if(!ApplicationIsBorderless)
686+
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
687+
// =================== Community Fix End =================
688+
678689
else
679690
windowStyle |= WS_EX_TOPMOST | WS_SYSMENU;
680691

@@ -901,6 +912,12 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
901912
//added a preparse step for this flag because it affects window creation style
902913
if (stricmp(token,"-win")==0)
903914
ApplicationIsWindowed=true;
915+
// =================== Community Fix Start =================
916+
// Borderless Support - PR #327 //
917+
if(stricmp(token,"-noborder")==0)
918+
ApplicationIsBorderless=true;
919+
// =================== Community Fix End =================
920+
904921
token = nextParam(NULL, "\" ");
905922
}
906923

GeneralsMD/Code/Main/WinMain.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
HINSTANCE ApplicationHInstance = NULL; ///< our application instance
7979
HWND ApplicationHWnd = NULL; ///< our application window handle
8080
Bool ApplicationIsWindowed = false;
81+
82+
// =================== Community Fix Start =================
83+
// Borderless Support - PR #327 //
84+
Bool ApplicationIsBorderless = false;
85+
// =================== Community Fix End =================
86+
8187
Win32Mouse *TheWin32Mouse= NULL; ///< for the WndProc() only
8288
DWORD TheMessageTime = 0; ///< For getting the time that a message was posted from Windows.
8389

@@ -696,7 +702,12 @@ static Bool initializeAppWindows( HINSTANCE hInstance, Int nCmdShow, Bool runWin
696702
// Create our main window
697703
windowStyle = WS_POPUP|WS_VISIBLE;
698704
if (runWindowed)
699-
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
705+
// =================== Community Fix Start =================
706+
// Borderless Support - PR #327 //
707+
if(!ApplicationIsBorderless)
708+
windowStyle |= WS_DLGFRAME | WS_CAPTION | WS_SYSMENU;
709+
// =================== Community Fix End =================
710+
700711
else
701712
windowStyle |= WS_EX_TOPMOST | WS_SYSMENU;
702713

@@ -926,6 +937,13 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
926937
//added a preparse step for this flag because it affects window creation style
927938
if (stricmp(token,"-win")==0)
928939
ApplicationIsWindowed=true;
940+
941+
// =================== Community Fix Start =================
942+
// Borderless Support - PR #327 //
943+
if(stricmp(token,"-noborder")==0)
944+
ApplicationIsBorderless=true;)
945+
// =================== Community Fix End =================
946+
929947
token = nextParam(NULL, "\" ");
930948
}
931949

0 commit comments

Comments
 (0)