Touch Events, Scrolling, and Windows Pen

Pavel Safrata pavel.safrata at
Mon May 27 09:29:21 PDT 2013

On 27.5.2013 18:09, Pavel Safrata wrote:
> Hi Danno,
> On 27.5.2013 17:27, Danno Ferrin wrote:
>> One of the things that prompted me to write the TouchyFXy application 
>> was
>> to get a feel of the event flow before I embarked on recommending 
>> fixes to
>> some of the quirks.  Here goes.
>> My first concern is touch scrolling on lists.  If you do a touch 
>> scroll on
>> a List you wind up selecting the item you lift your finger off of.  And
>> this is painfully obvious in Ensemble8 on a Surface Pro, you scroll down
>> the screen and BAM you're in a demo if you're not careful where you 
>> start
>> your scroll.  I would propose that at least in the list control, and
>> possibly all controls, that a click/release/down event not be 
>> processed if
>> the 'synthesized' flag is present  This would need to be done in the
>> control logic rather than pushed down through the whole event chain,
>> however..  A general audit may be entertaining, but the one annoying me
>> right now is the select on touch scroll for lists and touch panes.
> I agree and I've filed this issue some time ago:
> it also seems to have a duplicate here:
>> A general solution may be to allow the user to turn off the capture of
>> synthesized events, but I would imagine that would need to be explicitly
>> turned on by the code to maintain backwards compatibility for apps not
>> written with touch in mind.
> You can use event filter to turn off synthesized events. Anyway, I 
> believe controls need to be fixed to respond properly to the events.
> I'll let somebody more familiar with the low-level stuff comment on 
> the other issue.

When you touch the screen with the pen and start dragging, do you get 
both mouse dragging and scrolling? Allowing to avoid double handling of 
this gesture was the main reason for introducing the synthesized flag. 
If you really get only mouse events, then I guess either we need to 
start producing scroll events as well, or the synthesized flag should be 
set to false.


> Thanks,
> Pavel
>> 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.

More information about the openjfx-dev mailing list