CANCELLED touch events & pausing

I’m having trouble making my program cope with the user switching away from and back to Codea while my program is running and touches are currently active. I thought that handling CANCELLED events would be the answer but it seems that CANCELLED events do not get fired when I expect and also, Codea is paused when reactivated and the user must explicitly resume.

When exactly does Codea fire CANCELLED touch events? Is it when the app is deactivated, when reactivated or when resumed after reactivation? Is there any situation when a touch would not fire an ENDED or CANCELLED event?

I believe CANCELLED gets fired when system notifications pop up on the screen.

It is probably a bug that they aren’t fired when the application deactivates – I suspect Codea is pausing the viewer before dispatching the last set of touch events. I’m unsure though and will look into it for 1.3.1.

The resume bug is fixed in 1.3 – that fix makes things a lot nicer.