[wayland] Ensure QWindowSystemInterface::sendWindowSystemEvents gets called in EventDispatcher
KWin used the wrong event dispatcher: QEventDispatcherUNIX insted of QUnixEventDispatcherQPA. This caused QWindow related events never to be send to their destination. Which is one of the reasons why KWin's own windows are not shown at all. As we cannot easily use QUnixEventDispatcherQPA we do the same as that class. Inherit from QEventDispatcherUNIX and call into QWindowSystemInterface::sendWindowSystemEvents.
This commit is contained in:
parent
4a671fbf98
commit
3f94a2afc7
3 changed files with 33 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QtConcurrentRun>
|
||||
#include <QFile>
|
||||
#include <QFutureWatcher>
|
||||
#include <QtCore/private/qeventdispatcher_unix_p.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <QProcess>
|
||||
#include <QSocketNotifier>
|
||||
#include <QThread>
|
||||
|
@ -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);
|
||||
|
|
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef KWIN_MAIN_WAYLAND_H
|
||||
#define KWIN_MAIN_WAYLAND_H
|
||||
#include "main.h"
|
||||
#include <QtCore/private/qeventdispatcher_unix_p.h>
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue