← Back to team overview

multi-touch-dev team mailing list archive

Re: New Multitouch Games

 

On Feb 23, 2011, at 5:42 AM, Chase Douglas wrote:

> On 02/22/2011 09:56 AM, Ulrich von Zadow wrote:
>> Hi everyone,
>> 
>> we have all multitouch games packaged and working with the updated XInput 2.1 API :-).
>> 
>> Installing python-libavg-games from OXullo's ppa (https://launchpad.net/~oxullo/+archive/libavg) on top of the utouch stack should get everything running.
> 
> This is great! I tested them out tonight.

Cool - thanks!

> 
> However, this highlights an issue. I spent the last week and a half
> making touch events integrate into the pointer event stream, and this
> broke your games :). Basically, we do the following from the root window
> R to the top level window T to the child window C:
> 
> 1. Handle touch grab on R
> 2. Handle pointer grab on R
> 3. Handle touch grab on T
> 4. Handle pointer grab on T
> 5. Handle touch grab on C
> 6. Handle pointer grab on C
> 7. Handle touch and pointer select on C, stop if events delivered
> 8. Handle touch and pointer select on T, stop if events delivered
> 9. Handle touch and pointer select on R
> 
> In your applications, SDL seems to be asynchronously actively grabbing
> the pointer in what is analogous to window C above. An asynchronous grab
> at any grab point stops further delivery. So event delivery is ending at
> step 6 above, and never getting to step 8, which is where you have a
> touch selection. Note that this is only the case for the first touch,
> since it's the only one that is pointer emulated. I played your games by
> keeping a thumb always pressed to one of the corners of the screen as a
> workaround :).

Clear so far. I'll have some time tomorrow or Friday to look into this (right now, my Natty alpha setup is broken beyond repair...), but I'll voice some thoughts & if answers pop into your head, I'd love to hear them.

> 
> There are ways to get around this, some easier than others. If you want
> to continue with SDL's grab approach, you could add a touch grab on the
> same window as the pointer grab. You could add this to the SDL code, or
> you could add it to your own code outside of SDL.

Up to this point, things are clear to me.

We've avoided changing SDL so far (I sort of expected it to be hard to patch SDL just to get our stuff running ;-)). Actually, we had to code quite a bit around SDL's input handling, since SDL doesn't know anything about XInput 2.x. Here's our current code, if you're interested: https://www.libavg.de/websvn/filedetails.php?repname=libavg&path=%2Ftrunk%2Flibavg%2Fsrc%2Fplayer%2FXInput21MTEventSource.cpp

> However, the semantics
> for touch grabs are different from touch selections: you'll need to
> select for ownership and unowned update events. If this sounds like
> gibberish, let me know :). It should be all documented in the protocol
> spec in /usr/share/doc/x11proto-input-dev/XI2proto.txt.

This is where I start getting confused a bit, but I assume that I can sort most of it out by myself once I have a running setup again.

Still, some questions:
- The spec sais 'a device may not be grabbed through an XI2 grab if an XI1 grab is currently active on this device or vice versa.'. Are we running into this? SDL is doing exclusively XI1 processing.

- In your other mail, you mention using XIChangeHierarchy. If this is the only solution, we'll do it, but at the moment the games work in non-fullscreen mode as well and that's a real help when debugging. Although it does sound like that'd be the easiest solution to implement...
> 
> Another way would be to take the pointer events and translate them to
> touch events internally if they are pointer emulated. To determine
> whether they are pointer emulated would require converting them to XI
> 2.1 grabs again, though. But if you don't mind people trying to use a
> mouse, you could just translate all the mouse events.

And this is where it starts being really confusing. We're watching for mouse events already. Some games hide the mouse cursor, but all of them should react to mouse events.

> Or, maybe you can disable the pointer grab altogether? Your games all
> are full screen, so I don't think this would be a big problem.

That would require changing SDL, right?

Cheers,

  Uli


Follow ups

References