Skip to content

Commit 163ba36

Browse files
committed
fix rebase of mouselock
1 parent 19f0423 commit 163ba36

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

mouselock.patch

+20-14
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ index c20ba170285..fb13399d22c 100644
4646
2.46.2
4747

4848

49-
From 32b0fccb746a675206639b6c990fed9a28829d10 Mon Sep 17 00:00:00 2001
49+
From e41ef995e33e90e36b58755bc1d2d422bbcfc4c1 Mon Sep 17 00:00:00 2001
5050
From: Giraffe1966 <35208168+Giraffe1966@users.noreply.github.com>
5151
Date: Sun, 10 Dec 2023 10:27:18 +0000
5252
Subject: [PATCH 2/4] Make relative motion smoother at lower mouse movement
5353
speeds.
5454

5555
---
56-
dlls/winewayland.drv/wayland_pointer.c | 6 +++---
57-
dlls/winewayland.drv/waylanddrv.h | 2 ++
58-
2 files changed, 5 insertions(+), 3 deletions(-)
56+
dlls/winewayland.drv/wayland_pointer.c | 13 ++++++++++---
57+
dlls/winewayland.drv/waylanddrv.h | 2 ++
58+
2 files changed, 12 insertions(+), 3 deletions(-)
5959

6060
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c
61-
index fb13399d22c..aa67a7ba722 100644
61+
index fb13399d22c..c6cd4446a95 100644
6262
--- a/dlls/winewayland.drv/wayland_pointer.c
6363
+++ b/dlls/winewayland.drv/wayland_pointer.c
64-
@@ -261,18 +261,18 @@ static void relative_pointer_v1_relative_motion(void *private,
64+
@@ -261,17 +261,24 @@ static void relative_pointer_v1_relative_motion(void *private,
6565
HWND hwnd;
6666
POINT screen;
6767
struct wayland_win_data *data;
@@ -70,19 +70,25 @@ index fb13399d22c..aa67a7ba722 100644
7070
if (!(hwnd = wayland_pointer_get_focused_hwnd())) return;
7171
if (!(data = wayland_win_data_get(hwnd))) return;
7272

73+
+ pthread_mutex_lock(&pointer->mutex);
7374
wayland_surface_coords_to_window(data->wayland_surface,
7475
- wl_fixed_to_double(dx),
7576
- wl_fixed_to_double(dy),
7677
+ wl_fixed_to_double(dx)+pointer->pendingX,
7778
+ wl_fixed_to_double(dy)+pointer->pendingY,
7879
(int *)&screen.x, (int *)&screen.y);
7980

80-
wayland_win_data_release(data);
81+
- wayland_win_data_release(data);
82+
+ double actualDx = (double)screen.x / (double)(surface->window.scale);
83+
+ pointer->pendingX = wl_fixed_to_double(dx)+pointer->pendingX-actualDx;
84+
+ double actualDy = (double)screen.y / (double)(surface->window.scale);
85+
+ pointer->pendingY = wl_fixed_to_double(dy)+pointer->pendingY-actualDy;
86+
87+
+ pthread_mutex_unlock(&pointer->mutex);
88+
+ wayland_win_data_release(data);
8189

82-
-
8390
input.type = INPUT_MOUSE;
8491
input.mi.dx = screen.x;
85-
input.mi.dy = screen.y;
8692
diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h
8793
index 3dee8e432df..cd89f4959b1 100644
8894
--- a/dlls/winewayland.drv/waylanddrv.h
@@ -100,7 +106,7 @@ index 3dee8e432df..cd89f4959b1 100644
100106
2.46.2
101107

102108

103-
From 3074e20ea7df45f4a588697aa1728d3ac3c65e37 Mon Sep 17 00:00:00 2001
109+
From d3707854f663684d025422624461f045cc2526eb Mon Sep 17 00:00:00 2001
104110
From: Giraffe1966 <35208168+Giraffe1966@users.noreply.github.com>
105111
Date: Mon, 11 Dec 2023 20:31:26 +0000
106112
Subject: [PATCH 3/4] Prevent left click from disabling cursor lock.
@@ -126,7 +132,7 @@ index 14862e9a8a4..6f903a84acd 100644
126132
2.46.2
127133

128134

129-
From 8a5ef9a58f5c6a1c82746b6e78169c330b5a2937 Mon Sep 17 00:00:00 2001
135+
From 46b1b0c2737e9f9784b2051a08d4b00fee73ed35 Mon Sep 17 00:00:00 2001
130136
From: Giraffe1966 <35208168+Giraffe1966@users.noreply.github.com>
131137
Date: Sun, 17 Dec 2023 06:37:18 +0000
132138
Subject: [PATCH 4/4] Ensure the pointer is warped to the confinement region
@@ -138,7 +144,7 @@ Subject: [PATCH 4/4] Ensure the pointer is warped to the confinement region
138144
2 files changed, 102 insertions(+), 32 deletions(-)
139145

140146
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c
141-
index aa67a7ba722..26308df2a78 100644
147+
index c6cd4446a95..b41752ac02b 100644
142148
--- a/dlls/winewayland.drv/wayland_pointer.c
143149
+++ b/dlls/winewayland.drv/wayland_pointer.c
144150
@@ -92,11 +92,84 @@ static void pointer_handle_motion_internal(wl_fixed_t sx, wl_fixed_t sy)
@@ -235,7 +241,7 @@ index aa67a7ba722..26308df2a78 100644
235241
pthread_mutex_unlock(&pointer->mutex);
236242

237243
/* The cursor is undefined at every enter, so we set it again with
238-
@@ -789,24 +864,18 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface,
244+
@@ -796,24 +871,18 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface,
239245
confine_rect->right - confine_rect->left,
240246
confine_rect->bottom - confine_rect->top);
241247

@@ -272,7 +278,7 @@ index aa67a7ba722..26308df2a78 100644
272278

273279
TRACE("Confining to hwnd=%p wayland=%d,%d+%d,%d\n",
274280
pointer->constraint_hwnd,
275-
@@ -820,20 +889,19 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface,
281+
@@ -827,20 +896,19 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface,
276282
{
277283
HWND hwnd = wl_surface_get_user_data(wl_surface);
278284

0 commit comments

Comments
 (0)