Skip to content

Commit

Permalink
Merge pull request #89112 from AThousandShips/wayland_tilt
Browse files Browse the repository at this point in the history
[Wayland] Fix tilt handling
  • Loading branch information
akien-mga committed Mar 4, 2024
2 parents faafccb + 9273106 commit 790d051
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions platform/linuxbsd/wayland/wayland_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion platform/linuxbsd/wayland/wayland_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class WaylandThread {

struct TabletToolData {
Point2i position;
Vector2i tilt;
Vector2 tilt;
uint32_t pressure = 0;

BitField<MouseButtonMask> pressed_button_mask;
Expand Down

0 comments on commit 790d051

Please sign in to comment.