Windows touch issue / bug

Hi Jules,

i've some problems with touch events on Windows.
I get for every touch-down event two clicks instead of one. Not easy to explan, just check the video (it's not my language, excuse me.) 

EDIT: video removed, write me a pm if you like to watch it.

Tested with Windows 7 & 8 (Win 10 or XP not tested (and also not tested on Mac or Linux). The Introjucer is the precompiled version from the Windows package (downloaded today), to be sure it's not a problem on my side.
Not sure if we have the same issues with Windows tablets.

Is this already reported? Did not found anything.

Cheers

Found something in the forum: http://www.juce.com/forum/topic/win-81-touch-input-no-call-mousedown-until-dragging

After drag we get a 3rd click.

Here a first result which works, but is still NOT correct! I don't know anything about the windows windowing... Just try and error...

 // juce_win32_Windowing.cpp

 LRESULT doTouchEvent (const int numInputs, HTOUCHINPUT eventHandle)
 {
    ...
    for (int i = numInputs < 2 ? 1 : 0 ; i < numInputs; ++i)
    {
      const DWORD flags = inputInfo[i].dwFlags;

      if ((flags & (TOUCHEVENTF_DOWN | TOUCHEVENTF_MOVE | TOUCHEVENTF_UP)) != 0)
        if (! handleTouchInput (inputInfo[i], (flags & TOUCHEVENTF_PRIMARY) != 0, (flags & TOUCHEVENTF_DOWN) != 0, (flags & TOUCHEVENTF_UP) != 0))
                        return 0;  // abandon method if this window was deleted by the callback
    }
    ...
}

Little moment, trying the next hack. Somethere is something really wrong...
Have to reboot each time. Isn't good!

 

Crazy. Windows seems to send a primary and another same event for a simple touch event.


for (int i = 0 ; i < numInputs; ++i) { 
  const DWORD flags = inputInfo[i].dwFlags; 
  
  if( numInputs < 2 && (flags & TOUCHEVENTF_PRIMARY) != 0 )
    continue;

  if ((flags & (TOUCHEVENTF_DOWN | TOUCHEVENTF_MOVE | TOUCHEVENTF_UP)) != 0) 
    if (! handleTouchInput (inputInfo[i], (flags & TOUCHEVENTF_PRIMARY) != 0, (flags & TOUCHEVENTF_DOWN) != 0, (flags & TOUCHEVENTF_UP) != 0)) 
      return 0; // abandon method if this window was deleted by the callback 
}

This seems to work correct.

Suggestions?

Can anybody test this too? Windows 10?
What is with Win7/8 32bit -> I've 64x only to test. And no touch support configured for VMWARE or VirtualBox...
Can anybody test this with a Windows mobile device? Don't have such a thing here...

Jules, do you have a multi touch screen in your lab?

Cheers

 

Edit: if( numInputs < 2 && (flags & TOUCHEVENTF_PRIMARY) != 0 ) instead of ==

I vaguely remember fixing this once before on my Surface, didn't think there were still any problems. I'm not convinced by your suggested fix though - what's the idea behind it?

We get two mouse down and two mouse up events on a single touch, but we don't get it on a multi touch action. I only know this...

This should not be the code for a checkin, but it shows the problem we have...

For a single touch event this does also work:


for (int i = 1 ; i < numInputs; ++i)

But then the multitouch does not work correctly.

I'm struggling with the Windows 8.1 and Windows 10 touch screen too. So, is that the final solution? or could we expect any improvements in future Juce versions?

OK I've just pushed a fix for this. You should now be getting mouseDown events immediately (without delay) and no double events. Can you confirm that the latest tip works for you?

Thank you Fabian, it works fine with the most of elements. There is a small exception: with the MidiKeyboardComponent it does not work, but for my needs is enough.