diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-29 09:21:10 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-29 09:21:23 +0200 |
commit | 3a7011ff73cce39ecacb4c5651c1a2dbda8eb10e (patch) | |
tree | 84d21d48998aaacbad9cb27b7e5edf29b0dd1396 /opentrack/shortcuts.h | |
parent | 69cc802722c8264c0fd8b138a298d4820c11f1d8 (diff) |
api, main: implement new keybindings
The following keybindings are now implemented:
- restart tracking. if not started, starts.
- toggle (keep position) while key held
- zero (keep zero) while key held
The latter two options only work for Windows as libqxt doesn't support
them.
Closes #291
Diffstat (limited to 'opentrack/shortcuts.h')
-rwxr-xr-x[-rw-r--r--] | opentrack/shortcuts.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index 38037923..40d41957 100644..100755 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -26,6 +26,12 @@ # include "keybinding-worker.hpp" #endif +#ifdef __GNUC__ +# define unused(t, i) t __attribute__((unused)) i +#else +# define unused(t, i) t i +#endif + using namespace options; struct OPENTRACK_EXPORT Shortcuts : public QObject { @@ -40,8 +46,8 @@ public: #endif ; - using fun = std::function<void(void)>; - using tt = std::tuple<K, fun>; + using fun = std::function<void(bool)>; + using tt = std::tuple<K, fun, bool>; std::vector<tt> keys; #ifdef _WIN32 KeybindingWorker::Token key_token; @@ -53,9 +59,9 @@ public: #endif {} - void reload(const std::vector<std::tuple<key_opts &, fun> > &keys); + void reload(const std::vector<std::tuple<key_opts &, fun, bool>> &keys); private: - void bind_keyboard_shortcut(K &key, const key_opts& k); + void bind_keyboard_shortcut(K &key, const key_opts& k, bool held); #ifdef _WIN32 void receiver(const Key& k); #endif |