commit 954ac51

Nihal Jere  ·  2021-09-24 05:03:13 +0000 UTC
parent 6b9d93c
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.
1 files changed,  +4, -4
+4, -4
 1@@ -289,12 +289,12 @@ clip_position(struct pointer *pointer, wl_fixed_t fx, wl_fixed_t fy)
 2 		}
 3 
 4 		/* Do some clipping. */
 5-		x = MAX(MIN(x, box.x2 - 1), box.x1);
 6-		y = MAX(MIN(y, box.y2 - 1), box.y1);
 7+		fx = wl_fixed_from_int(MAX(MIN(x, box.x2 - 1), box.x1));
 8+		fy = wl_fixed_from_int(MAX(MIN(y, box.y2 - 1), box.y1));
 9 	}
10 
11-	pointer->x = wl_fixed_from_int(x);
12-	pointer->y = wl_fixed_from_int(y);
13+	pointer->x = fx;
14+	pointer->y = fy;
15 }
16 
17 void