Hi All, Summary: Touchpad(trackpad) is a common feature on laptop computers. Currently, the finger activities on touchpad are translated to touch event and mouse event. However, the coordinates of touch event and mouse event are actually associated to display [1]. For some cases, we need to expose the absolute coordinates that are associated to touchpad itself to the application. That’s why AOSP also defines another input source type for touchpad [2]. The x and y coordinates of touchpad event are relative to the size of touchpad.
Use case: Handwriting recognition application will be benefited from this touchpad event. Currently, OS X supports handwriting input by touchpad [3]. Idea of implementation: The webidl of touchpad event is like touch event except that x and y coordinates are relative to touchpad rather than display. --- /dev/null +++ b/dom/webidl/Touchpad.webidl + +[Func="mozilla::dom::Touchpad::PrefEnabled"] +interface Touchpad { + readonly attribute long identifier; + readonly attribute EventTarget? target; + readonly attribute long touchpadX; + readonly attribute long touchpadY; + readonly attribute long radiusX; + readonly attribute long radiusY; + readonly attribute float rotationAngle; + readonly attribute float force; +}; --- /dev/null +++ b/dom/webidl/TouchpadEvent.webidl + +interface WindowProxy; + +[Func="mozilla::dom::TouchpadEvent::PrefEnabled"] +interface TouchPadEvent : UIEvent { + readonly attribute TouchpadList touches; + readonly attribute TouchpadList targetTouches; + readonly attribute TouchpadList changedTouches; + + readonly attribute short button; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + + [Throws] + void initTouchpadEvent(DOMString type, + boolean canBubble, + boolean cancelable, + WindowProxy? view, + long detail, + short button, + boolean ctrlKey, + boolean altKey, + boolean shiftKey, + boolean metaKey, + TouchPadList? touches, + TouchPadList? targetTouches, + TouchPadList? changedTouches); +}; --- /dev/null +++ b/dom/webidl/TouchpadList.webidl + +[Func="mozilla::dom::TouchpadList::PrefEnabled"] +interface TouchpadList { + [Pure] + readonly attribute unsigned long length; + getter Touchpad? item(unsigned long index); +}; + +/* Mozilla extension. */ +partial interface TouchpadList { + Touchpad? identifiedTouch(long identifier); +}; Platform converge: all Welcome for any suggestion or feedback. Thanks. [1] http://developer.android.com/reference/android/view/InputDevice.html#SOURCE_ CLASS_POINTER [2] http://developer.android.com/reference/android/view/InputDevice.html#SOURCE_ CLASS_POSITION [3] http://support.apple.com/kb/HT4288 Best regards, Kershaw _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform