Commit dec95688 authored by Roman Gilg's avatar Roman Gilg
Browse files

Position output identifiers with respect to scaling factors

Respect scaling factors for calculation of screen sizes and by that fix
off-center placement of output identifiers.

Test Plan: Works on X, on Wayland the positioning does not work in any case currently.

Reviewers: davidedmundson, broulik

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 597e826c
......@@ -465,15 +465,23 @@ void Widget::slotIdentifyOutputs(KScreen::ConfigOperation *op)
qWarning() << "Failed to obtain root item";
QSize realSize;
QSize deviceSize, logicalSize;
if (output->isHorizontal()) {
realSize = mode->size();
deviceSize = mode->size();
} else {
deviceSize = QSize(mode->size().height(), mode->size().width());
if (config->supportedFeatures() & KScreen::Config::Feature::PerOutputScaling) {
// no scale adjustment needed on Wayland
logicalSize = deviceSize;
} else {
realSize = QSize(mode->size().height(), mode->size().width());
logicalSize = deviceSize / devicePixelRatioF();
rootObj->setProperty("outputName", Utils::outputName(output));
rootObj->setProperty("modeName", Utils::sizeToString(realSize));
view->setProperty("screenSize", QRect(output->pos(), realSize));
rootObj->setProperty("modeName", Utils::sizeToString(deviceSize));
view->setProperty("screenSize", QRect(output->pos(), logicalSize));
mOutputIdentifiers << view;
Supports Markdown
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