Translate mouse coordinates correctly in hidpi modes. Hide cursor when SuperScope enabled.

This commit is contained in:
Brandon Wright 2018-05-23 15:50:57 -05:00
parent 8fd6346d3d
commit c555b07846
2 changed files with 9 additions and 3 deletions

View File

@ -141,7 +141,7 @@ S9xIsMousePluggedIn (void)
for (int i = 0; i <= 1; i++)
{
S9xGetController (i, &ctl, &id1, &id2, &id3, &id4);
if (ctl == CTL_MOUSE)
if (ctl == CTL_MOUSE || ctl == CTL_SUPERSCOPE)
return true;
}

View File

@ -230,12 +230,18 @@ event_motion_notify (GtkWidget *widget,
return FALSE;
}
#if GTK_CHECK_VERSION(3,10,0)
int scale_factor = gdk_window_get_scale_factor (gtk_widget_get_window (GTK_WIDGET (window->get_window ())));
#else
int scale_factor = 1;
#endif
window->mouse_loc_x = (uint16)
((int) (event->x) - window->mouse_region_x) * 256 /
((int) (event->x * scale_factor) - window->mouse_region_x) * 256 /
(window->mouse_region_width <= 0 ? 1 : window->mouse_region_width);
window->mouse_loc_y = (uint16)
((int) (event->y) - window->mouse_region_y) * SNES_HEIGHT_EXTENDED /
((int) (event->y * scale_factor) - window->mouse_region_y) * (gui_config->overscan ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) /
(window->mouse_region_height <= 0 ? 1 : window->mouse_region_height);
if (!window->config->pointer_is_visible)