Friday, July 13, 2012

Multi-touch in WebKit-Clutter

Following my past work on multi-touch support in Clutter, have been playing lately in implementing the W3C Touch Events API in the Clutter port of WebKit.

A lot of code can be reused from WebCore without problems, but we'll need to do some mildly complex event translation because the W3C API and the one in Clutter (and in XInput and in Gtk+) are very different.

But for now, a quick demo of a web page drawing the touch events that it receives, limited to 2 touch points because that's the maximum supported by the hardware I have here:

This is still early work, but once event translation is done, this should be very close to be feature-complete. And a nice side-effect is that given that the touch API in Clutter is so similar to Gtk+'s, it should be pretty straightforward to port it to WebKitGtk+. You can find the code here, but please keep in mind that this is very preliminary work.

As usual, thanks to my employer Collabora for sponsoring this work.


Manuel QuiƱones said...

Hey Tomeu, looks great! What is your webpage using, html5 canvas?

Tomeu Vizoso said...
This comment has been removed by the author.
Tomeu Vizoso said...

Yes, here it is:

Manuel QuiƱones said...

Ah, I see you are using the w3c touch events in the javascript. Nice, thanks.

joone said...

Hi Tomeu,

Nice work!

Is there any way to run this multi-touch demo on Linux laptop?

Tomeu Vizoso said...

@Joone, sorry, forgot to reply. Yes, this uses the usual X stack, so you should be able to run it if you have a recent distro and your hardware is supported in the kernel.