1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add temporary workaround for ubuntu alt+enter bug until we got a better solution

This commit is contained in:
FunkyFr3sh 2018-08-09 11:19:36 +02:00
parent 366ce012b2
commit b9eab72850
2 changed files with 13 additions and 0 deletions

View File

@ -96,6 +96,7 @@ typedef struct IDirectDrawImpl
BOOL noactivateapp;
char shader[MAX_PATH];
BOOL autorenderer;
BOOL wine;
} IDirectDrawImpl;

View File

@ -486,6 +486,9 @@ LRESULT CALLBACK dummy_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
// LastSetWindowPosTick = Workaround for a wine+gnome bug where each SetWindowPos call triggers a WA_INACTIVE message
DWORD LastSetWindowPosTick;
void ToggleFullscreen()
{
if (ddraw->windowed)
@ -497,6 +500,7 @@ void ToggleFullscreen()
SetWindowLong(ddraw->hWnd, GWL_STYLE, GetWindowLong(ddraw->hWnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU));
SetWindowPos(ddraw->hWnd, HWND_TOPMOST, 0, 0, ddraw->render.width, ddraw->render.height, SWP_SHOWWINDOW);
LastSetWindowPosTick = timeGetTime();
}
mouse_lock();
}
@ -583,6 +587,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
else if (wParam == WA_INACTIVE)
{
if (ddraw->wine && LastSetWindowPosTick + 500 > timeGetTime())
{
LastSetWindowPosTick = 0;
return 0;
}
mouse_unlock();
/* minimize our window on defocus when in fullscreen */
@ -985,6 +995,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
This->render.ev = CreateEvent(NULL, TRUE, FALSE, NULL);
This->render.sem = CreateSemaphore(NULL, 0, 1, NULL);
This->wine = GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0;
/* load configuration options from ddraw.ini */
char cwd[MAX_PATH];
char tmp[256];