[wayland] Create event dispatcher in QPA plugin
We no longer need to have the event dispatcher created before starting the QApplication, thus we can leave it to the QPA plugin to creat it. Also we don't need to implement our own dispatcher any more but can use one from Qt5PlatformSupport as we link it anyways. The special need for dispatching the WaylandServer is no longer needed as we can explicitly dispatch it from the QPA plugin if needed.
This commit is contained in:
parent
a10be8a7d7
commit
abb9bf1355
4 changed files with 3 additions and 40 deletions
|
@ -555,8 +555,6 @@ install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELIN
|
|||
install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
|
||||
include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})
|
||||
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
add_executable(kwin_wayland main_wayland.cpp)
|
||||
target_link_libraries(kwin_wayland kwin)
|
||||
|
||||
|
|
|
@ -34,11 +34,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KPluginMetaData>
|
||||
// Qt
|
||||
#include <qplatformdefs.h>
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QCommandLineParser>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFile>
|
||||
#include <QFutureWatcher>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <QProcess>
|
||||
#include <QSocketNotifier>
|
||||
#include <QThread>
|
||||
|
@ -316,25 +316,6 @@ static void readDisplay(int pipe)
|
|||
close(pipe);
|
||||
}
|
||||
|
||||
EventDispatcher::EventDispatcher(QObject *parent)
|
||||
: QEventDispatcherUNIX(parent)
|
||||
{
|
||||
}
|
||||
|
||||
EventDispatcher::~EventDispatcher() = default;
|
||||
|
||||
bool EventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
{
|
||||
waylandServer()->dispatch();
|
||||
const bool didSendEvents = QEventDispatcherUNIX::processEvents(flags);
|
||||
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
|
||||
}
|
||||
|
||||
bool EventDispatcher::hasPendingEvents()
|
||||
{
|
||||
return QEventDispatcherUNIX::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
|
||||
}
|
||||
|
||||
static const QString s_waylandPlugin = QStringLiteral("KWinWaylandWaylandBackend");
|
||||
static const QString s_x11Plugin = QStringLiteral("KWinWaylandX11Backend");
|
||||
static const QString s_fbdevPlugin = QStringLiteral("KWinWaylandFbdevBackend");
|
||||
|
@ -368,10 +349,6 @@ static QString automaticBackendSelection()
|
|||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
// set our own event dispatcher to be able to dispatch events before the event loop is started
|
||||
QAbstractEventDispatcher *eventDispatcher = new KWin::EventDispatcher();
|
||||
QCoreApplication::setEventDispatcher(eventDispatcher);
|
||||
|
||||
KWin::Application::setupMalloc();
|
||||
KWin::Application::setupLocalizedString();
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ 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>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
class QProcess;
|
||||
|
@ -70,17 +69,6 @@ private:
|
|||
QProcessEnvironment m_environment;
|
||||
};
|
||||
|
||||
class EventDispatcher : public QEventDispatcherUNIX
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EventDispatcher(QObject *parent = nullptr);
|
||||
virtual ~EventDispatcher();
|
||||
|
||||
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
|
||||
bool hasPendingEvents() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QtCore/private/qeventdispatcher_unix_p.h>
|
||||
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
||||
#include <QtPlatformSupport/private/qgenericunixthemes_p.h>
|
||||
#include <QtPlatformSupport/private/qunixeventdispatcher_qpa_p.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -90,8 +91,7 @@ void Integration::initialize()
|
|||
|
||||
QAbstractEventDispatcher *Integration::createEventDispatcher() const
|
||||
{
|
||||
// TODO: add our own event dispatcher
|
||||
return new QEventDispatcherUNIX;
|
||||
return new QUnixEventDispatcherQPA;
|
||||
}
|
||||
|
||||
QPlatformBackingStore *Integration::createPlatformBackingStore(QWindow *window) const
|
||||
|
|
Loading…
Reference in a new issue