Merge pull request #6804 from akallabeth/disp_delay

Fixed #6801: Delay sending of resolution change
This commit is contained in:
Martin Fleisz 2021-02-11 10:37:16 +01:00 committed by GitHub
commit 6d04c0831c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,6 @@ struct _xfDispContext
UINT64 lastSentDate;
int targetWidth, targetHeight;
BOOL activated;
BOOL waitingResize;
BOOL fullscreen;
UINT16 lastSentDesktopOrientation;
UINT32 lastSentDesktopScaleFactor;
@ -125,7 +124,6 @@ static BOOL xf_disp_sendResize(xfDispContext* xfDisp)
}
else
{
xfDisp->waitingResize = TRUE;
layout.Flags = DISPLAY_CONTROL_MONITOR_PRIMARY;
layout.Top = layout.Left = 0;
layout.Width = xfDisp->targetWidth;
@ -144,6 +142,16 @@ static BOOL xf_disp_sendResize(xfDispContext* xfDisp)
return xf_update_last_sent(xfDisp);
}
static BOOL xf_disp_queueResize(xfDispContext* xfDisp, UINT32 width, UINT32 height)
{
if ((xfDisp->targetWidth == width) && (xfDisp->targetHeight == height))
return TRUE;
xfDisp->targetWidth = width;
xfDisp->targetHeight = height;
xfDisp->lastSentDate = GetTickCount64();
return xf_disp_sendResize(xfDisp);
}
static BOOL xf_disp_set_window_resizable(xfDispContext* xfDisp)
{
XSizeHints* size_hints;
@ -194,8 +202,6 @@ static void xf_disp_OnActivated(void* context, ActivatedEventArgs* e)
if (!xf_disp_check_context(context, &xfc, &xfDisp, &settings))
return;
xfDisp->waitingResize = FALSE;
if (xfDisp->activated && !xfc->fullscreen)
{
xf_disp_set_window_resizable(xfDisp);
@ -218,8 +224,6 @@ static void xf_disp_OnGraphicsReset(void* context, GraphicsResetEventArgs* e)
if (!xf_disp_check_context(context, &xfc, &xfDisp, &settings))
return;
xfDisp->waitingResize = FALSE;
if (xfDisp->activated && !settings->Fullscreen)
{
xf_disp_set_window_resizable(xfDisp);
@ -392,9 +396,7 @@ BOOL xf_disp_handle_configureNotify(xfContext* xfc, int width, int height)
if (!xfDisp)
return FALSE;
xfDisp->targetWidth = width;
xfDisp->targetHeight = height;
return xf_disp_sendResize(xfDisp);
return xf_disp_queueResize(xfDisp, width, height);
}
static UINT xf_DisplayControlCaps(DispClientContext* disp, UINT32 maxNumMonitors,