From 9d019e90ab1637a528f73e6424c2d8658b1522c5 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 28 Apr 2017 18:02:03 -0700 Subject: [PATCH] UI: Limit default canvas res to 1920x1080 or below The reasoning behind this is because having a very large canvas size can negatively affect the user experience -- most sources end up seeming smaller than they need to be to users, resulting in the user needing to size up the sources, or in the case of webcams it makes the user try to use much larger webcam resolutions than they should reasonably need to do, resulting in higher unintentional resource usage. The program will additionally require more fillrate to render and downscale things as well. This applies only to the default starting base/canvas resolution for new users only. Additionally, users that ran the program pre-19 will be unaffected by this change, as it will detect that and set the old defaults to prevent an unexpected change in resolution for those users. --- UI/obs-app.cpp | 17 +++++++++++++++++ UI/window-basic-main.cpp | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 2758b72e5..67b4c0fed 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -583,6 +583,7 @@ static string GetSceneCollectionFileFromName(const char *name) bool OBSApp::InitGlobalConfig() { char path[512]; + bool changed = false; int len = GetConfigPath(path, sizeof(path), "obs-studio/global.ini"); @@ -606,6 +607,7 @@ bool OBSApp::InitGlobalConfig() config_set_string(globalConfig, "Basic", "SceneCollectionFile", path.c_str()); + changed = true; } } @@ -617,9 +619,24 @@ bool OBSApp::InitGlobalConfig() opt_starting_profile.c_str()); config_set_string(globalConfig, "Basic", "ProfileDir", path.c_str()); + changed = true; } } + if (!config_has_user_value(globalConfig, "General", "OldDefaults")) { + uint32_t lastVersion = config_get_int(globalConfig, "General", + "LastVersion"); + bool useOldDefaults = lastVersion && + lastVersion < MAKE_SEMANTIC_VERSION(19, 0, 0); + + config_set_bool(globalConfig, "General", "Pre19Defaults", + useOldDefaults); + changed = true; + } + + if (changed) + config_save_safe(globalConfig, "tmp", nullptr); + return InitGlobalConfigDefaults(); } diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index d788adcc2..3264e94ca 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -913,6 +913,17 @@ bool OBSBasic::InitBasicConfigDefaults() uint32_t cx = primaryScreen->size().width(); uint32_t cy = primaryScreen->size().height(); + bool oldResolutionDefaults = config_get_bool(App()->GlobalConfig(), + "General", "Pre19Defaults"); + + /* use 1920x1080 for new default base res if main monitor is above + * 1920x1080, but don't apply for people from older builds -- only to + * new users */ + if (!oldResolutionDefaults && (cx * cy) > (1920 * 1080)) { + cx = 1920; + cy = 1080; + } + /* ----------------------------------------------------- */ /* move over mixer values in advanced if older config */ if (config_has_user_value(basicConfig, "AdvOut", "RecTrackIndex") &&