Intent to implement: Touchpad event

59 views
Skip to first unread message

Kershaw Chang

unread,
Sep 11, 2014, 2:18:58 AM9/11/14
to dev-platform, dev-webapi
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


Ms2ger

unread,
Sep 11, 2014, 4:26:45 AM9/11/14
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/11/2014 08:18 AM, Kershaw Chang wrote:

First of all, you neglected to explain the standardization situation
here. Is this feature being standardized? If not, why not? How do
other browser vendors feel about it?

> +interface TouchPadEvent : UIEvent { + [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);

Regardless of whether this feature is something we'd want to
implement, we most definitely shouldn't introduce new init*Event methods.

Ms2ger
-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJUEVzEAAoJEOXgvIL+s8n2YWYH/i9h3e3GvQ9dPrYYg72F/mdD
BXdyHiyKarz4dSI8H0UJHwDhCtBKi92AskHhCeT3l4KX4h7pX87144LYNYiZ9qzv
rMXDFvf5Oo8M4uaEPo82z1M2OW6jADuFCfs4SeK+1aqW5DLRRMlYiGfop4yeGp+g
m81ciytaLr08ro6+K+HgIP/zCo5KLtvp54kGLRg0EMqWnNE4SxG8Nrvm/xe65udz
+3z21DhapAu8jMFhJ2JeAy+0ivu0pnCm0JUXiLmOCmzweSlO1w3Qr5KGwWqS9qjA
6k74T7+Pp95cFgELK03IvhWyQCHNLhPdH/qJex59jF2i7N9SV47FGMOq8wjLFBU=
=UeuN
-----END PGP SIGNATURE-----

Mounir Lamouri

unread,
Sep 11, 2014, 6:49:44 AM9/11/14
to Ms2ger, dev-pl...@lists.mozilla.org
On Thu, 11 Sep 2014, at 18:26, Ms2ger wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 09/11/2014 08:18 AM, Kershaw Chang wrote:
>
> First of all, you neglected to explain the standardization situation
> here. Is this feature being standardized? If not, why not? How do
> other browser vendors feel about it?

Where does this stand in the current Touch Events vs Pointer Events
situation, is the intent to re-use of those or create yet another
standard?

-- Mounir

Kershaw Chang

unread,
Sep 11, 2014, 10:00:55 AM9/11/14
to Ms2ger, dev-pl...@lists.mozilla.org
Hi Ms2ger,

Please see my response below.

Thanks and regards,
Kershaw

於 2014/9/11 下午4:26,"Ms2ger" <ms2...@gmail.com> 寫道:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On 09/11/2014 08:18 AM, Kershaw Chang wrote:
>
>First of all, you neglected to explain the standardization situation
>here. Is this feature being standardized? If not, why not? How do
>other browser vendors feel about it?
Sorry that I missed the standardization part.
I think this feature is not standardized, since I cannot find any
discussion or draft from w3c or whatwg. The most closed is that Google
defines one input source type for touchpad in AOSP.

In most cases, I think the inputs from touchpad can be translated to touch
event or mouse event. Only few applications need the raw data from
touchpad. That’s why we don’t see others discussing about this.


>
>> +interface TouchPadEvent : UIEvent { + [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);
>
>Regardless of whether this feature is something we'd want to
>implement, we most definitely shouldn't introduce new init*Event methods.
Thanks for this suggestion. Actually, this webidl is copied from touch
event. I don’t quite understand about this. Could you please explain more?

>
>Ms2ger
>-----BEGIN PGP SIGNATURE-----
>
>iQEcBAEBAgAGBQJUEVzEAAoJEOXgvIL+s8n2YWYH/i9h3e3GvQ9dPrYYg72F/mdD
>BXdyHiyKarz4dSI8H0UJHwDhCtBKi92AskHhCeT3l4KX4h7pX87144LYNYiZ9qzv
>rMXDFvf5Oo8M4uaEPo82z1M2OW6jADuFCfs4SeK+1aqW5DLRRMlYiGfop4yeGp+g
>m81ciytaLr08ro6+K+HgIP/zCo5KLtvp54kGLRg0EMqWnNE4SxG8Nrvm/xe65udz
>+3z21DhapAu8jMFhJ2JeAy+0ivu0pnCm0JUXiLmOCmzweSlO1w3Qr5KGwWqS9qjA
>6k74T7+Pp95cFgELK03IvhWyQCHNLhPdH/qJex59jF2i7N9SV47FGMOq8wjLFBU=
>=UeuN
>-----END PGP SIGNATURE-----
>_______________________________________________
>dev-platform mailing list
>dev-pl...@lists.mozilla.org
>https://lists.mozilla.org/listinfo/dev-platform


Kershaw Chang

unread,
Sep 11, 2014, 10:09:01 AM9/11/14
to Mounir Lamouri, Ms2ger, dev-pl...@lists.mozilla.org
Hi Mounir,

The finger activity on touchpad can be still translated to touch event and
mouse event as usual. But for the application that wants to know the
absolute finger position on touchpad, we will need this new touchpad event.
So, this proposal is about creating new standard rather than re-using.

Best regards,
Kershaw

於 2014/9/11 下午6:49,"Mounir Lamouri" <mou...@lamouri.fr> 寫道:

>On Thu, 11 Sep 2014, at 18:26, Ms2ger wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 09/11/2014 08:18 AM, Kershaw Chang wrote:
>>
>> First of all, you neglected to explain the standardization situation
>> here. Is this feature being standardized? If not, why not? How do
>> other browser vendors feel about it?
>
>Where does this stand in the current Touch Events vs Pointer Events
>situation, is the intent to re-use of those or create yet another
>standard?
>
>-- Mounir

Jonas Sicking

unread,
Sep 11, 2014, 1:22:53 PM9/11/14
to Kershaw Chang, dev-webapi, dev-platform
Hi Kershaw,

Has there been any discussions with other browser vendors about this
API? Or is there an official standard somewhere for them?

If not, I don't think that we'll want to expose this to the web at
large. It would still be fine to expose to certified apps, or even to
expose to privileged apps under a permission.

Does this sound ok?

/ Jonas

On Wed, Sep 10, 2014 at 11:18 PM, Kershaw Chang <kec...@mozilla.com> wrote:
> 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
> + [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-webapi mailing list
> dev-w...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-webapi

Chris Peterson

unread,
Sep 11, 2014, 1:26:09 PM9/11/14
to
AFAIK, Blink does not intend [1] to implement Pointer Events. Should new
web features avoid extending Pointer Events?


chris

[1] https://code.google.com/p/chromium/issues/detail?id=162757#c64

smaug

unread,
Sep 11, 2014, 5:50:27 PM9/11/14
to Chris Peterson
On 09/11/2014 08:26 PM, Chris Peterson wrote:
> On 9/11/14 3:49 AM, Mounir Lamouri wrote:
>> On Thu, 11 Sep 2014, at 18:26, Ms2ger wrote:
>>> First of all, you neglected to explain the standardization situation
>>> here. Is this feature being standardized? If not, why not? How do
>>> other browser vendors feel about it?
>>
>> Where does this stand in the current Touch Events vs Pointer Events
>> situation, is the intent to re-use of those or create yet another
>> standard?
>
> AFAIK, Blink does not intend [1] to implement Pointer Events. Should new web features avoid extending Pointer Events?
>


Unclear. We should still push for pointer events if just possible.
Blink hasn't proposed anything better and their reasoning to drop pointer events doesn't make sense.
But the situation is a bit tricky atm. TouchEvents API is worse than Pointer Events and web devs seem to prefer
pointer events model, so do I, but if blink won't have pointer events...


-Olli



>
> chris
>
> [1] https://code.google.com/p/chromium/issues/detail?id=162757#c64

smaug

unread,
Sep 11, 2014, 5:52:07 PM9/11/14
to
What would be the event types for touchpad events?
We must not add yet another types of events to handle pointer type of events.


And besides, touch event model is rather horrible, so if we for some strange reason need
totally new events, I'd prefer using something closer to pointer events.


-Olli




On 09/11/2014 09:18 AM, Kershaw Chang wrote:
> 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

smaug

unread,
Sep 11, 2014, 5:54:02 PM9/11/14
to
If we just needs new coordinates, couldn't we extend the existing event interfaces with some new properties?


-Olli

Ehsan Akhgari

unread,
Sep 11, 2014, 6:21:23 PM9/11/14
to smaug, dev-pl...@lists.mozilla.org
On 2014-09-11, 5:54 PM, smaug wrote:
> If we just needs new coordinates, couldn't we extend the existing event interfaces with some new properties?

Yeah, this seems like the way to go to me as well.

Jonas Sicking

unread,
Sep 11, 2014, 7:02:03 PM9/11/14
to Ehsan Akhgari, dev-platform, smaug
On Thu, Sep 11, 2014 at 3:21 PM, Ehsan Akhgari <ehsan....@gmail.com> wrote:
> On 2014-09-11, 5:54 PM, smaug wrote:
>> If we just needs new coordinates, couldn't we extend the existing event interfaces with some new properties?
>
> Yeah, this seems like the way to go to me as well.

Do we currently dispatch pointer events on desktop when the user
places a finger on a laptop touchpad? Or do we just dispatch events
when the user then moves the finger and thus move the on-screen
"pointer"?

If we only dispatch events to indicate pointer movement, then I don't
think simply extending existing interfaces will be possible.

Similarly, what happens if you touch multiple fingers to the touchpad?
Do we fire events as the second and third finger is placed on the
touchpad? If not, we similarly need additional events to be fired.

/ Jonas

Kershaw Chang

unread,
Sep 12, 2014, 5:56:57 AM9/12/14
to Jonas Sicking, dev-webapi, dev-platform
Hi Jonas,

That’s a good point.
I agree with you that we should only expose this to certified or
privileged apps.

Thanks and regards,
Kershaw

於 2014/9/12 上午1:22,"Jonas Sicking" <jo...@sicking.cc> 寫道:

>Hi Kershaw,
>
>Has there been any discussions with other browser vendors about this
>API? Or is there an official standard somewhere for them?
>
>If not, I don't think that we'll want to expose this to the web at
>large. It would still be fine to expose to certified apps, or even to
>expose to privileged apps under a permission.
>
>Does this sound ok?
>
>/ Jonas
>
>On Wed, Sep 10, 2014 at 11:18 PM, Kershaw Chang <kec...@mozilla.com>
>wrote:
>> 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

Ehsan Akhgari

unread,
Sep 12, 2014, 3:08:57 PM9/12/14
to Jonas Sicking, dev-platform, smaug
On Thu, Sep 11, 2014 at 7:02 PM, Jonas Sicking <jo...@sicking.cc> wrote:

> On Thu, Sep 11, 2014 at 3:21 PM, Ehsan Akhgari <ehsan....@gmail.com>
> wrote:
> > On 2014-09-11, 5:54 PM, smaug wrote:
> >> If we just needs new coordinates, couldn't we extend the existing event
> interfaces with some new properties?
> >
> > Yeah, this seems like the way to go to me as well.
>
> Do we currently dispatch pointer events on desktop when the user
> places a finger on a laptop touchpad? Or do we just dispatch events
> when the user then moves the finger and thus move the on-screen
> "pointer"?
>

I'm not sure about our implementation, but if I'm reading the spec
correctly, we should be firing an event when you place your first finger on
the touchpad.


> If we only dispatch events to indicate pointer movement, then I don't
> think simply extending existing interfaces will be possible.
>
> Similarly, what happens if you touch multiple fingers to the touchpad?
> Do we fire events as the second and third finger is placed on the
> touchpad? If not, we similarly need additional events to be fired.
>

Again, if I'm reading the spec correctly, we should be firing multiple
events in that case.

--
Ehsan
Reply all
Reply to author
Forward
0 new messages