From 6bb26b7f7456398996ab4d2f83ad7843f5656440 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 3 Jan 2023 21:42:35 +0600 Subject: [PATCH] wacom: Clamp coordinates after conversion --- src/device/mouse_wacom_tablet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/device/mouse_wacom_tablet.c b/src/device/mouse_wacom_tablet.c index 0aaa4cf53..099f9c5c8 100644 --- a/src/device/mouse_wacom_tablet.c +++ b/src/device/mouse_wacom_tablet.c @@ -170,12 +170,10 @@ static int wacom_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv) { mouse_wacom_t* wacom = (mouse_wacom_t*)priv; - if (abs_x > 1.0l) abs_x = 1.0l; - if (abs_y > 1.0l) abs_y = 1.0l; - if (abs_x < 0.l) abs_x = 0.l; - if (abs_y < 0.l) abs_y = 0.l; wacom->abs_x = abs_x * (wacom->measurement ? 4566. : 5800.); wacom->abs_y = abs_y * (wacom->measurement ? 2972. : 3774.); + if (wacom->abs_x > (wacom->measurement ? 4566 : 5800)) wacom->abs_x = (wacom->measurement ? 4566 : 5800); + if (wacom->abs_y > (wacom->measurement ? 2972 : 3774)) wacom->abs_x = (wacom->measurement ? 2972 : 3774); wacom->rel_x = x; wacom->rel_y = y; if (wacom->b != b) wacom->oldb = wacom->b;