summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/mockoutput.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-02-08 16:53:39 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-02-21 12:38:57 +0000
commitfd9fec4fc7f43fb939e8e5a946c7858390bbd9d3 (patch)
tree8d50133a7e7ccbd5ca7787836396d238151175d8 /tests/auto/client/shared/mockoutput.cpp
parent3dd9c91b6ebd7f9eccecad90ac57681f6bf6c5d6 (diff)
Fix crash when connecting a new screen
In QWaylandWindow::virtualSiblings, don't include screens that have not been added yet. I.e. QWaylandScreens for which QPlatformIntegration::screenAdded has not yet been called. There are two reasons why this crash wasn't covered by the removePrimaryScreen() test. First of all, the mock output didn't send wl_output.done events when updating the mode/geometry. These wayland events are what causes QWindowSystemInterface::handleScreenGeometryChange() to be called (where virtualSiblings are called). Furthermore, virtualSiblings is only called when the geometry actually changes, so add a new test that changes the screen geometry of the existing screen while a new one is being added (i.e. moves it to the right). Task-number: QTBUG-62044 Change-Id: I623fbf8799d21c6b9293e7120ded301277639cc6 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Aleix Pol Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client/shared/mockoutput.cpp')
-rw-r--r--tests/auto/client/shared/mockoutput.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/auto/client/shared/mockoutput.cpp b/tests/auto/client/shared/mockoutput.cpp
index 7d7b7413a..13e0524ad 100644
--- a/tests/auto/client/shared/mockoutput.cpp
+++ b/tests/auto/client/shared/mockoutput.cpp
@@ -54,6 +54,16 @@ void Compositor::sendRemoveOutput(void *data, const QList<QVariant> &parameters)
delete output;
}
+void Compositor::sendOutputGeometry(void *data, const QList<QVariant> &parameters)
+{
+ Compositor *compositor = static_cast<Compositor *>(data);
+ Q_ASSERT(compositor);
+ Output *output = resolveOutput(parameters.first());
+ Q_ASSERT(output);
+ QRect geometry = parameters.at(1).toRect();
+ output->sendGeometryAndMode(geometry);
+}
+
void Compositor::setOutputMode(void *data, const QList<QVariant> &parameters)
{
Compositor *compositor = static_cast<Compositor *>(data);
@@ -74,16 +84,29 @@ Output::Output(wl_display *display, const QSize &resolution, const QPoint &posit
void Output::setCurrentMode(const QSize &size)
{
- qDebug() << Q_FUNC_INFO << size;
m_size = size;
- for (Resource *resource : resourceMap())
+ for (Resource *resource : resourceMap()) {
+ sendCurrentMode(resource);
+ send_done(resource->handle);
+ }
+}
+
+void Output::sendGeometryAndMode(const QRect &geometry)
+{
+ m_size = geometry.size();
+ m_position = geometry.topLeft();
+ for (Resource *resource : resourceMap()) {
+ sendGeometry(resource);
sendCurrentMode(resource);
+ send_done(resource->handle);
+ }
}
void Output::output_bind_resource(QtWaylandServer::wl_output::Resource *resource)
{
sendGeometry(resource);
sendCurrentMode(resource);
+ send_done(resource->handle);
}
void Output::sendGeometry(Resource *resource)