diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-03 23:48:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 23:48:46 +0100 |
commit | 1d6f8ad837439b5304f1ef9994410d372dff947c (patch) | |
tree | a0f9cf139b78abca5f0e6736c1c14e808b0b2688 /platform/linuxbsd | |
parent | fe52458154c64fb1b741df4f7bd10106395f7cbd (diff) | |
parent | 75a58360fd4d6098440a44556c98b7a5fbe52be2 (diff) |
Merge pull request #56438 from madmiraal/fix-56428
Fix tablet tilt values returning bad values
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 10e15fc8cc..68bd5e8421 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -225,7 +225,7 @@ bool DisplayServerX11::_refresh_device_info() { if (class_info->number == VALUATOR_ABSX && class_info->mode == XIModeAbsolute) { resolution_x = class_info->resolution; abs_x_min = class_info->min; - abs_y_max = class_info->max; + abs_x_max = class_info->max; absolute_mode = true; } else if (class_info->number == VALUATOR_ABSY && class_info->mode == XIModeAbsolute) { resolution_y = class_info->resolution; @@ -239,8 +239,8 @@ bool DisplayServerX11::_refresh_device_info() { tilt_x_min = class_info->min; tilt_x_max = class_info->max; } else if (class_info->number == VALUATOR_TILTY && class_info->mode == XIModeAbsolute) { - tilt_x_min = class_info->min; - tilt_x_max = class_info->max; + tilt_y_min = class_info->min; + tilt_y_max = class_info->max; } } } @@ -3189,8 +3189,10 @@ void DisplayServerX11::process_events() { Map<int, Vector2>::Element *pen_tilt_x = xi.pen_tilt_x_range.find(device_id); if (pen_tilt_x) { Vector2 pen_tilt_x_range = pen_tilt_x->value(); - if (pen_tilt_x_range != Vector2()) { - xi.tilt.x = ((*values - pen_tilt_x_range[0]) / (pen_tilt_x_range[1] - pen_tilt_x_range[0])) * 2 - 1; + if (pen_tilt_x_range[0] != 0 && *values < 0) { + xi.tilt.x = *values / -pen_tilt_x_range[0]; + } else if (pen_tilt_x_range[1] != 0) { + xi.tilt.x = *values / pen_tilt_x_range[1]; } } @@ -3201,8 +3203,10 @@ void DisplayServerX11::process_events() { Map<int, Vector2>::Element *pen_tilt_y = xi.pen_tilt_y_range.find(device_id); if (pen_tilt_y) { Vector2 pen_tilt_y_range = pen_tilt_y->value(); - if (pen_tilt_y_range != Vector2()) { - xi.tilt.y = ((*values - pen_tilt_y_range[0]) / (pen_tilt_y_range[1] - pen_tilt_y_range[0])) * 2 - 1; + if (pen_tilt_y_range[0] != 0 && *values < 0) { + xi.tilt.y = *values / -pen_tilt_y_range[0]; + } else if (pen_tilt_y_range[1] != 0) { + xi.tilt.y = *values / pen_tilt_y_range[1]; } } |