summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-04 13:34:31 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-04 13:34:31 +0100
commit790d051ff19a9b6e4ddbd7995a7e998dfcbd850e (patch)
treedb34858a458fe1e2ff3752efc046633d23e8bab4 /platform/linuxbsd
parentfaafccbd3465e7151bc6d9c05731e94cc0aba341 (diff)
parent9273106bb37a9eddd89b19533f5cac4bcc814b74 (diff)
downloadredot-engine-790d051ff19a9b6e4ddbd7995a7e998dfcbd850e.tar.gz
Merge pull request #89112 from AThousandShips/wayland_tilt
[Wayland] Fix tilt handling
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/wayland/wayland_thread.cpp3
-rw-r--r--platform/linuxbsd/wayland/wayland_thread.h2
2 files changed, 2 insertions, 3 deletions
diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp
index 7fa69a3bed..8167642345 100644
--- a/platform/linuxbsd/wayland/wayland_thread.cpp
+++ b/platform/linuxbsd/wayland/wayland_thread.cpp
@@ -2424,8 +2424,7 @@ void WaylandThread::_wp_tablet_tool_on_frame(void *data, struct zwp_tablet_tool_
// According to the tablet proto spec, tilt is expressed in degrees relative
// to the Z axis of the tablet, so it shouldn't go over 90 degrees either way,
// I think. We'll clamp it just in case.
- td.tilt.x = CLAMP(td.tilt.x, -90, 90);
- td.tilt.y = CLAMP(td.tilt.x, -90, 90);
+ td.tilt = td.tilt.clamp(Vector2(-90, -90), Vector2(90, 90));
mm->set_tilt(td.tilt / 90);
diff --git a/platform/linuxbsd/wayland/wayland_thread.h b/platform/linuxbsd/wayland/wayland_thread.h
index b9e7e0437a..d49f0c9d34 100644
--- a/platform/linuxbsd/wayland/wayland_thread.h
+++ b/platform/linuxbsd/wayland/wayland_thread.h
@@ -308,7 +308,7 @@ public:
struct TabletToolData {
Point2i position;
- Vector2i tilt;
+ Vector2 tilt;
uint32_t pressure = 0;
BitField<MouseButtonMask> pressed_button_mask;