summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-25 11:43:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-25 11:43:10 +0200
commit10ac081b3c4ebb9b29b81b30f5efe6622f4212bc (patch)
treefedfe7efc494145d0b46e91ba5a94c47cb0c1b6f /opentrack
parent6baa8ca1070612e5d7cbae7aa62cbe4a9e51ad40 (diff)
parent24538cf3a3a91481851618791b11be81437563e4 (diff)
Merge branch 'unstable' into trackhat-ui
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/export.hpp13
-rw-r--r--opentrack/global-shortcuts.cpp68
-rw-r--r--opentrack/mingw-version-script.txt8
-rw-r--r--opentrack/plugin-api.hpp4
-rw-r--r--opentrack/pose.hpp22
-rw-r--r--opentrack/posix-version-script.txt8
-rw-r--r--opentrack/qcopyable-mutex.hpp37
-rw-r--r--opentrack/shortcuts.cpp64
-rw-r--r--opentrack/shortcuts.h8
-rw-r--r--opentrack/sleep.hpp22
-rw-r--r--opentrack/timer.hpp75
-rw-r--r--opentrack/tracker.h20
-rw-r--r--opentrack/version.cc2
-rw-r--r--opentrack/win32-shortcuts.cpp162
-rw-r--r--opentrack/win32-shortcuts.h18
15 files changed, 226 insertions, 305 deletions
diff --git a/opentrack/export.hpp b/opentrack/export.hpp
deleted file mode 100644
index f0983b75..00000000
--- a/opentrack/export.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#ifdef _WIN32
-# define OPENTRACK_LINKAGE __declspec(dllexport)
-#else
-# define OPENTRACK_LINKAGE
-#endif
-
-#ifndef _MSC_VER
-# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE
-#else
-# define OPENTRACK_EXPORT OPENTRACK_LINKAGE
-#endif \ No newline at end of file
diff --git a/opentrack/global-shortcuts.cpp b/opentrack/global-shortcuts.cpp
deleted file mode 100644
index 7569fd9a..00000000
--- a/opentrack/global-shortcuts.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <QList>
-#include <QString>
-
-extern QList<QString> global_key_sequences;
-extern QList<int> global_windows_key_sequences;
-
-#if defined(_WIN32)
-# ifndef DIRECTINPUT_VERSION
-# define DIRECTINPUT_VERSION 0x800
-# endif
-# include <windows.h>
-# include <dinput.h>
-
-QList<int> global_windows_key_sequences =
- QList<int>()
- << 0
- << DIK_F1
- << DIK_F2
- << DIK_F3
- << DIK_F4
- << DIK_F5
- << DIK_F6
- << DIK_F7
- << DIK_F8
- << DIK_F9
- << DIK_F10
- << DIK_F11
- << DIK_F12
- << DIK_LEFT
- << DIK_RIGHT
- << DIK_UP
- << DIK_DOWN
- << DIK_PGUP
- << DIK_PGDN
- << DIK_HOME
- << DIK_END
- << DIK_BACK
- << DIK_DELETE
- << DIK_RETURN;
-#endif
-
-QList<QString> global_key_sequences =
- QList<QString>()
- << ""
- << "F1"
- << "F2"
- << "F3"
- << "F4"
- << "F5"
- << "F6"
- << "F7"
- << "F8"
- << "F9"
- << "F10"
- << "F11"
- << "F12"
- << "Left"
- << "Right"
- << "Up"
- << "Down"
- << "PgUp"
- << "PgDown"
- << "Home"
- << "End"
- << "Del"
-;
-
-
diff --git a/opentrack/mingw-version-script.txt b/opentrack/mingw-version-script.txt
deleted file mode 100644
index fe20ad37..00000000
--- a/opentrack/mingw-version-script.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- global:
- GetDialog?0;
- GetConstructor?0;
- GetMetadata?0;
- local:
- *;
-};
diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp
index b0da4950..572b7f31 100644
--- a/opentrack/plugin-api.hpp
+++ b/opentrack/plugin-api.hpp
@@ -8,7 +8,7 @@
#pragma once
-#include "export.hpp"
+#include "../opentrack-compat/export.hpp"
#include <QString>
#include <QWidget>
#include <QFrame>
@@ -59,7 +59,7 @@ struct IFilter
// optional destructor
virtual ~IFilter() {}
// perform filtering step.
- // you have to take care of dt on your own, try "opentrack/timer.hpp"
+ // you have to take care of dt on your own, try "opentrack-compat/timer.hpp"
virtual void filter(const double *input, double *output) = 0;
};
diff --git a/opentrack/pose.hpp b/opentrack/pose.hpp
deleted file mode 100644
index 93d467a9..00000000
--- a/opentrack/pose.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include <utility>
-#include <algorithm>
-#include "./plugin-api.hpp"
-
-class Pose {
-private:
- static constexpr double pi = 3.141592653;
- static constexpr double d2r = pi/180.0;
- static constexpr double r2d = 180./pi;
-
- double axes[6];
-public:
- Pose() : axes {0,0,0, 0,0,0} {}
-
- inline operator double*() { return axes; }
- inline operator const double*() const { return axes; }
-
- inline double& operator()(int i) { return axes[i]; }
- inline double operator()(int i) const { return axes[i]; }
-};
diff --git a/opentrack/posix-version-script.txt b/opentrack/posix-version-script.txt
deleted file mode 100644
index 97edb9aa..00000000
--- a/opentrack/posix-version-script.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- global:
- GetDialog;
- GetConstructor;
- GetMetadata;
- local:
- *;
-}; \ No newline at end of file
diff --git a/opentrack/qcopyable-mutex.hpp b/opentrack/qcopyable-mutex.hpp
deleted file mode 100644
index f7f36f93..00000000
--- a/opentrack/qcopyable-mutex.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include <QMutex>
-
-class MyMutex {
-private:
- QMutex inner;
-
-public:
- QMutex* operator->() { return &inner; }
- QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; }
-
- MyMutex operator=(const MyMutex& datum)
- {
- auto mode =
- datum->isRecursive()
- ? QMutex::Recursive
- : QMutex::NonRecursive;
-
- return MyMutex(mode);
- }
-
- MyMutex(const MyMutex& datum)
- {
- *this = datum;
- }
-
- MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) :
- inner(mode)
- {
- }
-
- QMutex* operator&()
- {
- return &inner;
- }
-};
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index ed1701c7..63cd9088 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -11,6 +11,7 @@
#if defined(_WIN32)
#include <windows.h>
+#include "win32-shortcuts.h"
void KeybindingWorker::set_keys(Key kCenter_, Key kToggle_, Key kZero_)
{
@@ -124,59 +125,40 @@ void KeybindingWorker::run() {
void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k)
{
#if !defined(_WIN32)
- const int idx = k.key_index;
if (!key)
key = std::make_shared<QxtGlobalShortcut>();
else {
- key->setEnabled(false);
key->setShortcut(QKeySequence::UnknownKey);
+ key->setEnabled(false);
}
- if (idx > 0)
+
+ if (k.keycode != "")
{
- QString seq(global_key_sequences.value(idx, ""));
- if (!seq.isEmpty())
- {
- if (k.shift)
- seq = "Shift+" + seq;
- if (k.alt)
- seq = "Alt+" + seq;
- if (k.ctrl)
- seq = "Ctrl+" + seq;
- key->setShortcut(QKeySequence::fromString(seq, QKeySequence::PortableText));
- key->setEnabled();
- }
+ key->setShortcut(QKeySequence::fromString(k.keycode, QKeySequence::PortableText));
+ key->setEnabled();
}
+}
#else
key = K();
- int idx = k.key_index;
- key.keycode = 0;
- key.shift = key.alt = key.ctrl = 0;
- if (idx > 0 && idx < global_windows_key_sequences.size())
- key.keycode = global_windows_key_sequences[idx];
- key.shift = k.shift;
- key.alt = k.alt;
- key.ctrl = k.ctrl;
-#endif
+ int idx = 0;
+ QKeySequence code;
+
+ if (k.keycode == "")
+ code = QKeySequence(Qt::Key_unknown);
+ else
+ code = QKeySequence::fromString(k.keycode, QKeySequence::PortableText);
+
+ Qt::KeyboardModifiers mods = Qt::NoModifier;
+ if (code != Qt::Key_unknown)
+ win_key::from_qt(code, idx, mods);
+ key.shift = !!(mods & Qt::ShiftModifier);
+ key.alt = !!(mods & Qt::AltModifier);
+ key.ctrl = !!(mods & Qt::ControlModifier);
+ key.keycode = idx;
}
+#endif
void Shortcuts::reload() {
-#ifndef _WIN32
- if (keyCenter)
- {
- keyCenter->setShortcut(QKeySequence::UnknownKey);
- keyCenter->setEnabled(false);
- }
- if (keyToggle)
- {
- keyToggle->setShortcut(QKeySequence::UnknownKey);
- keyToggle->setEnabled(false);
- }
- if (keyZero)
- {
- keyZero->setShortcut(QKeySequence::UnknownKey);
- keyZero->setEnabled(false);
- }
-#endif
bind_keyboard_shortcut(keyCenter, s.center);
bind_keyboard_shortcut(keyToggle, s.toggle);
bind_keyboard_shortcut(keyZero, s.zero);
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h
index 520042f0..2d7fec54 100644
--- a/opentrack/shortcuts.h
+++ b/opentrack/shortcuts.h
@@ -27,14 +27,10 @@ using namespace options;
extern QList<QString> global_key_sequences;
struct key_opts {
- value<int> key_index;
- value<bool> ctrl, alt, shift;
+ value<QString> keycode;
key_opts(pbundle b, const QString& name) :
- key_index(b, QString("key-index-%1").arg(name), 0),
- ctrl(b, QString("key-ctrl-%1").arg(name), 0),
- alt(b, QString("key-alt-%1").arg(name), 0),
- shift(b, QString("key-shift-%1").arg(name), 0)
+ keycode(b, QString("keycode-%1").arg(name), "")
{}
};
diff --git a/opentrack/sleep.hpp b/opentrack/sleep.hpp
deleted file mode 100644
index 27920842..00000000
--- a/opentrack/sleep.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-namespace portable
-{
-#ifdef _WIN32
- #include <windows.h>
-
- template<typename = void>
- void sleep(unsigned milliseconds)
- {
- Sleep(milliseconds);
- }
-#else
- #include <unistd.h>
-
- template<typename = void>
- void sleep(unsigned milliseconds)
- {
- usleep(milliseconds * 1000U); // takes microseconds
- }
-#endif
-}
diff --git a/opentrack/timer.hpp b/opentrack/timer.hpp
deleted file mode 100644
index fd710499..00000000
--- a/opentrack/timer.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (c) 2014-2015, Stanislaw Halik <sthalik@misaki.pl>
-
- * Permission to use, copy, modify, and/or distribute this
- * software for any purpose with or without fee is hereby granted,
- * provided that the above copyright notice and this permission
- * notice appear in all copies.
- */
-
-#pragma once
-#include <ctime>
-#if defined (_WIN32)
-# include <windows.h>
-# ifndef CLOCK_MONOTONIC
-# define CLOCK_MONOTONIC -1
-# endif
-static inline void opentrack_clock_gettime(int, struct timespec* ts)
-{
- static LARGE_INTEGER freq;
-
- if (!freq.QuadPart)
- (void) QueryPerformanceFrequency(&freq);
-
- LARGE_INTEGER d;
-
- (void) QueryPerformanceCounter(&d);
-
- d.QuadPart *= 1000000000L;
- d.QuadPart /= freq.QuadPart;
-
- ts->tv_sec = d.QuadPart / 1000000000L;
- ts->tv_nsec = d.QuadPart % 1000000000L;
-}
-# define clock_gettime opentrack_clock_gettime
-#else
-# if defined(__MACH__)
-# define CLOCK_MONOTONIC 0
-# include <inttypes.h>
-# include <mach/mach_time.h>
-static inline void clock_gettime(int, struct timespec* ts)
-{
- static mach_timebase_info_data_t sTimebaseInfo;
- uint64_t state, nsec;
- if ( sTimebaseInfo.denom == 0 ) {
- (void) mach_timebase_info(&sTimebaseInfo);
- }
- state = mach_absolute_time();
- nsec = state * sTimebaseInfo.numer / sTimebaseInfo.denom;
- ts->tv_sec = nsec / 1000000000L;
- ts->tv_nsec = nsec % 1000000000L;
-}
-# endif
-#endif
-class Timer {
-private:
- struct timespec state;
- long conv(const struct timespec& cur)
- {
- return (cur.tv_sec - state.tv_sec) * 1000000000L + (cur.tv_nsec - state.tv_nsec);
- }
-public:
- Timer() {
- start();
- }
- void start() {
- (void) clock_gettime(CLOCK_MONOTONIC, &state);
- }
- long elapsed() {
- struct timespec cur;
- (void) clock_gettime(CLOCK_MONOTONIC, &cur);
- return conv(cur);
- }
- long elapsed_ms() {
- return elapsed() / 1000000L;
- }
-};
diff --git a/opentrack/tracker.h b/opentrack/tracker.h
index 453357c4..c5c39797 100644
--- a/opentrack/tracker.h
+++ b/opentrack/tracker.h
@@ -10,10 +10,9 @@
#include <vector>
-#include "timer.hpp"
+#include "opentrack-compat/timer.hpp"
#include "plugin-support.hpp"
#include "mappings.hpp"
-#include "pose.hpp"
#include "simple-mat.hpp"
#include "selected-libraries.hpp"
@@ -24,6 +23,23 @@
#include <QMutex>
#include <QThread>
+class Pose {
+private:
+ static constexpr double pi = 3.141592653;
+ static constexpr double d2r = pi/180.0;
+ static constexpr double r2d = 180./pi;
+
+ double axes[6];
+public:
+ Pose() : axes {0,0,0, 0,0,0} {}
+
+ inline operator double*() { return axes; }
+ inline operator const double*() const { return axes; }
+
+ inline double& operator()(int i) { return axes[i]; }
+ inline double operator()(int i) const { return axes[i]; }
+};
+
class Tracker : private QThread {
Q_OBJECT
private:
diff --git a/opentrack/version.cc b/opentrack/version.cc
index 026ad057..13bc5dc5 100644
--- a/opentrack/version.cc
+++ b/opentrack/version.cc
@@ -1,4 +1,4 @@
-#include "opentrack/export.hpp"
+#include "opentrack-compat/export.hpp"
#ifdef __cplusplus
extern "C"
diff --git a/opentrack/win32-shortcuts.cpp b/opentrack/win32-shortcuts.cpp
new file mode 100644
index 00000000..dbf4f9fd
--- /dev/null
+++ b/opentrack/win32-shortcuts.cpp
@@ -0,0 +1,162 @@
+#if defined(_WIN32)
+# ifndef DIRECTINPUT_VERSION
+# define DIRECTINPUT_VERSION 0x800
+# endif
+# include <windows.h>
+# include <dinput.h>
+
+#include <QList>
+#include <QKeySequence>
+#include <QVariant>
+#include <QDebug>
+#include "win32-shortcuts.h"
+
+QList<win_key> windows_key_mods =
+ QList<win_key>({
+ win_key(DIK_LCONTROL, Qt::Key::Key_Control),
+ win_key(DIK_RCONTROL, Qt::Key::Key_Control),
+ win_key(DIK_LALT, Qt::Key::Key_Alt),
+ win_key(DIK_RALT, Qt::Key::Key_Alt),
+ win_key(DIK_LSHIFT, Qt::Key::Key_Shift),
+ win_key(DIK_RSHIFT, Qt::Key::Key_Shift),
+ win_key(DIK_LWIN, Qt::Key::Key_unknown),
+ win_key(DIK_RWIN, Qt::Key::Key_unknown)
+ });
+
+QList<win_key> windows_key_sequences =
+ QList<win_key>({
+ win_key(DIK_F1, Qt::Key::Key_F1 ),
+ win_key(DIK_F2, Qt::Key::Key_F2 ),
+ win_key(DIK_F3, Qt::Key::Key_F3 ),
+ win_key(DIK_F4, Qt::Key::Key_F4 ),
+ win_key(DIK_F5, Qt::Key::Key_F5 ),
+ win_key(DIK_F6, Qt::Key::Key_F6 ),
+ win_key(DIK_F7, Qt::Key::Key_F7 ),
+ win_key(DIK_F8, Qt::Key::Key_F8 ),
+ win_key(DIK_F9, Qt::Key::Key_F9 ),
+ win_key(DIK_F10, Qt::Key::Key_F10 ),
+ win_key(DIK_F11, Qt::Key::Key_F11 ),
+ win_key(DIK_F12, Qt::Key::Key_F12 ),
+ win_key(DIK_LEFT, Qt::Key::Key_Left ),
+ win_key(DIK_RIGHT, Qt::Key::Key_Right ),
+ win_key(DIK_UP, Qt::Key::Key_Up ),
+ win_key(DIK_DOWN, Qt::Key::Key_Down ),
+ win_key(DIK_PRIOR, Qt::Key::Key_PageUp ),
+ win_key(DIK_NEXT, Qt::Key::Key_PageDown ),
+ win_key(DIK_HOME, Qt::Key::Key_Home ),
+ win_key(DIK_END, Qt::Key::Key_End ),
+ win_key(DIK_BACK, Qt::Key::Key_Backspace ),
+ win_key(DIK_COMMA, Qt::Key::Key_Comma ),
+ win_key(DIK_PERIOD, Qt::Key::Key_Period ),
+ win_key(DIK_LBRACKET, Qt::Key::Key_BracketLeft ),
+ win_key(DIK_RBRACKET, Qt::Key::Key_BracketRight ),
+ win_key(DIK_SEMICOLON, Qt::Key::Key_Semicolon ),
+ win_key(DIK_SLASH, Qt::Key::Key_Slash ),
+ win_key(DIK_BACKSLASH, Qt::Key::Key_Backslash ),
+ win_key(DIK_BACKSPACE, Qt::Key::Key_Backspace ),
+ win_key(DIK_APOSTROPHE, Qt::Key::Key_Apostrophe ),
+ win_key(DIK_GRAVE, Qt::Key::Key_QuoteLeft ),
+ win_key(DIK_MINUS, Qt::Key::Key_Minus ),
+ win_key(DIK_EQUALS, Qt::Key::Key_Equal ),
+ win_key(DIK_PERIOD, Qt::Key::Key_Period ),
+ win_key(DIK_F1, Qt::Key::Key_F1 ),
+ win_key(DIK_F2, Qt::Key::Key_F2 ),
+ win_key(DIK_F3, Qt::Key::Key_F3 ),
+ win_key(DIK_F4, Qt::Key::Key_F4 ),
+ win_key(DIK_F5, Qt::Key::Key_F5 ),
+ win_key(DIK_F6, Qt::Key::Key_F6 ),
+ win_key(DIK_F7, Qt::Key::Key_F7 ),
+ win_key(DIK_F8, Qt::Key::Key_F8 ),
+ win_key(DIK_F9, Qt::Key::Key_F9 ),
+ win_key(DIK_F10, Qt::Key::Key_F10 ),
+ win_key(DIK_F11, Qt::Key::Key_F11 ),
+ win_key(DIK_F12, Qt::Key::Key_F12 ),
+ win_key(DIK_0, Qt::Key::Key_0 ),
+ win_key(DIK_1, Qt::Key::Key_1 ),
+ win_key(DIK_2, Qt::Key::Key_2 ),
+ win_key(DIK_3, Qt::Key::Key_3 ),
+ win_key(DIK_4, Qt::Key::Key_4 ),
+ win_key(DIK_5, Qt::Key::Key_5 ),
+ win_key(DIK_6, Qt::Key::Key_6 ),
+ win_key(DIK_7, Qt::Key::Key_7 ),
+ win_key(DIK_8, Qt::Key::Key_8 ),
+ win_key(DIK_9, Qt::Key::Key_9 ),
+ win_key(DIK_A, Qt::Key::Key_A ),
+ win_key(DIK_B, Qt::Key::Key_B ),
+ win_key(DIK_C, Qt::Key::Key_C ),
+ win_key(DIK_D, Qt::Key::Key_D ),
+ win_key(DIK_E, Qt::Key::Key_E ),
+ win_key(DIK_F, Qt::Key::Key_F ),
+ win_key(DIK_G, Qt::Key::Key_G ),
+ win_key(DIK_H, Qt::Key::Key_H ),
+ win_key(DIK_I, Qt::Key::Key_I ),
+ win_key(DIK_J, Qt::Key::Key_J ),
+ win_key(DIK_K, Qt::Key::Key_K ),
+ win_key(DIK_L, Qt::Key::Key_L ),
+ win_key(DIK_M, Qt::Key::Key_M ),
+ win_key(DIK_N, Qt::Key::Key_N ),
+ win_key(DIK_O, Qt::Key::Key_O ),
+ win_key(DIK_P, Qt::Key::Key_P ),
+ win_key(DIK_Q, Qt::Key::Key_Q ),
+ win_key(DIK_R, Qt::Key::Key_R ),
+ win_key(DIK_S, Qt::Key::Key_S ),
+ win_key(DIK_T, Qt::Key::Key_T ),
+ win_key(DIK_U, Qt::Key::Key_U ),
+ win_key(DIK_V, Qt::Key::Key_V ),
+ win_key(DIK_W, Qt::Key::Key_W ),
+ win_key(DIK_X, Qt::Key::Key_X ),
+ win_key(DIK_Y, Qt::Key::Key_Y ),
+ win_key(DIK_Z, Qt::Key::Key_Z ),
+ win_key(DIK_RETURN, Qt::Key::Key_Return),
+ win_key(DIK_INSERT, Qt::Key::Key_Insert),
+ });
+
+bool win_key::from_qt(QKeySequence qt_, int& dik, Qt::KeyboardModifiers& mods)
+{
+ auto qt = static_cast<QVariant>(qt_).toInt();
+ auto our_mods = qt & Qt::KeyboardModifierMask;
+#ifdef _WIN32
+ const auto our_mods_ = our_mods;
+ our_mods |= Qt::ShiftModifier;
+ switch (qt & ~Qt::ShiftModifier)
+ {
+ case Qt::Key::Key_BraceLeft: qt = Qt::Key::Key_BracketLeft; break;
+ case Qt::Key::Key_BraceRight: qt = Qt::Key::Key_BracketRight; break;
+ case Qt::Key::Key_ParenLeft: qt = Qt::Key::Key_9; break;
+ case Qt::Key::Key_ParenRight: qt = Qt::Key::Key_0; break;
+
+ case Qt::Key::Key_Exclam: qt = Qt::Key::Key_1; break;
+ case Qt::Key::Key_At: qt = Qt::Key::Key_2; break;
+ case Qt::Key::Key_NumberSign: qt = Qt::Key::Key_3; break;
+ case Qt::Key::Key_Dollar: qt = Qt::Key::Key_4; break;
+ case Qt::Key::Key_Percent: qt = Qt::Key::Key_5; break;
+ case Qt::Key::Key_AsciiCircum: qt = Qt::Key::Key_6; break;
+ case Qt::Key::Key_Ampersand: qt = Qt::Key::Key_7; break;
+ case Qt::Key::Key_Asterisk: qt = Qt::Key::Key_8; break;
+
+ case Qt::Key::Key_Underscore: qt = Qt::Key::Key_Minus; break;
+ case Qt::Key::Key_Plus: qt = Qt::Key::Key_Equal; break;
+
+ case Qt::Key::Key_Colon: qt = Qt::Key::Key_Semicolon; break;
+ case Qt::Key::Key_QuoteDbl: qt = Qt::Key::Key_Apostrophe; break;
+ case Qt::Key::Key_Less: qt = Qt::Key::Key_Comma; break;
+ case Qt::Key::Key_Question: qt = Qt::Key::Key_Slash; break;
+ case Qt::Key::Key_Bar: qt = Qt::Key::Key_Backslash; break;
+ default: our_mods = our_mods_; break;
+ }
+#endif
+
+ const auto key = qt & ~Qt::KeyboardModifierMask;
+ for (auto& wk : windows_key_sequences)
+ {
+ if (wk.qt == key)
+ {
+ dik = wk.win;
+ mods = static_cast<Qt::KeyboardModifiers>(our_mods);
+ return true;
+ }
+ }
+ return false;
+}
+
+#endif
diff --git a/opentrack/win32-shortcuts.h b/opentrack/win32-shortcuts.h
new file mode 100644
index 00000000..8167036d
--- /dev/null
+++ b/opentrack/win32-shortcuts.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#ifdef _WIN32
+
+struct win_key;
+
+extern QList<win_key> windows_key_mods;
+extern QList<win_key> windows_key_sequences;
+
+struct win_key
+{
+ win_key(int win, Qt::Key qt) : win(win), qt(qt) {}
+ int win;
+ Qt::Key qt;
+ static bool from_qt(QKeySequence qt_, int& dik, Qt::KeyboardModifiers &mods);
+};
+
+#endif