mirror of
https://github.com/gwm17/glfw.git
synced 2025-04-12 03:28:52 -04:00
Fix translation of Win32 touch positions
This commit is contained in:
parent
b3e015d212
commit
b55db82f09
|
@ -598,20 +598,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
count, inputs, sizeof(TOUCHINPUT)))
|
count, inputs, sizeof(TOUCHINPUT)))
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
int width, height;
|
int width, height, xpos, ypos;
|
||||||
|
|
||||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||||
|
_glfwPlatformGetWindowPos(window, &xpos, &ypos);
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
POINT pos;
|
POINT pos;
|
||||||
|
pos.x = TOUCH_COORD_TO_PIXEL(inputs[i].x) - xpos;
|
||||||
|
pos.y = TOUCH_COORD_TO_PIXEL(inputs[i].y) - ypos;
|
||||||
|
|
||||||
// Discard any points that lie outside of the client area
|
// Discard any points that lie outside of the client area
|
||||||
|
|
||||||
pos.x = TOUCH_COORD_TO_PIXEL(inputs[i].x);
|
|
||||||
pos.y = TOUCH_COORD_TO_PIXEL(inputs[i].y);
|
|
||||||
ScreenToClient(window->win32.handle, &pos);
|
|
||||||
|
|
||||||
if (pos.x < 0 || pos.x >= width ||
|
if (pos.x < 0 || pos.x >= width ||
|
||||||
pos.y < 0 || pos.y >= height)
|
pos.y < 0 || pos.y >= height)
|
||||||
{
|
{
|
||||||
|
@ -625,8 +623,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
else if (inputs[i].dwFlags & TOUCHEVENTF_MOVE)
|
else if (inputs[i].dwFlags & TOUCHEVENTF_MOVE)
|
||||||
{
|
{
|
||||||
_glfwInputTouchPos(window, (int) inputs[i].dwID,
|
_glfwInputTouchPos(window, (int) inputs[i].dwID,
|
||||||
inputs[i].x / 100.0,
|
inputs[i].x / 100.0 - xpos,
|
||||||
inputs[i].y / 100.0);
|
inputs[i].y / 100.0 - ypos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user