summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-22 15:11:21 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-22 15:11:21 +0200
commit00367760ac7e059a3cd9ba4baec11ad0a074771c (patch)
tree96d919c44291181e5fd90fde9674405646310633 /opentrack
parent90ecc76a15d0a15b39be67b7a9aa337f57fe6a62 (diff)
long fun header -> .cpp
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/shortcuts.cpp25
-rw-r--r--opentrack/shortcuts.h29
2 files changed, 25 insertions, 29 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index d1cfa503..77c57237 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -125,7 +125,7 @@ void KeybindingWorker::run() {
PROCESS_KEY(kCenter, center());
PROCESS_KEY(kToggle, toggle());
- Sleep(25);
+ Sleep(14);
}
}
#endif
@@ -168,4 +168,25 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k)
key.ctrl = k.ctrl;
}
#endif
-} \ No newline at end of file
+}
+void Shortcuts::reload() {
+#ifndef _WIN32
+ if (keyCenter)
+ {
+ keyCenter->setShortcut(QKeySequence::UnknownKey);
+ keyCenter->setEnabled(false);
+ }
+ if (keyToggle)
+ {
+ keyToggle->setShortcut(QKeySequence::UnknownKey);
+ keyToggle->setEnabled(false);
+ }
+#endif
+ bind_keyboard_shortcut(keyCenter, s.center);
+ bind_keyboard_shortcut(keyToggle, s.toggle);
+#ifdef _WIN32
+ keybindingWorker = nullptr;
+ keybindingWorker = std::make_shared<KeybindingWorker>(keyCenter, keyToggle, handle);
+ keybindingWorker->start();
+#endif
+}
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h
index 8fe1a39b..298907c7 100644
--- a/opentrack/shortcuts.h
+++ b/opentrack/shortcuts.h
@@ -75,7 +75,6 @@ signals:
void toggle();
};
-
struct Shortcuts {
using K =
#ifndef _WIN32
@@ -103,33 +102,9 @@ struct Shortcuts {
{}
} s;
- Shortcuts(WId handle) : handle(handle)
- {
- reload();
- }
+ Shortcuts(WId handle) : handle(handle) { reload(); }
- void reload()
- {
-#ifndef _WIN32
- if (keyCenter)
- {
- keyCenter->setShortcut(QKeySequence::UnknownKey);
- keyCenter->setEnabled(false);
- }
- if (keyToggle)
- {
- keyToggle->setShortcut(QKeySequence::UnknownKey);
- keyToggle->setEnabled(false);
- }
-#endif
- bind_keyboard_shortcut(keyCenter, s.center);
- bind_keyboard_shortcut(keyToggle, s.toggle);
-#ifdef _WIN32
- keybindingWorker = nullptr;
- keybindingWorker = std::make_shared<KeybindingWorker>(keyCenter, keyToggle, handle);
- keybindingWorker->start();
-#endif
- }
+ void reload();
private:
void bind_keyboard_shortcut(K &key, key_opts& k);
};