GdkWin32: Ensure a consistent order of operations when handling DPI scale and GDK screen offset

This commit is contained in:
Luca Bacci
2021-09-08 17:51:07 +02:00
parent cac1c7cd22
commit 876a2e6225
7 changed files with 109 additions and 112 deletions

View File

@ -131,26 +131,28 @@ gdk_device_wintab_query_state (GdkDevice *device,
_gdk_win32_get_cursor_pos (&point);
if (root_x)
*root_x = point.x / impl->window_scale;
*root_x = (point.x + _gdk_offset_x) / impl->window_scale;
if (root_y)
*root_y = point.y / impl->window_scale;
*root_y = (point.y + _gdk_offset_y) / impl->window_scale;
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x / impl->window_scale;
if (win_y)
*win_y = point.y / impl->window_scale;
if (window == gdk_get_default_root_window ())
if (window == gdk_screen_get_root_window (screen))
{
if (win_x)
*win_x += _gdk_offset_x;
*win_x = (point.x + _gdk_offset_x) / impl->window_scale;
if (win_y)
*win_y += _gdk_offset_y;
*win_y = (point.y + _gdk_offset_y) / impl->window_scale;
}
else
{
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x / impl->window_scale;
if (win_y)
*win_y = point.y / impl->window_scale;
}
if (child_window)