mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 21:00:25 +01:00
evdev: Fix absolute coordinate transform formula
Since the device min/max x/y coordinates are inclusive, to get the width/height one need to add one to (min x/y - max x/y). Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
bb52822ece
commit
512e964661
1 changed files with 4 additions and 4 deletions
|
|
@ -91,8 +91,8 @@ evdev_device_transform_x(struct evdev_device *device,
|
|||
li_fixed_t x,
|
||||
uint32_t width)
|
||||
{
|
||||
return (x - device->abs.min_x) * width /
|
||||
(device->abs.max_x - device->abs.min_x);
|
||||
return (x - li_fixed_from_int(device->abs.min_x)) * width /
|
||||
(device->abs.max_x - device->abs.min_x + 1);
|
||||
}
|
||||
|
||||
li_fixed_t
|
||||
|
|
@ -100,8 +100,8 @@ evdev_device_transform_y(struct evdev_device *device,
|
|||
li_fixed_t y,
|
||||
uint32_t height)
|
||||
{
|
||||
return (y - device->abs.min_y) * height /
|
||||
(device->abs.max_y - device->abs.min_y);
|
||||
return (y - li_fixed_from_int(device->abs.min_y)) * height /
|
||||
(device->abs.max_y - device->abs.min_y + 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue