Improve handling of High-DPI mice
- Reduce lower bound of mouse sensitivity - Add error accumulators to prevent small motions from being rounded off
This commit is contained in:
@@ -54,6 +54,7 @@ extern "C" {
|
||||
#include <86box/video.h>
|
||||
|
||||
double mouse_sensitivity = 1.0;
|
||||
double mouse_x_error = 0.0, mouse_y_error = 0.0;
|
||||
}
|
||||
|
||||
struct mouseinputdata {
|
||||
@@ -151,8 +152,14 @@ RendererStack::mousePoll()
|
||||
#endif
|
||||
this->mouse_poll_func();
|
||||
|
||||
mouse_x *= mouse_sensitivity;
|
||||
mouse_y *= mouse_sensitivity;
|
||||
double scaled_x = mouse_x * mouse_sensitivity + mouse_x_error;
|
||||
double scaled_y = mouse_y * mouse_sensitivity + mouse_y_error;
|
||||
|
||||
mouse_x = static_cast<int>(scaled_x);
|
||||
mouse_y = static_cast<int>(scaled_y);
|
||||
|
||||
mouse_x_error = scaled_x - mouse_x;
|
||||
mouse_y_error = scaled_y - mouse_y;
|
||||
}
|
||||
|
||||
int ignoreNextMouseEvent = 1;
|
||||
|
||||
Reference in New Issue
Block a user