Welcome to mirror list, hosted at ThFree Co, Russian Federation.

0015-Fix-xf_Pointer_SetPosition-with-smart-sizing.patch « patches « debian - gitlab.com/Remmina/FreeRDP-Ubuntu-PPA.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 506e940b069173a6d3c2a4aa19598fcd8fec4c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 899be1b564ac4f4803de5b81e0711821403d9ed1 Mon Sep 17 00:00:00 2001
From: akallabeth <akallabeth@posteo.net>
Date: Mon, 8 Mar 2021 13:52:29 +0100
Subject: [PATCH 15/36] Fix xf_Pointer_SetPosition with smart-sizing

(cherry picked from commit d3e3ab7b5d5ce376ba72fa1fc0aee2f25c9682b4)
---
 client/X11/xf_event.c    | 31 +++++++++++++++++++++++++++++++
 client/X11/xf_event.h    |  1 +
 client/X11/xf_graphics.c |  5 ++++-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c
index 60fe9c6b3..99577b1a1 100644
--- a/client/X11/xf_event.c
+++ b/client/X11/xf_event.c
@@ -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;
diff --git a/client/X11/xf_event.h b/client/X11/xf_event.h
index 185c83c7c..2269d3eea 100644
--- a/client/X11/xf_event.h
+++ b/client/X11/xf_event.h
@@ -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);
diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c
index 54a4b9cc7..1700092f8 100644
--- a/client/X11/xf_graphics.c
+++ b/client/X11/xf_graphics.c
@@ -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)
-- 
2.30.2