diff --git a/src/device/mouse.c b/src/device/mouse.c index 5250e5125..ae68353fc 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -168,7 +168,11 @@ mouse_clear_buttons(void) static double mouse_scale_coord_x(double x, int mul) { - double ratio = (double) monitors[0].mon_unscaled_size_x / (double) monitors[0].mon_res_x; + double ratio = 1.0; + + if (!mouse_raw) + ratio = (monitors[0].mon_res_x * plat_get_dpi())/ + ((double) monitors[0].mon_unscaled_size_x); if (mul) x *= ratio; @@ -181,7 +185,11 @@ mouse_scale_coord_x(double x, int mul) static double mouse_scale_coord_y(double y, int mul) { - double ratio = (double) monitors[0].mon_efscrnsz_y / (double) monitors[0].mon_res_y; + double ratio = 1.0; + + if (!mouse_raw) + ratio = (monitors[0].mon_res_y * plat_get_dpi()) / + ((double) monitors[0].mon_efscrnsz_y); if (mul) y *= ratio; @@ -386,6 +394,8 @@ mouse_scale_y(int y) void mouse_scale(int x, int y) { + pclog("DPI = %lf (%lfx%lf)\n", plat_get_dpi(), monitors[0].mon_res_x, monitors[0].mon_res_y); + mouse_scale_x(x); mouse_scale_y(y); } diff --git a/src/device/mouse_ps2.c b/src/device/mouse_ps2.c index 2d0f3c85d..251459199 100644 --- a/src/device/mouse_ps2.c +++ b/src/device/mouse_ps2.c @@ -84,7 +84,7 @@ ps2_report_coordinates(atkbc_dev_t *dev, int main) mouse_subtract_coords(&delta_x, &delta_y, &overflow_x, &overflow_y, -256, 255, 1, 0); - mouse_subtract_z(&delta_z, -8, 7, 1); + mouse_subtract_z(&delta_z, -8, 7, 0); buff[0] |= (overflow_y << 7) | (overflow_x << 6) | ((delta_y & 0x0100) >> 3) | ((delta_x & 0x0100) >> 4) | diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index 0939bf875..91fdd498a 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -279,7 +279,7 @@ sermouse_report_ms(mouse_t *dev) int b = mouse_get_buttons_ex(); mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0); - mouse_subtract_z(&delta_z, -8, 7, 1); + mouse_subtract_z(&delta_z, -8, 7, 0); dev->buf[0] = 0x40; dev->buf[0] |= (((delta_y >> 6) & 0x03) << 2);