aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2022-03-08 17:03:38 -0500
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2022-03-17 21:52:59 +0300
commit0345148ea667dbad29ad7b70072708f4733afc0c (patch)
tree75a24083a912454ebfefc5521383fdef2963ca6a /sway/input/cursor.c
parentremove unnecessary strlen call (diff)
downloadsway-0345148ea667dbad29ad7b70072708f4733afc0c.tar.gz
sway-0345148ea667dbad29ad7b70072708f4733afc0c.tar.zst
sway-0345148ea667dbad29ad7b70072708f4733afc0c.zip
sway/input/cursor: take device mm size from wlr_tablet
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index f0be2793..4f7bf133 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -591,14 +591,15 @@ static void apply_mapping_from_region(struct wlr_input_device *device,
591 double x1 = region->x1, x2 = region->x2; 591 double x1 = region->x1, x2 = region->x2;
592 double y1 = region->y1, y2 = region->y2; 592 double y1 = region->y1, y2 = region->y2;
593 593
594 if (region->mm) { 594 if (region->mm && device->type == WLR_INPUT_DEVICE_TABLET_TOOL) {
595 if (device->width_mm == 0 || device->height_mm == 0) { 595 struct wlr_tablet *tablet = device->tablet;
596 if (tablet->width_mm == 0 || tablet->height_mm == 0) {
596 return; 597 return;
597 } 598 }
598 x1 /= device->width_mm; 599 x1 /= tablet->width_mm;
599 x2 /= device->width_mm; 600 x2 /= tablet->width_mm;
600 y1 /= device->height_mm; 601 y1 /= tablet->height_mm;
601 y2 /= device->height_mm; 602 y2 /= tablet->height_mm;
602 } 603 }
603 604
604 *x = apply_mapping_from_coord(x1, x2, *x); 605 *x = apply_mapping_from_coord(x1, x2, *x);