Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430940

Summary: Suppress emulated mouse wheel scroll events on devices that support touch
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF FXAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact: Alexander Nyßen <nyssen>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 3.10.0 (Mars) M6   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Alexander Nyßen CLA 2014-03-22 14:59:54 EDT
As indicated by Jan when providing his SwtToFXGestureConverter contribution (see bug #427106), at least on the Mac, emulated vertical scroll events (with a granularity of 40) originating from mouse wheel events are forwarded to the FXCanvas in additional to the scroll events (with granularity of 5) that originate from 'real' scroll gesture events. 

We should provide a means to suppress these kinds of events on devices that support touch gestures, because there the 'real' touch gesture events should be pretty much sufficient. I can however only properly test the behavior on Mac, where vertical scroll events are emulated (but no horizontal ones).
Comment 1 Alexander Nyßen CLA 2014-03-22 15:15:35 EDT
Added an SWT event filter to suppress mouse wheel events on devices that support touch (Display#getTouchEnabled()). While on Mac (where I could observe the synthetic events and could test the correct behavior with the applied filter), only vertical mouse wheel events seem to be transferred to the FXCanvas, I added the suppress filter also for horizontal mouse wheel events and for all touch devices (i.e. Display#getTouchEnabled() == true), just in case this occurs on other platforms as well (which I cannot confirm on my machine). We will have to test that the behavior is valid on other platforms than Mac to see if the behavior has to be adjusted in a platform-specific way.
Comment 2 Alexander Nyßen CLA 2014-07-16 07:55:21 EDT
I assume there are no problems on other platforms and thus resolve it as fixed. We may reopen in case any problems are faced.
Comment 3 Alexander Nyßen CLA 2014-08-11 16:29:21 EDT
Change component to FX, as SwtFX is succeeded by FX.UI.
Comment 4 Alexander Nyßen CLA 2015-02-03 13:08:10 EST
When scrolling via mouse wheel on devices where touch is enabled (display.isTouch()), the current workaround will not forward any valid scroll events (at least on the Mac). 

There, only scroll events with zero delta-x- and delta-y are delivered. Nevertheless, using the mouse wheel on such a platform is a valid gesture. Thus reopening this.
Comment 5 Alexander Nyßen CLA 2015-02-03 13:42:08 EST
I now re-implemented the solution two be based on two filters (mouse wheel and pan gesture) that filter out:
1) (invalid) pan gesture events that are emulated from mouse wheel events (they will provide a delta of 0 for x and y direction)
2) mouse wheel events that are emulated from pan gesture events (on devices that support touch); they can only be sorted out by keeping track of previous pan gesture events with the same x and y location.

Verified that the behavior is now as desired on Mac, both using the mouse wheel as well as the touchpad: in both situations, appropriate JavaFX scroll events are now generated (while the step-width in case of gesture events is 5, and in case of mouse wheel events is 40).
Comment 6 Alexander Nyßen CLA 2015-03-24 03:01:58 EDT
Resolving as fixed in 3.10.0M6.