More multitouchy fun

Sorry, nothing related to sex! Since my previous post, I didn’t actually hack much on getting MPX working, mostly blocking on the lack of ideas about a good API. That was until ImendioConf, where a talk with Richard about the subject made ideas start flowing, so here’s my late christmas present!

Besides making GDK use XInput 2.0, The main change is at the GtkWidget level, I’ve introduced GtkDeviceGroup and the “multidevice-event” signal. GtkDeviceGroup is just a container for GdkDevices, each widget can have several GtkDeviceGroups. The “multidevice-event” reports grouped motion events for the devices contained in a GtkDeviceGroup, it also provides hints about the latest event that happened and whether a device was just added,removed or updated.

The idea is, a widget would add devices to a group on button-press, enter-notify… remove them on button-release, leave-notify… and would get grouped motion events for all these devices in between. In the repo there are also a couple of test apps to show this working.

Obviously, there are quite some things left, I’ve collected missing stuff I’ve identified in the wiki, so if you feel curious about multitouch, compile xorg and help out!

And now of course, some videos of the examples :)

Tags: ,

16 Responses to “More multitouchy fun”

  1. ethana2 says:

    My religion forbids me compiling code for my own personal use or installing it aside from apt. Any chance of a .deb?

  2. Vincent Untz says:

    Cool stuff! I want it now on my desktop ;-)

  3. carlosg says:

    @ethana2: that would also involve making debs for xorg head, something that I really didn’t have in mind, given I’m a downstream guy who doesn’t know anything about packaging :)

    @Vincent: feeling like doing some paper and scissors hacking? :P, (Actually, an xorg driver would also be necessary…)

  4. carlosg says:

    err, upstream, nevermind…

  5. Kevin Lange says:

    Why does it seem like anyone who does an MPX video can’t get a screen recorder working?

  6. carlosg says:

    @Kevin: All screencasting software has to be modified to take into account several pointers in their “record pointer” feature, that’s mostly it

  7. luc says:

    This looks really cool!
    What do you use to control the pointers in the videos? (3 mice?)

  8. oliver says:

    Oh, hey, a “GTK + X input” hacker! Sorry that this is offtopic, but maybe you could give me a hint for this: when handling a mouse button event in GTK, is there a way to discover from which device the event came? There are several places in Gnome desktop where mousewheel events from a touchpad should be ignored while mousewheel events from a real mouse should be used (for example Do you have an idea how to distinguish that?

  9. carlosg says:

    @Luc: hey! yeah, I’m using a combination of mice/trackball/touchpad, AFAIK the only multitouch device with MPX-aware Xorg driver available is the DiamondTouch [1], but it’s insanely expensive…

    [1] ,

  10. Kevin Lange says:

    @Carlos: Someone should work on that. We’ve had this for how long now?

  11. carlosg says:

    @Kevin: Yeah, of course, but I tend to think in that as the topping, there are more important things to fix before. Or maybe I suck at marketing and that should have been the very first step :P

  12. carlosg says:

    @oliver: Hmm, I fear you can’t distinguish devices as you want, with stock GTK+ (xinput disabled), it will be always the “core pointer” that generated all mouse events, that situation doesn’t change with currently available XInput.

    In XInput 2.0, you have master devices (or MD, that is, pointers on the screen) and slave devices (or SD, phisical mice, touchpads…), several SD can be attached to a MD, and widgets get events from MDs, which makes things tricky.

    There is XDeviceClassesChangedEvent, which is sent when the SD sending through the MD changes, and GTK+ could listen to this, but event->device would still point to the MD. So there’s no straighforward solution :(

  13. […] Nel frattempo, chiunque sia interessato ad ottenere maggiori informazioni a riguardo, oppure intenda mettere il tutto alla prova, vi rimandiamo al blog di Carlos Garnacho. […]

  14. wiz says:

    looks cool! great work!

  15. Vectorcorpse says:

    couldn’t someone hack a driver to connect mpx to reacTIVision framework?
    i think i read something regarding this some time on the old mpx website.
    this kind of tables are easy to setup and cheap.
    i’d love to get one working with mpx :P

  16. MacSlow says:

    Carlos, what a very cool surprise! I got to give that a spin soon!