Commit 6857fe54 authored by Roman Gilg's avatar Roman Gilg

Add output orientation size helper

Summary:
In order to reduce code duplication add this helper
to AbstractOutput.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16794
parent 6295d1e6
......@@ -59,10 +59,7 @@ QRect AbstractOutput::geometry() const
QSize AbstractOutput::physicalSize() const
{
if (m_orientation == Qt::PortraitOrientation || m_orientation == Qt::InvertedPortraitOrientation) {
return m_physicalSize.transposed();
}
return m_physicalSize;
return orientateSize(m_physicalSize);
}
int AbstractOutput::refreshRate() const
......@@ -251,4 +248,12 @@ void AbstractOutput::initWaylandOutputDevice(const QString &model,
m_waylandOutputDevice->create();
}
QSize AbstractOutput::orientateSize(const QSize &size) const
{
if (m_orientation == Qt::PortraitOrientation || m_orientation == Qt::InvertedPortraitOrientation) {
return size.transposed();
}
return size;
}
}
......@@ -171,6 +171,8 @@ protected:
void setWaylandMode(const QSize &size, int refreshRate);
QSize orientateSize(const QSize &size) const;
private:
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
QPointer<KWayland::Server::XdgOutputInterface> m_xdgOutput;
......
......@@ -783,11 +783,7 @@ void DrmOutput::updateMode(int modeIndex)
QSize DrmOutput::pixelSize() const
{
auto orient = orientation();
if (orient == Qt::PortraitOrientation || orient == Qt::InvertedPortraitOrientation) {
return QSize(m_mode.vdisplay, m_mode.hdisplay);
}
return QSize(m_mode.hdisplay, m_mode.vdisplay);
return orientateSize(QSize(m_mode.hdisplay, m_mode.vdisplay));
}
void DrmOutput::setWaylandMode()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment