[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:
parent
7724edac14
commit
f885ce3796
2 changed files with 15 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
m_applicationsToStart = applications;
|
||||
}
|
||||
|
||||
bool notify(QObject *o, QEvent *e) override;
|
||||
|
||||
protected:
|
||||
void performStartup() override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue