Paste P373

Masterwork From Distant Lands
ActivePublic

Authored by apol on Apr 16 2019, 2:06 AM.
diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp
index cada28cb0..52412a037 100644
--- a/plugins/platforms/drm/drm_output.cpp
+++ b/plugins/platforms/drm/drm_output.cpp
@@ -313,6 +313,7 @@ void DrmOutput::initOutputDevice(drmModeConnector *connector)
const QString model = connectorName + QStringLiteral("-") + QString::number(connector->connector_type_id) + QStringLiteral("-") + modelName;
// read in mode information
+ m_preferredOrientation = Qt::LandscapeOrientation;
QVector<KWayland::Server::OutputDeviceInterface::Mode> modes;
for (int i = 0; i < connector->count_modes; ++i) {
// TODO: in AMS here we could read and store for later every mode's blob_id
@@ -323,6 +324,7 @@ void DrmOutput::initOutputDevice(drmModeConnector *connector)
deviceflags |= KWayland::Server::OutputDeviceInterface::ModeFlag::Current;
}
if (m->type & DRM_MODE_TYPE_PREFERRED) {
+ m_preferredOrientation = m->hdisplay > m->vdisplay ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
deviceflags |= KWayland::Server::OutputDeviceInterface::ModeFlag::Preferred;
}
@@ -900,10 +902,10 @@ bool DrmOutput::dpmsAtomicOff()
}
///Copied from QPlatformScreen
-static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+int DrmOutput::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const
{
- if (a == Qt::PrimaryOrientation) a = Qt::LandscapeOrientation;
- if (b == Qt::PrimaryOrientation) b = Qt::LandscapeOrientation;
+ if (a == Qt::PrimaryOrientation) a = m_preferredOrientation;
+ if (b == Qt::PrimaryOrientation) b = m_preferredOrientation;
if (a == b)
return 0;
diff --git a/plugins/platforms/drm/drm_output.h b/plugins/platforms/drm/drm_output.h
index 5816e6ed5..62bad329c 100644
--- a/plugins/platforms/drm/drm_output.h
+++ b/plugins/platforms/drm/drm_output.h
@@ -133,6 +133,8 @@ private:
int getGammaRampSize() const override;
bool setGammaRamp(const ColorCorrect::GammaRamp &gamma) override;
+ int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
+
DrmBackend *m_backend;
DrmConnector *m_conn = nullptr;
DrmCrtc *m_crtc = nullptr;
@@ -165,6 +167,7 @@ private:
bool m_internal = false;
bool m_deleted = false;
int m_softwareRotationAngle = 0;
+ Qt::ScreenOrientation m_preferredOrientation = Qt::LandscapeOrientation;
};
}
apol edited the content of this paste. (Show Details)Apr 16 2019, 2:06 AM
apol changed the title of this paste from untitled to Masterwork From Distant Lands.