Repos
C++
627 B22 lines Opens in site
Directory
Raw
Download
#pragma once
// Spec: INV-social 12.1 (scenePhase onChange). The desktop equivalent of the scene phase is the SDL window focus:
// gained = .active, lost = inactive/background. Events are marshalled to the UI thread through UiQueue.
#include <functional>
namespace dp {
class WindowFocusWatcher {
public:
using Handler = std::function<void(bool active)>;
explicit WindowFocusWatcher(Handler handler);
~WindowFocusWatcher();
WindowFocusWatcher(const WindowFocusWatcher&) = delete;
WindowFocusWatcher& operator=(const WindowFocusWatcher&) = delete;
struct State;
private:
State* state_;
};
} // namespace dp