Fix T62780 , T59802, T57648: fullscreen window issues on Windows.

This fixes popups and preferences appearing behind the main window, as
well as flickering artifacts when Blender is in fullscreen.

Patch contributed by phocomelus.

Differential Revision: https://developer.blender.org/D4634
This commit is contained in:
Brecht Van Lommel 2019-04-03 16:01:20 +02:00
parent 27a239864f
commit c6d1ae2f8a
Notes: blender-bot 2023-02-14 10:04:50 +01:00
Referenced by issue #62780, Window blink black when Toggle window fullscreen  switch back
Referenced by issue #59802, Preferences window opening behind main window when in fullscreen mode
Referenced by issue #57648, Quit messagebox is hidden when exit with Fullscreen mode enabled
1 changed files with 4 additions and 4 deletions

View File

@ -106,7 +106,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
// MSVC 2012+ returns bogus values from GetSystemMetrics, bug in Windows
// http://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values
RECT cxrect = {0, 0, 0, 0};
AdjustWindowRectEx(&cxrect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0);
AdjustWindowRectEx(&cxrect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0);
int cxsizeframe = abs(cxrect.bottom);
int cysizeframe = abs(cxrect.left);
@ -177,7 +177,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
m_hWnd = ::CreateWindowW(
s_windowClassName, // pointer to registered class name
title_16, // pointer to window name
WS_POPUP | WS_MAXIMIZE, // window style
WS_MAXIMIZE, // window style
left, // horizontal position of window
top, // vertical position of window
width, // window width
@ -546,7 +546,7 @@ GHOST_TWindowState GHOST_WindowWin32::getState() const
}
else if (::IsZoomed(m_hWnd)) {
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE))
if ((result & (WS_DLGFRAME | WS_MAXIMIZE)) == (WS_DLGFRAME | WS_MAXIMIZE))
state = GHOST_kWindowStateMaximized;
else
state = GHOST_kWindowStateFullScreen;
@ -604,7 +604,7 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
wp.showCmd = SW_SHOWMAXIMIZED;
wp.ptMaxPosition.x = 0;
wp.ptMaxPosition.y = 0;
::SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE);
::SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_MAXIMIZE);
break;
case GHOST_kWindowStateEmbedded:
::SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_CHILD);