Bug 861 - NEWT: Unify MouseEvent Processing incl. gesture processing
Summary: NEWT: Unify MouseEvent Processing incl. gesture processing
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on:
Blocks: 800
  Show dependency treegraph
 
Reported: 2013-10-15 13:54 CEST by Sven Gothel
Modified: 2013-10-18 02:31 CEST (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
bc72e232a4b74c2be8c91c540a7b6153bfefb8c0 b831ebadcaea1eea7370f7ec0bffc59eaba7a5ba 56322e1cf41bbb5bcc097164fb3ddcc0061c1c73 40863632d1428de015099b5967e5136425e99f25 a90bf31f8747dd38c61d518f8af4d4d4a64a8e90 c9837ef133ff3465d9b06f1907a7a320181ec97c 202834f148e0eb8c435af02850085d582b3006a4 8815245ebb9efc6d49052ff1fb34a3ee6ecfcc6b d9fba0ea89ae71ce29fb528593fee24707b896ad 0eceb7df4b04a183a738474c0d7f4be41b6bcc0c 2ebf1bf35928e35ded6e38df64dee7aa578ae3c7
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2013-10-15 13:54:48 CEST
Currently we process MouseEvents within NEWT as follows:

  sendMouseEvent/enqueueMouseEvent -> doMouseEvent,
     - called by native code to be delivered via consumeMouseEvent (now or later)
     - events are validated (move/drag, boundaries)
     - missing events are synthesized (click, enter, ..)

as well as in several factories, i.e.:
    - AWTNewtEventFactory (1:1)

    - AndroidNewtEventFactory 
       - synthesized events .. (click, ..)
       - android typed gesture detection (drag -> 1 finger scroll..)

The latter enqueues events do Window/Display directly to be consumed by WindowImpl.

Then users may have their own gesture detection etc.

+++

Solution shall unify event processing within NEWT via consumeEvent(..)
which represents a common entry point.

Gesture processing shall happen w/ NEWT type and 
a common infrastructure (GestureHandler, -Listener and -Event)
shall be supplied to allow:
  - impl. default gesture handlers (can be disabled)
  - user to add/remove gesture-handler and -listener 

the gesture-listener shall react on gesture-events.

+++

This allows our impl. to scale well, 
_especially_ in the advent of supporting more multiple pointer devices (-> Win7/Win8, X11, ..).
Comment 1 Sven Gothel 2013-10-17 16:46:15 CEST
More unification of PointerEvent (mouse, pointer) processing.

56322e1cf41bbb5bcc097164fb3ddcc0061c1c73:    
    - Clarify 'Multiple-Pointer' w/ button[mask] semantics
    
      - Pointer IDs start w/ 0 and are consecutive numbers.
    
      - 'button' == triggering pointer-ID
    
      - buttonMask in modifiers show pressed button _and_ pointer-IDs
    
    - deprecated BUTTON_NUMBER -> use BUTTON_COUNT (name semantics)

a90bf31f8747dd38c61d518f8af4d4d4a64a8e90:    
    Unify event processing in new doPointerEvent(..), which is also invoked from doMouseEvent(..),
    and consumePointerEvent().
    
    doPointerEvent(..): Validates and modifies event data and finally creates the event,
    where consumePointerEvent(..) calls gesture handlers and may synthesize events.
    
    Unifies native mouse and Android's pointer event, ready for Win7 touch.
    AndroidNewtEventFactory calls doPointerEvent(..) directly.
    
    Removed lots of duplicated pointer event handling code.
Comment 2 Sven Gothel 2013-10-17 18:07:54 CEST
202834f148e0eb8c435af02850085d582b3006a4:
    Refine Int -> Enum conversion (commit 40863632d1428de015099b5967e5136425e99f25)
      - throw IllegalArgumentException if ordinal is out-of-range. Add API doc.
    
    - FFMPEGNatives
    - MouseEvent.PointerType
Comment 3 Sven Gothel 2013-10-17 20:04:05 CEST
WindowImpl.doPointerEvent(..) Simplify pointer name->ID mapping, fix DEBUG.
Comment 4 Sven Gothel 2013-10-18 02:31:19 CEST
Clarify button-number and pointer-ID relation incl. case 'no button/pointer', i.e. button == 0, pointer-ID == -1
    
    doPointerEvent:
      - allow id==-1 -> button==0 for no button, i.e. mouse move
    
    doMouseEvent:
      - keep button 0 value, i.e. map to pointer-ID -1