Fix xf_Pointer_SetPosition with smart-sizing

(cherry picked from commit d3e3ab7b5d5ce376ba72fa1fc0aee2f25c9682b4)
This commit is contained in:
akallabeth 2021-03-08 13:52:29 +01:00 коммит произвёл akallabeth
Родитель 7755fdc02a
Коммит 899be1b564
3 изменённых файлов: 36 добавлений и 1 удалений

Просмотреть файл

@ -262,6 +262,37 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
return TRUE;
}
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
{
rdpSettings* settings;
INT64 tx, ty;
if (!xfc || !xfc->context.settings || !y || !x)
return;
settings = xfc->context.settings;
tx = *x;
ty = *y;
if (!xfc->remote_app)
{
#ifdef WITH_XRENDER
if (xf_picture_transform_required(xfc))
{
double xScalingFactor = xfc->scaledWidth / (double)settings->DesktopWidth;
double yScalingFactor = xfc->scaledHeight / (double)settings->DesktopHeight;
tx = ((tx + xfc->offset_x) * xScalingFactor);
ty = ((ty + xfc->offset_y) * yScalingFactor);
}
#endif
}
CLAMP_COORDINATES(tx, ty);
*x = tx;
*y = ty;
}
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
{
rdpSettings* settings;

Просмотреть файл

@ -33,6 +33,7 @@ void xf_event_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsig
...);
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y);
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y);
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window window, BOOL app);
BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window window, BOOL app);

Просмотреть файл

@ -37,6 +37,7 @@
#include "xf_graphics.h"
#include "xf_gdi.h"
#include "xf_event.h"
#include <freerdp/log.h>
#define TAG CLIENT_TAG("x11")
@ -521,6 +522,8 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
if (xfc->remote_app && !xfc->focused)
return TRUE;
xf_adjust_coordinates_to_screen(xfc, &x, &y);
xf_lock_x11(xfc);
rc = XGetWindowAttributes(xfc->display, handle, &current);
@ -541,7 +544,7 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
rc = XWarpPointer(xfc->display, None, handle, 0, 0, 0, 0, x, y);
if (rc == 0)
WLog_WARN(TAG, "xf_Pointer_SetPosition: XWrapPointer==%d", rc);
WLog_WARN(TAG, "xf_Pointer_SetPosition: XWarpPointer==%d", rc);
tmp.event_mask = current.your_event_mask;
rc = XChangeWindowAttributes(xfc->display, handle, CWEventMask, &tmp);
if (rc == 0)