target_state.h
1 #pragma once 2 #include <mutex> 3 #include <condition_variable> 4 #include "shortcut_guide.h" 5 6 struct KeyEvent 7 { 8 bool key_down; 9 unsigned vk_code; 10 }; 11 12 class TargetState 13 { 14 public: 15 TargetState() = default; 16 void was_hidden(); 17 void exit(); 18 19 void toggle_force_shown(); 20 bool active() const; 21 22 private: 23 std::recursive_mutex mutex; 24 std::condition_variable_any cv; 25 enum State 26 { 27 Hidden, 28 Shown, 29 ForceShown, 30 Exiting 31 }; 32 std::atomic<State> state = Hidden; 33 };