Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wayland] Fix tilt handling #89112

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
AThousandShips marked this conversation as resolved.
Show resolved Hide resolved
td.tilt = td.tilt.clamp(Vector2(-90, -90), Vector2(90, 90));
Riteo marked this conversation as resolved.
Show resolved Hide resolved

mm->set_tilt(td.tilt / 90);
AThousandShips marked this conversation as resolved.
Show resolved Hide resolved

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
Loading