[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
This commit is contained in:
parent
e6c0680100
commit
03f79868f5
2 changed files with 6 additions and 2 deletions
|
@ -124,9 +124,10 @@ Outputs VirtualBackend::enabledOutputs() const
|
|||
return m_enabledOutputs;
|
||||
}
|
||||
|
||||
void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries)
|
||||
void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries, QVector<int> 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<QRect> 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()) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
QPainterBackend* createQPainterBackend() override;
|
||||
OpenGLBackend *createOpenGLBackend() override;
|
||||
|
||||
Q_INVOKABLE void setVirtualOutputs(int count, QVector<QRect> geometries = QVector<QRect>());
|
||||
Q_INVOKABLE void setVirtualOutputs(int count, QVector<QRect> geometries = QVector<QRect>(), QVector<int> scales = QVector<int>());
|
||||
|
||||
Outputs outputs() const override;
|
||||
Outputs enabledOutputs() const override;
|
||||
|
|
Loading…
Reference in a new issue