More mouse fixes.
This commit is contained in:
@@ -168,7 +168,11 @@ mouse_clear_buttons(void)
|
|||||||
static double
|
static double
|
||||||
mouse_scale_coord_x(double x, int mul)
|
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)
|
if (mul)
|
||||||
x *= ratio;
|
x *= ratio;
|
||||||
@@ -181,7 +185,11 @@ mouse_scale_coord_x(double x, int mul)
|
|||||||
static double
|
static double
|
||||||
mouse_scale_coord_y(double y, int mul)
|
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)
|
if (mul)
|
||||||
y *= ratio;
|
y *= ratio;
|
||||||
@@ -386,6 +394,8 @@ mouse_scale_y(int y)
|
|||||||
void
|
void
|
||||||
mouse_scale(int x, int y)
|
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_x(x);
|
||||||
mouse_scale_y(y);
|
mouse_scale_y(y);
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ ps2_report_coordinates(atkbc_dev_t *dev, int main)
|
|||||||
|
|
||||||
mouse_subtract_coords(&delta_x, &delta_y, &overflow_x, &overflow_y,
|
mouse_subtract_coords(&delta_x, &delta_y, &overflow_x, &overflow_y,
|
||||||
-256, 255, 1, 0);
|
-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) |
|
buff[0] |= (overflow_y << 7) | (overflow_x << 6) |
|
||||||
((delta_y & 0x0100) >> 3) | ((delta_x & 0x0100) >> 4) |
|
((delta_y & 0x0100) >> 3) | ((delta_x & 0x0100) >> 4) |
|
||||||
|
@@ -279,7 +279,7 @@ sermouse_report_ms(mouse_t *dev)
|
|||||||
int b = mouse_get_buttons_ex();
|
int b = mouse_get_buttons_ex();
|
||||||
|
|
||||||
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0);
|
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] = 0x40;
|
||||||
dev->buf[0] |= (((delta_y >> 6) & 0x03) << 2);
|
dev->buf[0] |= (((delta_y >> 6) & 0x03) << 2);
|
||||||
|
Reference in New Issue
Block a user