Moved static wf_event.c variables to client context

This commit is contained in:
Armin Novak 2021-06-02 13:50:23 +02:00 committed by akallabeth
parent e79de5b2b3
commit 019d26d9bb
2 changed files with 8 additions and 8 deletions

View File

@ -136,6 +136,8 @@ extern "C"
BOOL isConsole;
DispClientContext* disp;
UINT64 lastSentDate;
BOOL wasMaximized;
};
/**

View File

@ -40,8 +40,6 @@ static HWND g_focus_hWnd;
#define Y_POS(lParam) ((UINT16)((lParam >> 16) & 0xFFFF))
#define RESIZE_MIN_DELAY 200 /* minimum delay in ms between two resizes */
static UINT64 lastSentDate;
static BOOL wasMaximized;
static BOOL wf_scale_blt(wfContext* wfc, HDC hdc, int x, int y, int w, int h, HDC hdcSrc, int x1,
int y1, DWORD rop);
@ -268,7 +266,7 @@ void wf_send_resize(wfContext* wfc)
if (settings->DynamicResolutionUpdate && wfc->disp != NULL)
{
if (GetTickCount64() - lastSentDate > RESIZE_MIN_DELAY)
if (GetTickCount64() - wfc->lastSentDate > RESIZE_MIN_DELAY)
{
if (wfc->fullscreen)
{
@ -298,7 +296,7 @@ void wf_send_resize(wfContext* wfc)
settings->SmartSizingWidth = targetWidth;
settings->SmartSizingHeight = targetHeight;
}
lastSentDate = GetTickCount64();
wfc->lastSentDate = GetTickCount64();
}
}
}
@ -377,7 +375,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
}
else
{
wasMaximized = TRUE;
wfc->wasMaximized = TRUE;
wf_send_resize(wfc);
}
@ -392,12 +390,12 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top,
SWP_NOMOVE | SWP_FRAMECHANGED);
wasMaximized = TRUE;
wfc->wasMaximized = TRUE;
wf_send_resize(wfc);
}
else if (wParam == SIZE_RESTORED && !wfc->fullscreen && wasMaximized)
else if (wParam == SIZE_RESTORED && !wfc->fullscreen && wfc->wasMaximized)
{
wasMaximized = FALSE;
wfc->wasMaximized = FALSE;
wf_send_resize(wfc);
}
}