Bug 800 - Add Windows 7 Touch Event Support to Generate NEWT Mouse/Pointer Events
Summary: Add Windows 7 Touch Event Support to Generate NEWT Mouse/Pointer Events
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: windows_8 (show other bugs)
Version: 1
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on: 861
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-05 15:11 CEST by Sven Gothel
Modified: 2013-10-17 23:03 CEST (History)
2 users (show)

See Also:
Type: ---
SCM Refs:
gluegen 43e5b14bfd0d7ec53bd3c7634e6e95af8ea2afb1 jogl 5b96486da0bcd09d5355f89ec551140e508b567c jogl 119133e89831fc837015b3f6fd7b258077c93d46 jogl 3c56d9346b9077b5eb65ec9e111917cfe17e9173
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2013-08-05 15:11:52 CEST
Windows 8 API supports touch events, which shall be supported by NEWT
to generate NEWT's Mouse/Pointer events.

It has to be evaluated whether this goal can be reached by extending the current 
use of the Win32 API (HWND/HDC/..) or whether we are required to add a new 
Windows 8 API binding.
Comment 1 Julien Gouesse 2013-08-05 16:48:47 CEST
Using WM_TOUCH messages should work both under Windows 7 and 8:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd317341%28v=vs.85%29.aspx
Comment 2 Sven Gothel 2013-08-05 17:26:32 CEST
(In reply to comment #1)
> Using WM_TOUCH messages should work both under Windows 7 and 8:
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd317341%28v=vs.
> 85%29.aspx

If that is true .. and multi touch is supported .. I guess we are good - puhh :)
Will check this later on.
Comment 3 Julien Gouesse 2013-08-05 17:30:52 CEST
You can handle the gestures too but with another message.
Comment 4 Sven Gothel 2013-10-13 17:46:05 CEST
GlueGen native compilation: Enable Win 7 definitions via WINVER/_WIN32_NT 0x0601
Comment 5 Sven Gothel 2013-10-14 08:53:36 CEST
Success w/ WM_TOUCH:

- availability detection
- enabling if available
- retrieving multi-touch events
  - multiple pointer per one WM_TOUCH

So the worst scenario, i.e. new windows API is off the table - great.

Now working on parsing the multiple pointer
of one WM_TOUCH to produce a valid NEWT 'pointer event'.
Comment 6 Sven Gothel 2013-10-14 08:54:03 CEST
(validated w/ desktop Win7 and Surface Win8)
Comment 7 Sven Gothel 2013-10-17 20:05:05 CEST
    Native:
     - WindowUserData tracks:
        - window size
        - mouse inside
        - pointer touch-down count
       and flags whether multiple-touch is supported.
    
     - Suppress WM_*BUTTON* events if within TOUCH operations, e.g. fingers are pressed, or
       if event is determined as TOUCH (0 != GetMessageExtraInfo())
    
     - MOUSEMOVE issues NewtWindows_trackPointerLeave(..) directly
       if no TOUCH operation is in process.
       Removes need for MouseListener on Java side.
    
     - TOUCH events are send as follows:
         - PRIMARY first
         - 1 MOVE 2nd (if not sent already)
         - UP/DOWN (if not sent already)
    
       We only send max. one MOVE event, since Win7 / Win8
       assignes MOVE per default, even if no actual move happened.
       Hence a single MOVE event shall suffice and is compatible
       w/ e.g. Android (AFAIK).
    
     - TOUCH pointer names are mapped to consecutive IDs
       on the java side.
Comment 8 Sven Gothel 2013-10-17 23:03:02 CEST
Windows 7 Touch Event Support for NEWT: Fix Focus and LBUTTON[DOWN|UP] issues
    
    - w/ TOUCH, Win8 may steal focus (KILLFOCUS), quickly grab FOCUS again when on TOUCH operation
    
    - track 'touchDownLastUp', and don't act on LBUTTON[UP|DOWN] and MOUSEMOVE if just lifted last finger
    
    - don't use GetMessageExtraInfo() to distinguish MOUSE/TOUCH, simply use tracked touchDownCount
    
    - Also track mouseInside in TOUCH operation, i.e. true if _all_ fingers are inside,
      otherwise don't send TOUCH event