summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-05-04 14:48:59 +0200
committerDavid Edmundson <[email protected]>2017-05-04 14:48:59 +0200
commit4a9f18f93948259142a29b24be6005987e955884 (patch)
treed267bde2c993870734e089493872e3fa3b2c6c83
parent4ef1c0447748b4b10459bf5efe2c07da88d78166 (diff)
Fix Output::geometry() when dealing with a scaled monitor
Summary: When a monitor is scaled the "size" is not the same as the mode size, we want things in global co-ordinates. This is only relevant on Wayland, but on everything else scale is 1, so this makes no difference. Test Plan: Plugged in normal monitor to laptop, generator had the correct co-ordiantes of second monitor Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D5697
-rw-r--r--src/output.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/output.cpp b/src/output.cpp
index 8f35605..c65dcd7 100644
--- a/src/output.cpp
+++ b/src/output.cpp
@@ -488,9 +488,13 @@ QRect Output::geometry() const
// We can't use QRect(d->pos, d->size), because d->size does not reflect the
// actual rotation() set by caller, it's only updated when we get update from
// KScreen, but not when user changes mode or rotation manually
- return isHorizontal()
- ? QRect(d->pos, currentMode()->size())
- : QRect(d->pos, currentMode()->size().transposed());
+
+ QSize size = currentMode()->size() / d->scale;
+ if (!isHorizontal()) {
+ size = size.transposed();
+ }
+
+ return QRect(d->pos, size);
}
void Output::apply(const OutputPtr& other)