Windows support for fullscreen borderless window mode

This commit is contained in:
glitchbear
2024-03-02 23:47:12 -08:00
committed by teejusb
parent d788071d4d
commit ad5f3e0653
2 changed files with 7 additions and 5 deletions
@@ -20,6 +20,8 @@ public:
virtual bool SupportsRenderToTexture() const { return true; } virtual bool SupportsRenderToTexture() const { return true; }
virtual RenderTarget *CreateRenderTarget(); virtual RenderTarget *CreateRenderTarget();
bool SupportsFullscreenBorderlessWindow() const { return true; }
const ActualVideoModeParams GetActualVideoModeParams() const; const ActualVideoModeParams GetActualVideoModeParams() const;
}; };
+5 -5
View File
@@ -261,12 +261,12 @@ RString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
return RString(); return RString();
} }
static int GetWindowStyle( bool bWindowed ) static int GetWindowStyle( bool bWindowed , bool bWindowIsFullscreenBorderless)
{ {
if( bWindowed ) if( bWindowed && !bWindowIsFullscreenBorderless )
return WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; return WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
else else
return WS_POPUP; return WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
} }
/* Set the final window size, set the window text and icon, and then unhide the /* Set the final window size, set the window text and icon, and then unhide the
@@ -280,7 +280,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
if( g_hWndMain == nullptr || bForceRecreateWindow ) if( g_hWndMain == nullptr || bForceRecreateWindow )
{ {
int iWindowStyle = GetWindowStyle( p.windowed ); int iWindowStyle = GetWindowStyle( p.windowed , p.bWindowIsFullscreenBorderless );
AppInstance inst; AppInstance inst;
HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle, HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle,
@@ -331,7 +331,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
/* The window style may change as a result of switching to or from fullscreen; /* The window style may change as a result of switching to or from fullscreen;
* apply it. Don't change the WS_VISIBLE bit. */ * apply it. Don't change the WS_VISIBLE bit. */
int iWindowStyle = GetWindowStyle( p.windowed ); int iWindowStyle = GetWindowStyle(p.windowed, p.bWindowIsFullscreenBorderless);
if( GetWindowLong( g_hWndMain, GWL_STYLE ) & WS_VISIBLE ) if( GetWindowLong( g_hWndMain, GWL_STYLE ) & WS_VISIBLE )
iWindowStyle |= WS_VISIBLE; iWindowStyle |= WS_VISIBLE;
SetWindowLong( g_hWndMain, GWL_STYLE, iWindowStyle ); SetWindowLong( g_hWndMain, GWL_STYLE, iWindowStyle );