Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/virtual/virtual_backend.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 70 | { | |||
---|---|---|---|---|---|
71 | /* | 71 | /* | ||
72 | * Some tests currently expect one output present at start, | 72 | * Some tests currently expect one output present at start, | ||
73 | * others set them explicitly. | 73 | * others set them explicitly. | ||
74 | * | 74 | * | ||
75 | * TODO: rewrite all tests to explicitly set the outputs. | 75 | * TODO: rewrite all tests to explicitly set the outputs. | ||
76 | */ | 76 | */ | ||
77 | if (!m_outputs.size()) { | 77 | if (!m_outputs.size()) { | ||
78 | VirtualOutput *dummyOutput = new VirtualOutput(this); | 78 | VirtualOutput *dummyOutput = new VirtualOutput(this); | ||
79 | dummyOutput->m_geo = QRect(QPoint(0, 0), initialWindowSize()); | 79 | dummyOutput->setGeometry(QRect(QPoint(0, 0), initialWindowSize())); | ||
80 | m_outputs = { dummyOutput }; | 80 | m_outputs << dummyOutput ; | ||
81 | m_enabledOutputs << dummyOutput ; | ||||
81 | } | 82 | } | ||
82 | 83 | | |||
83 | 84 | | |||
84 | setSoftWareCursor(true); | 85 | setSoftWareCursor(true); | ||
85 | setReady(true); | 86 | setReady(true); | ||
86 | waylandServer()->seat()->setHasPointer(true); | 87 | waylandServer()->seat()->setHasPointer(true); | ||
87 | waylandServer()->seat()->setHasKeyboard(true); | 88 | waylandServer()->seat()->setHasKeyboard(true); | ||
88 | waylandServer()->seat()->setHasTouch(true); | 89 | waylandServer()->seat()->setHasTouch(true); | ||
Show All 26 Lines | |||||
115 | 116 | | |||
116 | void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries) | 117 | void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries) | ||
117 | { | 118 | { | ||
118 | Q_ASSERT(geometries.size() == 0 || geometries.size() == count); | 119 | Q_ASSERT(geometries.size() == 0 || geometries.size() == count); | ||
119 | 120 | | |||
120 | bool countChanged = m_outputs.size() != count; | 121 | bool countChanged = m_outputs.size() != count; | ||
121 | qDeleteAll(m_outputs.begin(), m_outputs.end()); | 122 | qDeleteAll(m_outputs.begin(), m_outputs.end()); | ||
122 | m_outputs.resize(count); | 123 | m_outputs.resize(count); | ||
124 | m_enabledOutputs.resize(count); | ||||
123 | 125 | | |||
124 | int sumWidth = 0; | 126 | int sumWidth = 0; | ||
125 | for (int i = 0; i < count; i++) { | 127 | for (int i = 0; i < count; i++) { | ||
126 | VirtualOutput *vo = new VirtualOutput(this); | 128 | VirtualOutput *vo = new VirtualOutput(this); | ||
127 | if (geometries.size()) { | 129 | if (geometries.size()) { | ||
128 | vo->m_geo = geometries.at(i); | 130 | vo->setGeometry(geometries.at(i)); | ||
129 | } else if (!vo->m_geo.isValid()) { | 131 | } else if (!vo->geometry().isValid()) { | ||
130 | vo->m_geo = QRect(QPoint(sumWidth, 0), initialWindowSize()); | 132 | vo->setGeometry(QRect(QPoint(sumWidth, 0), initialWindowSize())); | ||
131 | sumWidth += vo->m_geo.width(); | 133 | sumWidth += initialWindowSize().width(); | ||
132 | } | 134 | } | ||
133 | m_outputs[i] = vo; | 135 | m_outputs[i] = m_enabledOutputs[i] = vo; | ||
134 | } | 136 | } | ||
135 | 137 | | |||
136 | emit virtualOutputsSet(countChanged); | 138 | emit virtualOutputsSet(countChanged); | ||
137 | } | 139 | } | ||
138 | 140 | | |||
139 | int VirtualBackend::gammaRampSize(int screen) const { | 141 | int VirtualBackend::gammaRampSize(int screen) const { | ||
140 | return m_outputs[screen]->m_gammaSize; | 142 | auto *out = qobject_cast<VirtualOutput*>(m_outputs[screen]); | ||
143 | return out->m_gammaSize; | ||||
141 | } | 144 | } | ||
142 | 145 | | |||
143 | bool VirtualBackend::setGammaRamp(int screen, ColorCorrect::GammaRamp &gamma) { | 146 | bool VirtualBackend::setGammaRamp(int screen, ColorCorrect::GammaRamp &gamma) { | ||
144 | Q_UNUSED(gamma); | 147 | Q_UNUSED(gamma); | ||
145 | return m_outputs[screen]->m_gammaResult; | 148 | auto *out = qobject_cast<VirtualOutput*>(m_outputs[screen]); | ||
149 | return out->m_gammaResult; | ||||
146 | } | 150 | } | ||
147 | 151 | | |||
148 | } | 152 | } |