summaryrefslogtreecommitdiffstats
path: root/src/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index c76bde7..491735a 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -91,7 +91,6 @@ Widget::Widget(QWidget *parent) :
_ui->tabWidget->setCornerWidget(_ui->btnReload);
connect(_ui->btnReload, &QPushButton::clicked, [=](bool) {
_ui->btnReload->setStyleSheet(STYLE_RELOAD_BUTTON_NORMAL);
- ScreenSetup::inst()->initModes();
initControls();
});
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
@@ -141,7 +140,6 @@ Widget::Widget(QWidget *parent) :
// Nothing seems to have changed. This might happen when another tool changes the screen config. Let's not interfere.
} else if (currentCount > _lastScreenCount) { // Screen count increased - auto setup
_lastScreenCount = currentCount;
- ScreenSetup::inst()->initModes();
ScreenMode mode;
auto ret = ScreenSetup::inst()->setDefaultMode(mode);
if (!ret.ok() || !keepResolution()) {
@@ -157,7 +155,6 @@ Widget::Widget(QWidget *parent) :
} else {
// GUI currently visible -- highlight refresh button
if (currentCount > _lastScreenCount) {
- ScreenSetup::inst()->initModes();
initControls();
} else {
_ui->btnReload->setStyleSheet(STYLE_RELOAD_BUTTON_HOT);
@@ -332,12 +329,15 @@ void Widget::initControls(bool jumpToTab)
}
auto resolutions = ScreenSetup::inst()->getVirtualResolutions();
auto screenMap = ScreenSetup::inst()->getScreenPositions();
- auto modes = ScreenSetup::inst()->getCommonModes();
+ auto modes = ScreenSetup::inst()->getCommonModes(true);
auto screenList = screenMap.values();
qSort(screenList.begin(), screenList.end(), dualHeadLess);
// Clone
+ // Determine preferred resolution for cloning: If no screen is detected as projector,
+ // use the smallest prefered resolution across all screens
+ // Otherwise, use the prefered resolution of the first projector we encounter
QSize preferredClone;
- for (auto screen : screenList) {
+ for (const auto &screen : screenList) {
if (!screen.preferredResolution.isEmpty()) {
if (screen.isProjector // Projector always overrides
|| preferredClone.isEmpty() // Have no preferred yet