@@ -332,8 +332,8 @@ void CHW::CreateDevice(HWND m_hWnd, bool move_window)
332332#ifdef USE_DX11
333333 D3D_FEATURE_LEVEL pFeatureLevels[] = {
334334 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,
337337 };
338338
339339 R = D3D11CreateDeviceAndSwapChain (
@@ -713,9 +713,10 @@ void CHW::updateWindowProps(HWND m_hWnd)
713713 {
714714 if (m_move_window)
715715 {
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;
719720 SetWindowLong (m_hWnd, GWL_STYLE, dwWindowStyle);
720721 // When moving from fullscreen to windowed mode, it is important to
721722 // adjust the window size after recreating the device rather than
@@ -727,18 +728,32 @@ void CHW::updateWindowProps(HWND m_hWnd)
727728 // desktop.
728729
729730 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 ;
731735
732- GetClientRect (GetDesktopWindow (), &DesktopRect);
736+ if (bCenter)
737+ {
738+ RECT DesktopRect;
739+
740+ GetClientRect (GetDesktopWindow (), &DesktopRect);
733741
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+ };
738753
739754 AdjustWindowRect (&m_rcWindowBounds, dwWindowStyle, FALSE );
740755
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 ,
742757 (m_rcWindowBounds.right - m_rcWindowBounds.left ), (m_rcWindowBounds.bottom - m_rcWindowBounds.top ),
743758 SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
744759 }
0 commit comments