From f7bc3beab16f4c1b2795e5bb04ed661a5b948de6 Mon Sep 17 00:00:00 2001 From: April & May & June Date: Tue, 27 Jan 2026 14:56:13 +0800 Subject: [PATCH] fix: fix wayland client dispatch loop In previous commit d63a6b we dispatch wayland events purely inside the QSocketNotifier. This will cause server events that is send before the notifier created is not being dispatched, which is not what we want and will cause severe issue in the current interaction model of ddm & treeland, as treeland will send an event immediately after ddm is connected. Fix it by dispatch once before create notifier. --- src/daemon/TreelandConnector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/daemon/TreelandConnector.cpp b/src/daemon/TreelandConnector.cpp index ecce431..f950760 100644 --- a/src/daemon/TreelandConnector.cpp +++ b/src/daemon/TreelandConnector.cpp @@ -205,6 +205,8 @@ void TreelandConnector::connect(QString socketPath) { wl_display_roundtrip(m_display); + while (wl_display_dispatch_pending(m_display) > 0); + wl_display_flush(m_display); m_notifier = new QSocketNotifier(wl_display_get_fd(m_display), QSocketNotifier::Read); QObject::connect(m_notifier, &QSocketNotifier::activated, this, [this] { if (wl_display_dispatch(m_display) == -1 || wl_display_flush(m_display) == -1) {