Browse Source

UI: Fix param logic of ResetHotkeyState calls

The parameter "inFocus" was being given the opposite of what the name
implies: it was being set to false when in focus, and true when not in
focus.  This fixes that confusion.
jp9000 6 năm trước cách đây
mục cha
commit
985772d915
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      UI/obs-app.cpp

+ 4 - 4
UI/obs-app.cpp

@@ -1257,13 +1257,13 @@ static bool StartupOBS(const char *locale, profiler_name_store_t *store)
 
 inline void OBSApp::ResetHotkeyState(bool inFocus)
 {
-	obs_hotkey_enable_background_press(inFocus || enableHotkeysInFocus);
+	obs_hotkey_enable_background_press(!inFocus || enableHotkeysInFocus);
 }
 
 void OBSApp::EnableInFocusHotkeys(bool enable)
 {
 	enableHotkeysInFocus = enable;
-	ResetHotkeyState(applicationState() != Qt::ApplicationActive);
+	ResetHotkeyState(applicationState() == Qt::ApplicationActive);
 }
 
 Q_DECLARE_METATYPE(VoidFunc)
@@ -1313,9 +1313,9 @@ bool OBSApp::OBSInit()
 
 	connect(this, &QGuiApplication::applicationStateChanged,
 		[this](Qt::ApplicationState state) {
-			ResetHotkeyState(state != Qt::ApplicationActive);
+			ResetHotkeyState(state == Qt::ApplicationActive);
 		});
-	ResetHotkeyState(applicationState() != Qt::ApplicationActive);
+	ResetHotkeyState(applicationState() == Qt::ApplicationActive);
 	return true;
 }