Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Latest webkit uses Long for Touch.identifier, while IDL specifies Word #5

Open
matthewbauer opened this issue Jul 15, 2020 · 2 comments

Comments

@matthewbauer
Copy link

matthewbauer commented Jul 15, 2020

On my iOS device, I consistently get identifiers like 1757034706 and -1260722569, while the haskell bindings think it should be Word. This ends up making it impossible to keep track of individual touch events.

/cc @hamishmack

Touch.idl looks like this:

[
    Conditional=TOUCH_EVENTS,
    ImplementationLacksVTable
] interface Touch {
    readonly attribute long                clientX;
    readonly attribute long                clientY;
    readonly attribute long                screenX;
    readonly attribute long                screenY;
    readonly attribute long                pageX;
    readonly attribute long                pageY;
    readonly attribute EventTarget         target;
    readonly attribute unsigned long       identifier;
    readonly attribute long                webkitRadiusX;
    readonly attribute long               webkitRadiusY;
    readonly attribute unrestricted float webkitRotationAngle;
    readonly attribute unrestricted float webkitForce;
};

while GHCJS.DOM.JSFFI.Generated.Touch has this:

https://github.com/ghcjs/ghcjs-dom/blob/b8e483adef0cea66d081c1a014e87c6f99eb29fc/ghcjs-dom-jsffi/src/GHCJS/DOM/JSFFI/Generated/Touch.hs#L83-L88

foreign import javascript unsafe "$1[\"identifier\"]"
        js_getIdentifier :: Touch -> IO Word

-- | <https://developer.mozilla.org/en-US/docs/Web/API/Touch.identifier Mozilla Touch.identifier documentation> 
getIdentifier :: (MonadIO m) => Touch -> m Word
getIdentifier self = liftIO (js_getIdentifier self)
@matthewbauer
Copy link
Author

matthewbauer commented Jul 15, 2020

it looks like this may be the culprit:

tyRet' _ _ _ (I.TyApply (I.TySigned False) (I.TyInteger _)) _ = mkTIdent "Word"

and

I.TyApply (I.TySigned False) (I.TyInteger _) -> (mkTIdent "Word",[])

@matthewbauer
Copy link
Author

It looks like webkit has the wrong value, it should be signed:

https://www.w3.org/TR/touch-events/#idl-def-Touch

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant