Skip to content

Commit

Permalink
[lipstick-qt5] Emit appropriate WL_OUTPUT_TRANSFORM for orientation c…
Browse files Browse the repository at this point in the history
…hange. Contributes to JB#42625

This commit ensures that the transform we emit matches the expectation
of the qtwaylandscreen implementation in
qtwayland:src/client/qwaylandscreen.cpp: QWaylandScreen::output_done().
  • Loading branch information
Chris Adams authored and adenexter committed Sep 6, 2018
1 parent d148e39 commit 7dcdbbc
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/compositor/lipstickcompositor.cpp
Expand Up @@ -613,38 +613,35 @@ void LipstickCompositor::setScreenOrientation(Qt::ScreenOrientation screenOrient
if (debug())
qDebug() << "Setting screen orientation on QWaylandCompositor";

QSize physSize = m_output->physicalSize();
const QSize physSize = m_output->physicalSize();
const bool isPortrait = physSize.height() > physSize.width();
switch(screenOrientation) {
case Qt::PrimaryOrientation:
m_output->setTransform(QWaylandOutput::TransformNormal);
break;
case Qt::LandscapeOrientation:
if(physSize.width() > physSize.height())
m_output->setTransform(QWaylandOutput::TransformNormal);
else
m_output->setTransform(QWaylandOutput::Transform90);
m_output->setTransform(isPortrait
? QWaylandOutput::Transform270
: QWaylandOutput::TransformNormal);
break;
case Qt::PortraitOrientation:
if(physSize.width() > physSize.height())
m_output->setTransform(QWaylandOutput::Transform90);
else
m_output->setTransform(QWaylandOutput::TransformNormal);
m_output->setTransform(isPortrait
? QWaylandOutput::TransformNormal
: QWaylandOutput::Transform90);
break;
case Qt::InvertedLandscapeOrientation:
if(physSize.width() > physSize.height())
m_output->setTransform(QWaylandOutput::Transform180);
else
m_output->setTransform(QWaylandOutput::Transform270);
m_output->setTransform(isPortrait
? QWaylandOutput::Transform90
: QWaylandOutput::Transform180);
break;
case Qt::InvertedPortraitOrientation:
if(physSize.width() > physSize.height())
m_output->setTransform(QWaylandOutput::Transform270);
else
m_output->setTransform(QWaylandOutput::Transform180);
m_output->setTransform(isPortrait
? QWaylandOutput::Transform180
: QWaylandOutput::Transform270);
break;
}
QWindowSystemInterface::handleScreenOrientationChange(qApp->primaryScreen(),screenOrientation);

QWindowSystemInterface::handleScreenOrientationChange(qApp->primaryScreen(), screenOrientation);
m_screenOrientation = screenOrientation;
emit screenOrientationChanged();
}
Expand Down

0 comments on commit 7dcdbbc

Please sign in to comment.