summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandwlshellintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/extensions/qwaylandwlshellintegration.cpp')
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index abf5b627c..b32416764 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -125,7 +125,8 @@ void WlShellIntegration::handleSetMaximized(QWaylandOutput *output)
nextState = State::Maximized;
finalPosition = designatedOutput->position() + designatedOutput->availableGeometry().topLeft();
- m_shellSurface->sendConfigure(designatedOutput->availableGeometry().size(), QWaylandWlShellSurface::NoneEdge);
+ auto scaleFactor = m_item->view()->output()->scaleFactor();
+ m_shellSurface->sendConfigure(designatedOutput->availableGeometry().size() / scaleFactor, QWaylandWlShellSurface::NoneEdge);
}
void WlShellIntegration::handleSetFullScreen(QWaylandWlShellSurface::FullScreenMethod method, uint framerate, QWaylandOutput *output)
@@ -176,8 +177,9 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par
t.clear(&t);
m_item->setRotation(0);
m_item->setScale(1.0);
- m_item->setX(relativeToParent.x());
- m_item->setY(relativeToParent.y());
+ auto scaleFactor = m_item->output()->scaleFactor() / devicePixelRatio();
+ m_item->setX(relativeToParent.x() * scaleFactor);
+ m_item->setY(relativeToParent.y() * scaleFactor);
m_item->setParentItem(parentItem);
}
@@ -206,6 +208,11 @@ void WlShellIntegration::handlePopupRemoved()
isPopup = false;
}
+qreal WlShellIntegration::devicePixelRatio() const
+{
+ return m_item->window() ? m_item->window()->devicePixelRatio() : 1;
+}
+
void WlShellIntegration::handleShellSurfaceDestroyed()
{
if (isPopup)
@@ -237,7 +244,7 @@ void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset)
float scaleFactor = m_item->view()->output()->scaleFactor();
QQuickItem *moveItem = m_item->moveItem();
- moveItem->setPosition(moveItem->position() + offset * scaleFactor);
+ moveItem->setPosition(moveItem->position() + offset * scaleFactor / devicePixelRatio());
}
bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
@@ -250,7 +257,7 @@ bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event)
return true;
}
float scaleFactor = m_item->view()->output()->scaleFactor();
- QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor;
+ QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio();
QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges);
m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges);
} else if (grabberState == GrabberState::Move) {