From a04021d38b1f645487b5f39bcc363ea9138ede94 Mon Sep 17 00:00:00 2001 From: James Fu Date: Wed, 21 Sep 2022 18:01:58 +0800 Subject: [PATCH] Send resize on window state change --- client/X11/xf_disp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/X11/xf_disp.c b/client/X11/xf_disp.c index 7ec2ed751..05f76091c 100644 --- a/client/X11/xf_disp.c +++ b/client/X11/xf_disp.c @@ -270,6 +270,23 @@ static void xf_disp_OnTimer(void* context, const TimerEventArgs* e) 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* ret; @@ -303,6 +320,7 @@ xfDispContext* xf_disp_new(xfContext* xfc) PubSub_SubscribeActivated(pubSub, xf_disp_OnActivated); PubSub_SubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset); PubSub_SubscribeTimer(pubSub, xf_disp_OnTimer); + PubSub_SubscribeWindowStateChange(pubSub, xf_disp_OnWindowStateChange); return ret; } @@ -317,6 +335,7 @@ void xf_disp_free(xfDispContext* disp) PubSub_UnsubscribeActivated(pubSub, xf_disp_OnActivated); PubSub_UnsubscribeGraphicsReset(pubSub, xf_disp_OnGraphicsReset); PubSub_UnsubscribeTimer(pubSub, xf_disp_OnTimer); + PubSub_UnsubscribeWindowStateChange(pubSub, xf_disp_OnWindowStateChange); } free(disp);