mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
FancyZones and Shortcut Guide initial commit
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
This commit is contained in:
committed by
Bartosz Sosnowski
parent
10c5396099
commit
8431b80e48
35
src/modules/shortcut_guide/target_state.h
Normal file
35
src/modules/shortcut_guide/target_state.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include <deque>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
#include "shortcut_guide.h"
|
||||
|
||||
struct KeyEvent {
|
||||
bool key_down;
|
||||
unsigned vk_code;
|
||||
};
|
||||
|
||||
class TargetState {
|
||||
public:
|
||||
TargetState(int ms_delay);
|
||||
bool signal_event(unsigned vk_code, bool key_down);
|
||||
void was_hiden();
|
||||
void exit();
|
||||
void set_delay(int ms_delay);
|
||||
private:
|
||||
KeyEvent next();
|
||||
void handle_hidden();
|
||||
void handle_timeout();
|
||||
void handle_shown();
|
||||
void thread_proc();
|
||||
std::mutex mutex;
|
||||
std::condition_variable cv;
|
||||
std::chrono::system_clock::time_point winkey_timestamp, singnal_timestamp;
|
||||
std::chrono::milliseconds delay;
|
||||
std::deque<KeyEvent> events;
|
||||
enum { Hidden, Timeout, Shown, Exiting } state = Hidden;
|
||||
bool key_was_pressed = false;
|
||||
std::thread thread;
|
||||
};
|
||||
Reference in New Issue
Block a user