diff options
Diffstat (limited to 'src/platformsupport/kmsconvenience')
-rw-r--r-- | src/platformsupport/kmsconvenience/qkmsdevice.cpp | 23 | ||||
-rw-r--r-- | src/platformsupport/kmsconvenience/qkmsdevice_p.h | 4 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index 319c7f3d9b..669abab331 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -204,6 +204,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, if (vposComp.count() == 2) vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); } + if (userConnectorConfig.value(QStringLiteral("primary")).toBool()) + vinfo->isPrimary = true; } const uint32_t crtc_id = resources->crtcs[crtc]; @@ -413,8 +415,11 @@ struct OrderedScreen QDebug operator<<(QDebug dbg, const OrderedScreen &s) { QDebugStateSaver saver(dbg); - dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex - << " / " << s.vinfo.virtualPos << ")"; + dbg.nospace() << "OrderedScreen(QPlatformScreen=" << s.screen << " (" << s.screen->name() << ") : " + << s.vinfo.virtualIndex + << " / " << s.vinfo.virtualPos + << " / primary: " << s.vinfo.isPrimary + << ")"; return dbg; } @@ -461,13 +466,15 @@ void QKmsDevice::createScreens() drmModeFreeResources(resources); - // Use stable sort to preserve the original order for outputs with unspecified indices. + // Use stable sort to preserve the original (DRM connector) order + // for outputs with unspecified indices. std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan); qCDebug(qLcKmsDebug) << "Sorted screen list:" << screens; QPoint pos(0, 0); QList<QPlatformScreen *> siblings; QVector<QPoint> virtualPositions; + int primarySiblingIdx = -1; for (const OrderedScreen &orderedScreen : screens) { QPlatformScreen *s = orderedScreen.screen; @@ -482,22 +489,26 @@ void QKmsDevice::createScreens() } else { virtualPos = orderedScreen.vinfo.virtualPos; } - qCDebug(qLcKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); + qCDebug(qLcKmsDebug) << "Adding QPlatformScren" << s << "(" << s->name() << ")" + << "to QPA with geometry" << s->geometry() + << "and isPrimary=" << orderedScreen.vinfo.isPrimary; // The order in qguiapp's screens list will match the order set by // virtualIndex. This is not only handy but also required since for instance // evdevtouch relies on it when performing touch device - screen mapping. if (!m_screenConfig->separateScreens()) { siblings.append(s); virtualPositions.append(virtualPos); + if (orderedScreen.vinfo.isPrimary) + primarySiblingIdx = siblings.count() - 1; } else { - registerScreen(s, virtualPos, QList<QPlatformScreen *>() << s); + registerScreen(s, orderedScreen.vinfo.isPrimary, virtualPos, QList<QPlatformScreen *>() << s); } } if (!m_screenConfig->separateScreens()) { // enable the virtual desktop for (int i = 0; i < siblings.count(); ++i) - registerScreen(siblings[i], virtualPositions[i], siblings); + registerScreen(siblings[i], i == primarySiblingIdx, virtualPositions[i], siblings); } } diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h index c41448bc99..35a51c18b1 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h +++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h @@ -120,9 +120,10 @@ class QKmsDevice { public: struct VirtualDesktopInfo { - VirtualDesktopInfo() : virtualIndex(0) { } + VirtualDesktopInfo() : virtualIndex(0), isPrimary(false) { } int virtualIndex; QPoint virtualPos; + bool isPrimary; }; QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path = QString()); @@ -142,6 +143,7 @@ public: protected: virtual QPlatformScreen *createScreen(const QKmsOutput &output) = 0; virtual void registerScreen(QPlatformScreen *screen, + bool isPrimary, const QPoint &virtualPos, const QList<QPlatformScreen *> &virtualSiblings) = 0; |