1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2025-03-03 17:48:51 -05:00

Fix translation of Win32 touch positions

This commit is contained in:
Camilla Berglund 2012-04-25 23:56:21 +02:00
parent b3e015d212
commit b55db82f09

View File

@ -598,20 +598,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
count, inputs, sizeof(TOUCHINPUT)))
{
UINT i;
int width, height;
int width, height, xpos, ypos;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformGetWindowPos(window, &xpos, &ypos);
for (i = 0; i < count; i++)
{
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
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 ||
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)
{
_glfwInputTouchPos(window, (int) inputs[i].dwID,
inputs[i].x / 100.0,
inputs[i].y / 100.0);
inputs[i].x / 100.0 - xpos,
inputs[i].y / 100.0 - ypos);
}
}