{FIXED} Capturing correct tap position on Windows tablet

Posted By: 41Lumber

{FIXED} Capturing correct tap position on Windows tablet - 09/02/15 20:26

It seems like this would be extremely easy, but not so much. If I tap the touch screen on my tablet, it doesn't immediately move mouse_pos. Even if I wait a frame or two, mouse_pos remains at the last tap position, which makes pressing buttons quite unintuitive.

Is there anything I can do, in lite-C or a plugin API, that will get the exact screen position of the most recent touch? I've attempted to process WM_GESTURE but had little success.
Posted By: Ch40zzC0d3r

Re: Capturing correct tap position on Windows tablet - 09/02/15 20:33

GetCursorPos
MSDN: https://msdn.microsoft.com/de-de/library/windows/desktop/ms648390(v=vs.85).aspx

Make sure to only call it once if possible to reduce a waste of function calls
Posted By: Anonymous

Re: Capturing correct tap position on Windows tablet - 09/03/15 06:10

Hey @Ch40zzC0d3r, thanks for being the one to dig into msdn for us these days. It's off subject, but thanks we have so few that can do it these days.
Posted By: 41Lumber

Re: Capturing correct tap position on Windows tablet - 09/03/15 11:54

Nope, same problem, although you did solve another question I've had for some time. Touch screen apparently doesn't set the cursor position right away, so I'm still not sure what to do.
Posted By: Ch40zzC0d3r

Re: Capturing correct tap position on Windows tablet - 09/03/15 13:57

I guess your srceen is not calibrated right then
Posted By: 41Lumber

Re: Capturing correct tap position on Windows tablet - 09/03/15 14:25

Re-calibrated, same results. No other programs display this problem, so I know it's an issue with how I am receiving the touch events.
Posted By: Ch40zzC0d3r

Re: Capturing correct tap position on Windows tablet - 09/03/15 15:14

GetCursorPos retrieves the cursor pos directly from the kernel through some syscalls. You can register a windows hook and check WM_MOUSE.
If that value should be off then your doing something wrong because thats the exact way how normal programs get the cursor positions for the gui.
Posted By: 41Lumber

Re: Capturing correct tap position on Windows tablet - 09/03/15 17:16

End result: Fixed.

Without a mouse interface, Windows apparently does not treat cursor position the same way. In order to properly receive touch events, I had to watch for window message WM_POINTERUPDATE (decimal 581), and retrieve the correct position from the lParam value.
Posted By: Anonymous

Re: Capturing correct tap position on Windows tablet - 09/03/15 17:50

41Lumber is it all right to ask you to share a basic example in the lite-
c contributions section. This way if the question arises in the future from another users, a forum search will yield a thread with a working base example.
Posted By: 41Lumber

Re: Capturing correct tap position on Windows tablet - 09/03/15 18:34

Certainly, I will share that.
© 2024 lite-C Forums