@@ -332,8 +332,8 @@ void CHW::CreateDevice(HWND m_hWnd, bool move_window)
332
332
#ifdef USE_DX11
333
333
D3D_FEATURE_LEVEL pFeatureLevels[] = {
334
334
D3D_FEATURE_LEVEL_11_0,
335
- // D3D_FEATURE_LEVEL_10_1,
336
- // D3D_FEATURE_LEVEL_10_0,
335
+ // D3D_FEATURE_LEVEL_10_1,
336
+ // D3D_FEATURE_LEVEL_10_0,
337
337
};
338
338
339
339
R = D3D11CreateDeviceAndSwapChain (
@@ -713,9 +713,10 @@ void CHW::updateWindowProps(HWND m_hWnd)
713
713
{
714
714
if (m_move_window)
715
715
{
716
- dwWindowStyle = WS_BORDER | WS_VISIBLE;
717
- if (!strstr (Core.Params , " -no_dialog_header" ))
718
- dwWindowStyle |= WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
716
+ bool bBordersMode = strstr (Core.Params , " -draw_borders" );
717
+ dwWindowStyle = WS_VISIBLE;
718
+ if (bBordersMode)
719
+ dwWindowStyle |= WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
719
720
SetWindowLong (m_hWnd, GWL_STYLE, dwWindowStyle);
720
721
// When moving from fullscreen to windowed mode, it is important to
721
722
// adjust the window size after recreating the device rather than
@@ -727,18 +728,32 @@ void CHW::updateWindowProps(HWND m_hWnd)
727
728
// desktop.
728
729
729
730
RECT m_rcWindowBounds;
730
- RECT DesktopRect;
731
+ float fYOffset = 0 .f ;
732
+ bool bCenter = false ;
733
+ if (strstr (Core.Params , " -center_screen" ))
734
+ bCenter = true ;
731
735
732
- GetClientRect (GetDesktopWindow (), &DesktopRect);
736
+ if (bCenter)
737
+ {
738
+ RECT DesktopRect;
739
+
740
+ GetClientRect (GetDesktopWindow (), &DesktopRect);
733
741
734
- SetRect (&m_rcWindowBounds, (DesktopRect.right - m_ChainDesc.BufferDesc .Width ) / 2 ,
735
- (DesktopRect.bottom - m_ChainDesc.BufferDesc .Height ) / 2 ,
736
- (DesktopRect.right + m_ChainDesc.BufferDesc .Width ) / 2 ,
737
- (DesktopRect.bottom + m_ChainDesc.BufferDesc .Height ) / 2 );
742
+ SetRect (&m_rcWindowBounds, (DesktopRect.right - m_ChainDesc.BufferDesc .Width ) / 2 ,
743
+ (DesktopRect.bottom - m_ChainDesc.BufferDesc .Height ) / 2 ,
744
+ (DesktopRect.right + m_ChainDesc.BufferDesc .Width ) / 2 ,
745
+ (DesktopRect.bottom + m_ChainDesc.BufferDesc .Height ) / 2 );
746
+ }
747
+ else
748
+ {
749
+ if (bBordersMode)
750
+ fYOffset = GetSystemMetrics (SM_CYCAPTION); // size of the window title bar
751
+ SetRect (&m_rcWindowBounds, 0 , 0 , m_ChainDesc.BufferDesc .Width , m_ChainDesc.BufferDesc .Height );
752
+ };
738
753
739
754
AdjustWindowRect (&m_rcWindowBounds, dwWindowStyle, FALSE );
740
755
741
- SetWindowPos (m_hWnd, HWND_NOTOPMOST, m_rcWindowBounds.left , m_rcWindowBounds.top ,
756
+ SetWindowPos (m_hWnd, HWND_NOTOPMOST, m_rcWindowBounds.left , m_rcWindowBounds.top + fYOffset ,
742
757
(m_rcWindowBounds.right - m_rcWindowBounds.left ), (m_rcWindowBounds.bottom - m_rcWindowBounds.top ),
743
758
SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
744
759
}
0 commit comments