Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/virtual/virtual_backend.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 43 | if (!m_screenshotDir->isValid()) { | |||
---|---|---|---|---|---|
44 | m_screenshotDir.reset(); | 44 | m_screenshotDir.reset(); | ||
45 | } | 45 | } | ||
46 | if (!m_screenshotDir.isNull()) { | 46 | if (!m_screenshotDir.isNull()) { | ||
47 | qDebug() << "Screenshots saved to: " << m_screenshotDir->path(); | 47 | qDebug() << "Screenshots saved to: " << m_screenshotDir->path(); | ||
48 | } | 48 | } | ||
49 | } | 49 | } | ||
50 | setSupportsPointerWarping(true); | 50 | setSupportsPointerWarping(true); | ||
51 | setSupportsGammaControl(true); | 51 | setSupportsGammaControl(true); | ||
52 | handleOutputs(); | ||||
52 | } | 53 | } | ||
53 | 54 | | |||
54 | VirtualBackend::~VirtualBackend() | 55 | VirtualBackend::~VirtualBackend() | ||
55 | { | 56 | { | ||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | void VirtualBackend::init() | 59 | void VirtualBackend::init() | ||
59 | { | 60 | { | ||
60 | /* | 61 | /* | ||
61 | * Some tests currently expect one output present at start, | 62 | * Some tests currently expect one output present at start, | ||
62 | * others set them explicitly. | 63 | * others set them explicitly. | ||
63 | * | 64 | * | ||
64 | * TODO: rewrite all tests to explicitly set the outputs. | 65 | * TODO: rewrite all tests to explicitly set the outputs. | ||
65 | */ | 66 | */ | ||
66 | if (!m_outputs.size()) { | 67 | if (!m_outputs.size()) { | ||
67 | VirtualOutput *dummyOutput = new VirtualOutput(this); | 68 | VirtualOutput *dummyOutput = new VirtualOutput(this); | ||
68 | dummyOutput->setGeometry(QRect(QPoint(0, 0), initialWindowSize())); | 69 | dummyOutput->init(QPoint(0, 0), initialWindowSize()); | ||
69 | m_outputs << dummyOutput ; | 70 | m_outputs << dummyOutput ; | ||
70 | m_enabledOutputs << dummyOutput ; | 71 | m_enabledOutputs << dummyOutput ; | ||
71 | } | 72 | } | ||
72 | 73 | | |||
73 | | ||||
74 | setSoftWareCursor(true); | 74 | setSoftWareCursor(true); | ||
75 | setReady(true); | 75 | setReady(true); | ||
76 | waylandServer()->seat()->setHasPointer(true); | 76 | waylandServer()->seat()->setHasPointer(true); | ||
77 | waylandServer()->seat()->setHasKeyboard(true); | 77 | waylandServer()->seat()->setHasKeyboard(true); | ||
78 | waylandServer()->seat()->setHasTouch(true); | 78 | waylandServer()->seat()->setHasTouch(true); | ||
79 | 79 | | |||
80 | emit screensQueried(); | 80 | emit screensQueried(); | ||
81 | } | 81 | } | ||
Show All 39 Lines | 117 | { | |||
121 | bool countChanged = m_outputs.size() != count; | 121 | bool countChanged = m_outputs.size() != count; | ||
122 | qDeleteAll(m_outputs.begin(), m_outputs.end()); | 122 | qDeleteAll(m_outputs.begin(), m_outputs.end()); | ||
123 | m_outputs.resize(count); | 123 | m_outputs.resize(count); | ||
124 | m_enabledOutputs.resize(count); | 124 | m_enabledOutputs.resize(count); | ||
125 | 125 | | |||
126 | int sumWidth = 0; | 126 | int sumWidth = 0; | ||
127 | for (int i = 0; i < count; i++) { | 127 | for (int i = 0; i < count; i++) { | ||
128 | VirtualOutput *vo = new VirtualOutput(this); | 128 | VirtualOutput *vo = new VirtualOutput(this); | ||
129 | if (scales.size()) { | | |||
130 | vo->setScale(scales.at(i)); | | |||
131 | } | | |||
132 | if (geometries.size()) { | 129 | if (geometries.size()) { | ||
133 | vo->setGeometry(geometries.at(i)); | 130 | const QRect geo = geometries.at(i); | ||
134 | } else if (!vo->geometry().isValid()) { | 131 | vo->init(geo.topLeft(), geo.size()); | ||
135 | vo->setGeometry(QRect(QPoint(sumWidth, 0), initialWindowSize())); | 132 | } else { | ||
133 | vo->init(QPoint(sumWidth, 0), initialWindowSize()); | ||||
136 | sumWidth += initialWindowSize().width(); | 134 | sumWidth += initialWindowSize().width(); | ||
137 | } | 135 | } | ||
136 | if (scales.size()) { | ||||
137 | vo->setScale(scales.at(i)); | ||||
138 | } | ||||
138 | m_outputs[i] = m_enabledOutputs[i] = vo; | 139 | m_outputs[i] = m_enabledOutputs[i] = vo; | ||
139 | } | 140 | } | ||
140 | 141 | | |||
141 | emit virtualOutputsSet(countChanged); | 142 | emit virtualOutputsSet(countChanged); | ||
142 | } | 143 | } | ||
143 | 144 | | |||
144 | } | 145 | } |