From e1e2eef4e1e6fd98bd428e21b8ddeb76979fa2cd Mon Sep 17 00:00:00 2001 From: 2fly2 Date: Sat, 7 May 2022 09:21:21 +0800 Subject: [PATCH] fix moving a window shrinks it 14x7 when connect to server 2019 Signed-off-by: 2fly2 --- client/X11/xf_rail.c | 30 +++++++++++++++++++++--------- client/X11/xf_window.h | 5 +++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index 4392c405c..80c659084 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -138,10 +138,10 @@ void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow) * Calculate new size/position for the rail window(new values for * windowOffsetX/windowOffsetY/windowWidth/windowHeight) on the server */ - windowMove.left = appWindow->x; - windowMove.top = appWindow->y; - windowMove.right = windowMove.left + appWindow->width; - windowMove.bottom = windowMove.top + appWindow->height; + windowMove.left = appWindow->x - appWindow->resizeMarginLeft; + windowMove.top = appWindow->y - appWindow->resizeMarginTop; + windowMove.right = appWindow->x + appWindow->width + appWindow->resizeMarginRight; + windowMove.bottom = appWindow->y + appWindow->height + appWindow->resizeMarginBottom; xfc->rail->ClientWindowMove(xfc->rail, &windowMove); } } @@ -171,12 +171,12 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow) * windowOffsetX/windowOffsetY/windowWidth/windowHeight) on the server * */ - windowMove.left = appWindow->x; - windowMove.top = appWindow->y; + windowMove.left = appWindow->x - appWindow->resizeMarginLeft; + windowMove.top = appWindow->y - appWindow->resizeMarginTop; windowMove.right = - windowMove.left + - appWindow->width; /* In the update to RDP the position is one past the window */ - windowMove.bottom = windowMove.top + appWindow->height; + appWindow->x + + appWindow->width + appWindow->resizeMarginRight; /* In the update to RDP the position is one past the window */ + windowMove.bottom = appWindow->y + appWindow->height + appWindow->resizeMarginBottom; xfc->rail->ClientWindowMove(xfc->rail, &windowMove); /* * Simulate button up at new position to end the local move (per RDP spec) @@ -352,6 +352,18 @@ static BOOL xf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO* appWindow->windowWidth = windowState->windowWidth; appWindow->windowHeight = windowState->windowHeight; } + + if (fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_X) + { + appWindow->resizeMarginLeft = windowState->resizeMarginLeft; + appWindow->resizeMarginRight = windowState->resizeMarginRight; + } + + if (fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y) + { + appWindow->resizeMarginTop = windowState->resizeMarginTop; + appWindow->resizeMarginBottom = windowState->resizeMarginBottom; + } if (fieldFlags & WINDOW_ORDER_FIELD_OWNER) { diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index 235ff21d5..839cdf314 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -135,6 +135,11 @@ struct xf_app_window UINT32 localWindowOffsetCorrX; UINT32 localWindowOffsetCorrY; + + UINT32 resizeMarginLeft; + UINT32 resizeMarginTop; + UINT32 resizeMarginRight; + UINT32 resizeMarginBottom; GC gc; int shmid;