neuswc

patched neuswc library (tracked)
git clone https://git.daat.foo/neuswc.git
Log | Files | Refs | README | LICENSE

commit 954ac51426a465c514f797a7097e2c7a1798fff4
parent 6b9d93c8ffc1b7d09a4bdb6b23e245cabedcae33
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Fri, 24 Sep 2021 00:03:13 -0500

pointer: avoid converting mouse position to int32 and back

This can cause a directional bias if the cursor is being moved slowly
enough, due to loss in precision.

Diffstat:
Mlibswc/pointer.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -289,12 +289,12 @@ clip_position(struct pointer *pointer, wl_fixed_t fx, wl_fixed_t fy) } /* Do some clipping. */ - x = MAX(MIN(x, box.x2 - 1), box.x1); - y = MAX(MIN(y, box.y2 - 1), box.y1); + fx = wl_fixed_from_int(MAX(MIN(x, box.x2 - 1), box.x1)); + fy = wl_fixed_from_int(MAX(MIN(y, box.y2 - 1), box.y1)); } - pointer->x = wl_fixed_from_int(x); - pointer->y = wl_fixed_from_int(y); + pointer->x = fx; + pointer->y = fy; } void