← Back to team overview

multi-touch-dev team mailing list archive

Re: New Multitouch Games

 

On 02/27/2011 05:13 PM, Ulrich von Zadow wrote:
> 
> On Feb 23, 2011, at 1:50 PM, Chase Douglas wrote:
>>
>> When you start up, you can use XIChangeHierarchy to
>> detach all touchscreens. This will inhibit them sending pointer events
>> at all. Then you should subscribe to XIAllDevices when you make your
>> touch selections. Just remember to be kind and reattach the touch
>> devices to the master pointer when you exit (including error exit paths).
> 
> Thanks for all the tips!
> 
> I've implemented this variant now, complete with signal handlers. It's
> in the libavg svn; OXullo will package it.

I attempted to get things working on Friday too :). I went with the
simpler approach of just disabling the grab. It turns out SDL really
doesn't want to let you do that in full screen mode, so you have to
manually get the X display connection and call XUngrabPointer yourself.
You can use either approach as you like. Ungrabbing the pointer ensures
we don't leave the slave device detached if you have to kill -9 it or if
a python exception occurs.

I'll push my changes to a bzr repo today for you to look at.

> Note that when I started the unchanged game in windowed mode, it crashed
> on first touch because it got an XI_TouchEnd event without a
> corresponding  XI_TouchBegin. Should this ever happen? If not, you can
> reproduce it by starting
> 
> $ empcommand -w -r 800x600
> 
> with the unchanged package.

No, you've found a bug I found on Friday too :). I plan to push out a
fix soon. I'll let you know when it's pushed.

Also, I noticed that you are listening for MT events on the fullscreen
window instead of the top level SDL window. Since mouse events are
selected on the top level SDL window, you will need to listen for touch
events on the top level window too if you go with the pointer ungrabbing
approach. I've got a patch for that as well.

All in all, I've got your games working properly out of the box here. I
just need to push two fixes to X and get you the patches to libavg.

>> Thinking about your games, none of them use the cursor I believe. Thus,
>> there's really no point to confining the pointer to the window, and the
>> fact you're using a touchscreen limits event grab necessity. The easiest
>> thing to do would be to disable the SDL grab by calling:
>>
>> SDL_WM_GrabInput(SDL_GRAB_OFF);
> 
> That had no effect whatsoever.

Yeah, cause SDL either 1. has a bug, or 2. has a design flaw that won't
let you ungrab in full screen mode :).

-- Chase



Follow ups

References