From 6afeefa97db53aa45d212dc7545be1c1a0a86e56 Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Mon, 29 Jul 2024 10:07:17 -0700 Subject: [PATCH] Remove WS_EX_TOPMOST ExStyle for Direct3D9 #286 --- Dllmain/BuildNo.rc | 2 +- d3d9/IDirect3D9Ex.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dllmain/BuildNo.rc b/Dllmain/BuildNo.rc index b2b0c057..c20fa13e 100644 --- a/Dllmain/BuildNo.rc +++ b/Dllmain/BuildNo.rc @@ -1 +1 @@ -#define BUILD_NUMBER 7073 +#define BUILD_NUMBER 7074 diff --git a/d3d9/IDirect3D9Ex.cpp b/d3d9/IDirect3D9Ex.cpp index 6c3ed04e..683956ff 100644 --- a/d3d9/IDirect3D9Ex.cpp +++ b/d3d9/IDirect3D9Ex.cpp @@ -492,17 +492,17 @@ void UpdatePresentParameter(D3DPRESENT_PARAMETERS* pPresentationParameters, HWND Utils::CheckMessageQueue(DeviceDetails.DeviceWindow); } - // Remove tool window + // Remove tool and topmost window if (DeviceDetails.DeviceWindow != LastDeviceWindow) { LONG lExStyle = GetWindowLong(DeviceDetails.DeviceWindow, GWL_EXSTYLE); - if (lExStyle & WS_EX_TOOLWINDOW) + if (lExStyle & (WS_EX_TOOLWINDOW | WS_EX_TOPMOST)) { - LOG_LIMIT(3, __FUNCTION__ << " Removing window WS_EX_TOOLWINDOW!"); + LOG_LIMIT(3, __FUNCTION__ << " Removing window" << ((lExStyle & WS_EX_TOOLWINDOW) ? " WS_EX_TOOLWINDOW" : "") << ((lExStyle & WS_EX_TOPMOST) ? " WS_EX_TOPMOST" : "")); - SetWindowLong(DeviceDetails.DeviceWindow, GWL_EXSTYLE, lExStyle & ~WS_EX_TOOLWINDOW); - SetWindowPos(DeviceDetails.DeviceWindow, ((lExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowLong(DeviceDetails.DeviceWindow, GWL_EXSTYLE, lExStyle & ~(WS_EX_TOOLWINDOW | WS_EX_TOPMOST)); + SetWindowPos(DeviceDetails.DeviceWindow, ((lExStyle & WS_EX_TOPMOST) ? HWND_NOTOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } }