Explorar o código

UI: Fix enter/esc when hotkeys are disabled in focus

Fixes an issue where enter/escape/return would not work in the program
if hotkeys were disabled while in focus. No other known keys were
affected by this filter issue.
jp9000 %!s(int64=4) %!d(string=hai) anos
pai
achega
c459e8954c
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      UI/obs-app.cpp

+ 8 - 2
UI/obs-app.cpp

@@ -167,7 +167,11 @@ QObject *CreateShortcutFilter()
 		};
 
 		auto key_event = [&](QKeyEvent *event) {
-			if (!App()->HotkeysEnabledInFocus())
+			int key = event->key();
+			bool enabledInFocus = App()->HotkeysEnabledInFocus();
+
+			if (key != Qt::Key_Enter && key != Qt::Key_Escape &&
+			    key != Qt::Key_Return && !enabledInFocus)
 				return true;
 
 			QDialog *dialog = qobject_cast<QDialog *>(obj);
@@ -175,7 +179,7 @@ QObject *CreateShortcutFilter()
 			obs_key_combination_t hotkey = {0, OBS_KEY_NONE};
 			bool pressed = event->type() == QEvent::KeyPress;
 
-			switch (event->key()) {
+			switch (key) {
 			case Qt::Key_Shift:
 			case Qt::Key_Control:
 			case Qt::Key_Alt:
@@ -195,6 +199,8 @@ QObject *CreateShortcutFilter()
 			case Qt::Key_Return:
 				if (dialog && pressed)
 					return false;
+				if (!enabledInFocus)
+					return true;
 				/* Falls through. */
 			default:
 				hotkey.key = obs_key_from_virtual_key(