[wayland] Implement notify in ApplicationWayland

If we get an Expose event for any QWindow we need to ensure that all
wayland events on both client (Qt) and server (KWin) side are dispatched.
Otherwise it could happen that Qt starts rendering although the last
frame callback has not yet been emitted, causing the main gui thread to
be blocked.
This commit is contained in:
Martin Gräßlin 2015-05-20 13:11:17 +02:00
parent 7724edac14
commit f885ce3796
2 changed files with 15 additions and 0 deletions

View file

@ -251,6 +251,19 @@ void ApplicationWayland::createX11Connection()
setX11RootWindow(defaultScreen()->root);
}
bool ApplicationWayland::notify(QObject *o, QEvent *e)
{
if (qobject_cast< QWindow* >(o)) {
if (e->type() == QEvent::Expose) {
// ensure all Wayland events both on client and server side are dispatched
// otherwise it is possible that Qt starts rendering and blocks the main gui thread
// as it waits for the callback of the last frame
waylandServer()->dispatch();
}
}
return Application::notify(o, e);
}
/**
* Starts the Xwayland-Server.
* The new process is started by forking into it.

View file

@ -39,6 +39,8 @@ public:
m_applicationsToStart = applications;
}
bool notify(QObject *o, QEvent *e) override;
protected:
void performStartup() override;