D20255: Improve behavior of rotated displays

Vlad Zagorodniy <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
zzag added inline comments.

INLINE COMMENTS

> drm_output.cpp:130
>  
> -qreal orientationToRotation(Qt::ScreenOrientation orientation)
> +int orientationToRotation(Qt::ScreenOrientation orientation)
>  {

Could you please explain this change?

> drm_output.cpp:147
>  
> +QMatrix4x4&& DrmOutput::matrixDisplay(const QSize &s) const
> +{

QMatrix4x4 &&

> drm_output.cpp:152
> +    if (angle) {
> +        const QSize center = s/2;
> +

Please follow coding style.

`s / 2`

> drm_output.cpp:181
>  {
> -    QMatrix4x4 matrix;
> -    QMatrix4x4 hotspotMatrix;
> -    if (orientation() != Qt::LandscapeOrientation) {
> -        auto rotation = orientationToRotation(orientation());
> -        matrix.translate(pixelSize().width() /2.0, pixelSize().height() / 2.0);
> -        matrix.rotate(rotation, 0.0f, 0.0f, 1.0f);
> -        matrix.translate(-pixelSize().width() /2.0, -pixelSize().height() / 2.0);
> -        const auto cursorSize = m_backend->softwareCursor().size();
> -        hotspotMatrix.translate(cursorSize.width()/2.0, cursorSize.height()/2.0);
> -        hotspotMatrix.rotate(rotation, 0.0f, 0.0f, 1.0f);
> -        hotspotMatrix.translate(-cursorSize.width()/2.0, -cursorSize.height()/2.0);
> -    }
> -    hotspotMatrix.scale(scale());
> -    matrix.scale(scale());
> -    const auto outputGlobalPos = AbstractOutput::globalPos();
> -    matrix.translate(-outputGlobalPos.x(), -outputGlobalPos.y());
> -    const QPoint p = matrix.map(globalPos) - hotspotMatrix.map(m_backend->softwareCursorHotspot());
> +    const auto hotspotMatrix = matrixDisplay(m_backend->softwareCursor().size());
> +

I'd say that's abuse of `auto` even though the name contains "Matrix".

> drm_output.cpp:185
> +    switch(orientation()) {
> +        case Qt::PrimaryOrientation:
> +        case Qt::LandscapeOrientation:

Please don't indent `case`s.

> drm_output.cpp:189
> +        case Qt::PortraitOrientation:
> +            p = QPoint(p.ry(), pixelSize().height() - p.rx());
> +            break;

Why `ry` and `rx`?

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D20255

To: apol, #kwin
Cc: zzag, kwin, jraleigh, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, ngraham, alexeymin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.