summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/display_server_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd/display_server_x11.cpp')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 247665e313..747b5beeda 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -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];
}
}
@@ -3644,7 +3648,7 @@ void DisplayServerX11::process_events() {
mm->set_position(pos);
mm->set_global_position(pos);
Input::get_singleton()->set_mouse_position(pos);
- mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
+ mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity());
mm->set_relative(rel);
@@ -3674,7 +3678,7 @@ void DisplayServerX11::process_events() {
mm->set_window_id(E.key);
mm->set_position(pos_focused);
mm->set_global_position(pos_focused);
- mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
+ mm->set_velocity(Input::get_singleton()->get_last_mouse_velocity());
Input::get_singleton()->parse_input_event(mm);
break;