diff --git a/src/wayland/tests/CMakeLists.txt b/src/wayland/tests/CMakeLists.txt index 5c292bf55c..9dc0ec7e36 100644 --- a/src/wayland/tests/CMakeLists.txt +++ b/src/wayland/tests/CMakeLists.txt @@ -1,5 +1,7 @@ include(ECMMarkAsTest) +# find_package(Qt5Core ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENT Private _check_private) +include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS}) set(testServer_SRCS waylandservertest.cpp ) diff --git a/src/wayland/tests/waylandservertest.cpp b/src/wayland/tests/waylandservertest.cpp index 4b40fdd99c..29ae90e653 100644 --- a/src/wayland/tests/waylandservertest.cpp +++ b/src/wayland/tests/waylandservertest.cpp @@ -25,6 +25,7 @@ License along with this library. If not, see . #include #include +#include #include #include @@ -80,9 +81,14 @@ int main(int argc, char **argv) { using namespace KWayland::Server; + // set our own event dispatcher to be able to dispatch events before the event loop is started + QAbstractEventDispatcher *eventDispatcher = new QEventDispatcherGlib(); + QCoreApplication::setEventDispatcher(eventDispatcher); + // first create the Server and setup with minimum to get an XWayland connected Display display; display.start(); + display.createShm(); CompositorInterface *compositor = display.createCompositor(&display); compositor->create(); ShellInterface *shell = display.createShell(); @@ -91,7 +97,6 @@ int main(int argc, char **argv) output->setPhysicalSize(QSize(10, 10)); output->addMode(QSize(1024, 768)); output->create(); - display.createShm(); // starts XWayland by forking and opening a pipe const int pipe = startXServer(); @@ -104,7 +109,7 @@ int main(int argc, char **argv) tv.tv_sec = 0; tv.tv_usec = 0; do { - display.dispatchEvents(1000); + eventDispatcher->processEvents(QEventLoop::WaitForMoreEvents); FD_ZERO(&rfds); FD_SET(pipe, &rfds); } while (select(pipe + 1, &rfds, NULL, NULL, &tv) == 0); @@ -113,7 +118,6 @@ int main(int argc, char **argv) readDisplayFromPipe(pipe); QGuiApplication app(argc, argv); - display.startLoop(); SeatInterface *seat = display.createSeat(); seat->setName(QStringLiteral("testSeat0"));