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:
parent
887857b71d
commit
9ca1e85f7d
@ -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};
|
||||
|
@ -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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user