diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96526218e2..291d0bc539 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -610,6 +610,7 @@ install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
if(HAVE_WAYLAND)
include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})
+ include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
kf5_add_kdeinit_executable(kwin_wayland main_wayland.cpp)
target_link_libraries(kdeinit_kwin_wayland kwin)
diff --git a/main_wayland.cpp b/main_wayland.cpp
index b196872f9e..fad16d8ae1 100644
--- a/main_wayland.cpp
+++ b/main_wayland.cpp
@@ -38,7 +38,7 @@ along with this program. If not, see .
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -314,6 +314,24 @@ static void readDisplay(int pipe)
close(pipe);
}
+EventDispatcher::EventDispatcher(QObject *parent)
+ : QEventDispatcherUNIX(parent)
+{
+}
+
+EventDispatcher::~EventDispatcher() = default;
+
+bool EventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
+{
+ const bool didSendEvents = QEventDispatcherUNIX::processEvents(flags);
+ return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
+}
+
+bool EventDispatcher::hasPendingEvents()
+{
+ return QEventDispatcherUNIX::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
+}
+
} // namespace
extern "C"
@@ -335,7 +353,7 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
}
// set our own event dispatcher to be able to dispatch events before the event loop is started
- QAbstractEventDispatcher *eventDispatcher = new QEventDispatcherUNIX();
+ QAbstractEventDispatcher *eventDispatcher = new KWin::EventDispatcher();
QCoreApplication::setEventDispatcher(eventDispatcher);
KWin::WaylandServer *server = KWin::WaylandServer::create(nullptr);
server->init(waylandSocket);
diff --git a/main_wayland.h b/main_wayland.h
index 9189f92565..4f52e55b79 100644
--- a/main_wayland.h
+++ b/main_wayland.h
@@ -20,6 +20,7 @@ along with this program. If not, see .
#ifndef KWIN_MAIN_WAYLAND_H
#define KWIN_MAIN_WAYLAND_H
#include "main.h"
+#include
namespace KWin
{
@@ -52,6 +53,17 @@ private:
QStringList m_applicationsToStart;
};
+class EventDispatcher : public QEventDispatcherUNIX
+{
+ Q_OBJECT
+public:
+ explicit EventDispatcher(QObject *parent = nullptr);
+ virtual ~EventDispatcher();
+
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ bool hasPendingEvents() override;
+};
+
}
#endif