Touch Events, Scrolling, and Windows Pen

Anthony Petrov anthony.petrov at
Tue May 28 01:44:11 PDT 2013

Hi Danno,

On 05/27/2013 07:27 PM, Danno Ferrin wrote:
> My next problem is the pen device on Windows.  The only events captured in
> JavaFX from a pen are mouse events.  To complicate things the "Synthesized"
> flag is set.  This is a bit disconcerting because to the view of a JFX app
> there is no other event for it to be synthesized to.  So I would propose
> the isPenEvent method in /glass/glass-lib-windows/src/ViewContainer.cpp be
> added to check that the 0x80 bit is set by changing the signature
> to 0xFF515780 and the mask to 0xFFFFFF80, making a pen event look just like
> a mouse event, since it only generates mouse events. (the linked MSDN
> article in the code explains the lower 8 bits, and the high bit is a
> pen/touch flag, the logic may need to be more complex).  To distinguish a
> pen tap perhaps we set the direct flag but not the synthesized flag, since
> a pen is direct on the screen (usually).
> So am I way off base on these?  Should I work up a patch for these?  Or
> must the current behavior be maintained.

AFAIK, we haven't tested Glass/FX with a Pen device and I doubt we even 
have proper hardware to test it at the moment. So such a patch would 
certainly be welcome. Please feel free to post it on this mailing list 
for a review.

However, we should first decide how we want to process Pen events. They 
are not regular mouse events, nor are they similar to regular touch 
events (though they have a lot in common with the latter). E.g. suppose 
you can control your Surface Pro with a finger using its touch screen. 
These are touch events. Now, you could also connect a USB mouse to this 
device, and that would have to generate regular mouse events. 
Additionally, you could connect a graphic tablet such as a Wacom Bamboo 
for example, and this device would have to generate some special Pen 
events, right?

Should we introduce a new kind of events for Pen events in FX? Or does 
it make sense to use touch events for this purpose? How would we 
distinguish between finger- and pen- based input events in the above 
scenario then?

What other options do we have?

best regards,

More information about the openjfx-dev mailing list