mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Prevent ddraw from removing the WS_CLIPCHILDREN style
In borderless fullscreen mode, ddraw removes the WS_CLIPCHILDREN style from the device window for some reason, but it doesn't do that in exclusive fullscreen mode. Preventing ddraw from removing the style fixes invisible menus in Tiberian Sun when using FullscreenMode=borderless.
This commit is contained in:
parent
027b52686e
commit
f13d842c24
@ -68,6 +68,7 @@ namespace
|
||||
void onUninitMenuPopup(HMENU menu);
|
||||
void onWindowPosChanged(HWND hwnd, const WINDOWPOS& wp);
|
||||
void onWindowPosChanging(HWND hwnd, WINDOWPOS& wp);
|
||||
LONG WINAPI setWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
void setWindowProc(HWND hwnd, WNDPROC wndProcA, WNDPROC wndProcW);
|
||||
|
||||
template <auto func, typename Result, typename... Params>
|
||||
@ -195,6 +196,30 @@ namespace
|
||||
return ddcWindowProc(hwnd, uMsg, wParam, lParam, CallWindowProcW, getWindowProc(hwnd).wndProcW);
|
||||
}
|
||||
|
||||
LONG WINAPI ddrawSetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
LOG_FUNC("ddrawSetWindowLongA", hWnd, nIndex, dwNewLong);
|
||||
if (GWL_WNDPROC == nIndex)
|
||||
{
|
||||
return setWindowLongA(hWnd, GWL_WNDPROC, dwNewLong);
|
||||
}
|
||||
|
||||
if (GWL_STYLE == nIndex)
|
||||
{
|
||||
auto style = CALL_ORIG_FUNC(GetWindowLongA)(hWnd, GWL_STYLE);
|
||||
if (style & WS_CLIPCHILDREN)
|
||||
{
|
||||
dwNewLong = style | WS_CLIPCHILDREN;
|
||||
if (dwNewLong == style)
|
||||
{
|
||||
return LOG_RESULT(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(SetWindowLongA)(hWnd, nIndex, dwNewLong));
|
||||
}
|
||||
|
||||
BOOL WINAPI getMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax,
|
||||
decltype(&GetMessageA) origGetMessage)
|
||||
{
|
||||
@ -670,6 +695,8 @@ namespace Gdi
|
||||
HOOK_FUNCTION(user32, SetWindowLongW, setWindowLongW);
|
||||
HOOK_FUNCTION(user32, SetWindowPos, setWindowPos);
|
||||
|
||||
Compat::hookIatFunction(Dll::g_origDDrawModule, "SetWindowLongA", ddrawSetWindowLongA);
|
||||
|
||||
SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE,
|
||||
Dll::g_currentModule, &winEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);
|
||||
SetWinEventHook(EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_NAMECHANGE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user