From 03f79868f5d64316d3fca6252b6095c3039ea498 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 8 Jan 2019 15:51:33 +0000 Subject: [PATCH] [platforms/virtual] Add API to set scale in virtual backend Summary: For unit test purposes Test Plan: Used by unit test InternalWindowTest::testScale in linked commit Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18086 --- plugins/platforms/virtual/virtual_backend.cpp | 6 +++++- plugins/platforms/virtual/virtual_backend.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/platforms/virtual/virtual_backend.cpp b/plugins/platforms/virtual/virtual_backend.cpp index 75cb8b4cc7..339aaef00a 100644 --- a/plugins/platforms/virtual/virtual_backend.cpp +++ b/plugins/platforms/virtual/virtual_backend.cpp @@ -124,9 +124,10 @@ Outputs VirtualBackend::enabledOutputs() const return m_enabledOutputs; } -void VirtualBackend::setVirtualOutputs(int count, QVector geometries) +void VirtualBackend::setVirtualOutputs(int count, QVector geometries, QVector scales) { Q_ASSERT(geometries.size() == 0 || geometries.size() == count); + Q_ASSERT(scales.size() == 0 || scales.size() == count); bool countChanged = m_outputs.size() != count; qDeleteAll(m_outputs.begin(), m_outputs.end()); @@ -136,6 +137,9 @@ void VirtualBackend::setVirtualOutputs(int count, QVector geometries) int sumWidth = 0; for (int i = 0; i < count; i++) { VirtualOutput *vo = new VirtualOutput(this); + if (scales.size()) { + vo->setScale(scales.at(i)); + } if (geometries.size()) { vo->setGeometry(geometries.at(i)); } else if (!vo->geometry().isValid()) { diff --git a/plugins/platforms/virtual/virtual_backend.h b/plugins/platforms/virtual/virtual_backend.h index 4b751d449c..167628f7c4 100644 --- a/plugins/platforms/virtual/virtual_backend.h +++ b/plugins/platforms/virtual/virtual_backend.h @@ -54,7 +54,7 @@ public: QPainterBackend* createQPainterBackend() override; OpenGLBackend *createOpenGLBackend() override; - Q_INVOKABLE void setVirtualOutputs(int count, QVector geometries = QVector()); + Q_INVOKABLE void setVirtualOutputs(int count, QVector geometries = QVector(), QVector scales = QVector()); Outputs outputs() const override; Outputs enabledOutputs() const override;