Send resize on window state change

This commit is contained in:
James Fu 2022-09-21 18:01:58 +08:00 committed by akallabeth
parent b18ca128c8
commit a04021d38b

View File

@ -270,6 +270,23 @@ static void xf_disp_OnTimer(void* context, const TimerEventArgs* e)
xf_disp_sendResize(xfDisp); xf_disp_sendResize(xfDisp);
} }
static void xf_disp_OnWindowStateChange(void* context, const WindowStateChangeEventArgs* e)
{
xfContext* xfc;
xfDispContext* xfDisp;
rdpSettings* settings;
WINPR_UNUSED(e);
if (!xf_disp_check_context(context, &xfc, &xfDisp, &settings))
return;
if (!xfDisp->activated || !xfc->fullscreen)
return;
xf_disp_sendResize(xfDisp);
}
xfDispContext* xf_disp_new(xfContext* xfc) xfDispContext* xf_disp_new(xfContext* xfc)
{ {
xfDispContext* ret; xfDispContext* ret;
@ -303,6 +320,7 @@ xfDispContext* xf_disp_new(xfContext* xfc)
PubSub_SubscribeActivated(pubSub, xf_disp_OnActivated); PubSub_SubscribeActivated(pubSub, xf_disp_OnActivated);
PubSub_SubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset); PubSub_SubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset);
PubSub_SubscribeTimer(pubSub, xf_disp_OnTimer); PubSub_SubscribeTimer(pubSub, xf_disp_OnTimer);
PubSub_SubscribeWindowStateChange(pubSub, xf_disp_OnWindowStateChange);
return ret; return ret;
} }
@ -317,6 +335,7 @@ void xf_disp_free(xfDispContext* disp)
PubSub_UnsubscribeActivated(pubSub, xf_disp_OnActivated); PubSub_UnsubscribeActivated(pubSub, xf_disp_OnActivated);
PubSub_UnsubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset); PubSub_UnsubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset);
PubSub_UnsubscribeTimer(pubSub, xf_disp_OnTimer); PubSub_UnsubscribeTimer(pubSub, xf_disp_OnTimer);
PubSub_UnsubscribeWindowStateChange(pubSub, xf_disp_OnWindowStateChange);
} }
free(disp); free(disp);