Przeglądaj źródła

UI: Add launch parameter to disable high-DPI scaling

Lordmau5 4 lat temu
rodzic
commit
5b899788da
2 zmienionych plików z 11 dodań i 2 usunięć
  1. 10 2
      UI/obs-app.cpp
  2. 1 0
      UI/obs-app.hpp

+ 10 - 2
UI/obs-app.cpp

@@ -82,6 +82,7 @@ bool opt_start_virtualcam = false;
 bool opt_minimize_tray = false;
 bool opt_allow_opengl = false;
 bool opt_always_on_top = false;
+bool opt_disable_high_dpi_scaling = false;
 bool opt_disable_updater = false;
 string opt_starting_collection;
 string opt_starting_profile;
@@ -1933,7 +1934,9 @@ static int run_program(fstream &logFile, int argc, char *argv[])
 	ScopeProfiler prof{run_program_init};
 
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
-	QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+	QGuiApplication::setAttribute(opt_disable_high_dpi_scaling
+					      ? Qt::AA_DisableHighDpiScaling
+					      : Qt::AA_EnableHighDpiScaling);
 #endif
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) && defined(_WIN32)
 	QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
@@ -2666,6 +2669,10 @@ int main(int argc, char *argv[])
 		} else if (arg_is(argv[i], "--disable-updater", nullptr)) {
 			opt_disable_updater = true;
 
+		} else if (arg_is(argv[i], "--disable-high-dpi-scaling",
+				  nullptr)) {
+			opt_disable_high_dpi_scaling = true;
+
 		} else if (arg_is(argv[i], "--help", "-h")) {
 			std::string help =
 				"--help, -h: Get list of available commands.\n\n"
@@ -2684,7 +2691,8 @@ int main(int argc, char *argv[])
 				"--verbose: Make log more verbose.\n"
 				"--always-on-top: Start in 'always on top' mode.\n\n"
 				"--unfiltered_log: Make log unfiltered.\n\n"
-				"--disable-updater: Disable built-in updater (Windows/Mac only)\n\n";
+				"--disable-updater: Disable built-in updater (Windows/Mac only)\n\n"
+				"--disable-high-dpi-scaling: Disable automatic high-DPI scaling\n\n";
 
 #ifdef _WIN32
 			MessageBoxA(NULL, help.c_str(), "Help",

+ 1 - 0
UI/obs-app.hpp

@@ -234,5 +234,6 @@ extern bool opt_minimize_tray;
 extern bool opt_studio_mode;
 extern bool opt_allow_opengl;
 extern bool opt_always_on_top;
+extern bool opt_disable_high_dpi_scaling;
 extern std::string opt_starting_scene;
 extern bool restart;