Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7 Touch Screen + Java Swing = Delayed Mouse Events

I am developing a Swing application in Java. The program is to be run on dedicated Windows 7 Touch Screen machines, and as far as I know, this program should be the only thing running on them under normal operation.

I've noticed that Windows 7's touch screen interface has this thing where it will hold back mousedown events. Due to the "tap-and-hold right click" gesture, Windows 7 won't actually send the application a mouse down event until:

  • the user "touch ups" (raise their finger from a touch, at which point both down and up are sent)
  • moves their finger (at which point the click becomes a drag)
  • or the right click circle gesture times out (after about 5-6 seconds)

Trivially, this means that buttons don't look depressed on the application until the mouse down event is sent (and never draw depressed at all with a quick tap). But, recently, more seriously, this means functionality that requires a press-and-hold cannot happen without major amounts of confusion to the average user.

At this point in development it is far too late to turn around and start from scratch with one of the many touch libraries offered on other questions. (They require redoing the entire application in their component hierarchy, and that simply isn't feasible. Plus things coded to use mouse events would then have to be recoded using touch events, and we don't really need multi-touch...)

Yes, I have attempted to simply turn off the touch-and-hold right click gesture. Unfortunately, doing so simply disables the drawing of a circle indicating a right click gesture around your finger and the fire of the subsequent right click. It does NOT remove the underlying problem: the delayed mouse down event for up to six seconds.

My Question: Is there a way to:

  • Ideally, indicate to Windows that my application is a touch-ready application, so it sends down events immediately (but, I suppose, still send mouse events instead of touch events)? I can see that the built-in soft keyboard works correctly, it seems. I just want my Java application to do the same.
  • Disable the delay entirely on the computer, but still provide basic touch functionality?
  • Potentially something as simple as this question, which seems to be asking about the same phenomenon, but in Java?
like image 515
Tustin2121 Avatar asked Jan 11 '14 05:01

Tustin2121


1 Answers

Typically this type of behavior is controlled by the touch device driver installed on the device. All of the touch manufacturers I have seen have control panel apps that allow you to customize touch behavior. So for instance you can tell the driver to send a mouse click immediately up receipt of a touch rather than delaying briefly in order to prevent an incidental touch from initiating an input event.

like image 125
JJF Avatar answered Nov 15 '22 14:11

JJF