UI: Fix hotkeys working even when disabled in focus

Fixes a bug where the hotkey inject would trigger hotkeys despite
hotkeys being disabled when in focus.
This commit is contained in:
jp9000 2019-07-22 01:11:34 -07:00
parent 887857b71d
commit 9ca1e85f7d
2 changed files with 11 additions and 0 deletions

View file

@ -93,6 +93,9 @@ QObject *CreateShortcutFilter()
{
return new OBSEventFilter([](QObject *obj, QEvent *event) {
auto mouse_event = [](QMouseEvent &event) {
if (!App()->HotkeysEnabledInFocus())
return true;
obs_key_combination_t hotkey = {0, OBS_KEY_NONE};
bool pressed = event.type() == QEvent::MouseButtonPress;
@ -147,6 +150,9 @@ QObject *CreateShortcutFilter()
};
auto key_event = [&](QKeyEvent *event) {
if (!App()->HotkeysEnabledInFocus())
return true;
QDialog *dialog = qobject_cast<QDialog *>(obj);
obs_key_combination_t hotkey = {0, OBS_KEY_NONE};

View file

@ -107,6 +107,11 @@ public:
void EnableInFocusHotkeys(bool enable);
inline bool HotkeysEnabledInFocus() const
{
return enableHotkeysInFocus;
}
inline QMainWindow *GetMainWindow() const { return mainWindow.data(); }
inline config_t *GlobalConfig() const { return globalConfig; }