From 5b899788dacb30448f12d1b86c67c5a27dab50c1 Mon Sep 17 00:00:00 2001 From: Lordmau5 Date: Tue, 26 Jan 2021 16:49:21 +0100 Subject: [PATCH] UI: Add launch parameter to disable high-DPI scaling --- UI/obs-app.cpp | 12 ++++++++++-- UI/obs-app.hpp | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index bfa91546e..e72f73d1c 100644 --- a/UI/obs-app.cpp +++ b/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", diff --git a/UI/obs-app.hpp b/UI/obs-app.hpp index 8de17d049..4f681f394 100644 --- a/UI/obs-app.hpp +++ b/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;