diff --git a/src/frontend.cpp b/src/frontend.cpp index 766293e35a7..c31e4618a71 100644 --- a/src/frontend.cpp +++ b/src/frontend.cpp @@ -1651,7 +1651,16 @@ class ResolutionDropdown : public DropdownWidget } dropdown->setOnChange([screenResolutionsModel](DropdownWidget& dropdown) { - if (auto selectedIndex = dropdown.getSelectedIndex()) + auto pResolutionDropdown = std::dynamic_pointer_cast(dropdown.shared_from_this()); + if (!pResolutionDropdown) + { + return; + } + if (pResolutionDropdown->skipActualResolutionChange) + { + return; + } + if (auto selectedIndex = pResolutionDropdown->getSelectedIndex()) { screenResolutionsModel.selectAt(selectedIndex.value()); } @@ -1665,11 +1674,14 @@ class ResolutionDropdown : public DropdownWidget auto closestResolution = screenResolutionsModel.findResolutionClosestToCurrent(); if (closestResolution != screenResolutionsModel.end()) { + skipActualResolutionChange = true; setSelectedIndex(closestResolution - screenResolutionsModel.begin()); + skipActualResolutionChange = false; } } private: ScreenResolutionsModel screenResolutionsModel; + bool skipActualResolutionChange = false; }; void refreshCurrentVideoOptionsValues()