cinder/Cinder — pull request #390 by nselikoff (2013-11-07 23:01:59+00:00)
Title: Cross-platform way to respond to a Cinder app becoming active or not active

(A new approach to a previous pull request: https://github.com/cinder/Cinder/pull/378)

This PR allows the use of `getSignalWillResignActive` and `getSignalDidBecomeActive` to respond to a Cinder application becoming active or inactive, across OS X, iOS and Windows.

To accomplish this, these two signals were moved from AppCocoaTouch into App, as there's good parity between OS X and iOS, and reasonable parity on Windows (via the WM_ACTIVATEAPP notification). One thing to mention on the Windows implementation: the introduction of a boolean was necessary because WM_ACTIVATEAPP is fired for every window in a multi-window app. So even though it's conceptually an app-level signal, it's handled by WindowProc and therefore fired off multiple times, which I don't want in this context.

My previous approach was a Window-level one instead of an App-level one. I think it would be nice to have Window-level signals similar to this, but there's more variation between the various states of a Window across different OS's. There's also variation in application state - for example, an iOS app differentiates between Inactive, Background and Suspended, while an OS X app doesn't. So I went with the minimum that all OS's have in common - active vs not active.

**Question:** Windows doesn't send an active signal when the app first launches, while iOS and OS X do. Where would be the best place to artificially call emitDidBecomeActive() in the MSW implementation once, as the app first starts?

**Question:** I don't know anything about WinRT but I see it's in the dev branch now. Can someone show me how to do that implementation or add it to this PR?