xwayland: Replace criticalError() signal with a less fatal signal
If the Xwayland executable can't be found, the whole session will die because a criticalError() signal will be emitted. This change replaces the criticalError() signal with a less severe signal. If the errorOccurred() signal has been emitted during the startup sequence, kwin won't die and will just continue with spawning the session process.
This commit is contained in:
parent
6dbc060596
commit
b13a74c908
4 changed files with 16 additions and 22 deletions
|
@ -151,6 +151,7 @@ void WaylandTestApplication::continueStartupWithScreens()
|
|||
void WaylandTestApplication::finalizeStartup()
|
||||
{
|
||||
if (m_xwayland) {
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &WaylandTestApplication::finalizeStartup);
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
||||
}
|
||||
notifyStarted();
|
||||
|
@ -172,12 +173,7 @@ void WaylandTestApplication::continueStartupWithScene()
|
|||
}
|
||||
|
||||
m_xwayland = new Xwl::Xwayland(this);
|
||||
connect(m_xwayland, &Xwl::Xwayland::criticalError, this, [](int code) {
|
||||
// we currently exit on Xwayland errors always directly
|
||||
// TODO: restart Xwayland
|
||||
std::cerr << "Xwayland had a critical error. Going to exit now." << std::endl;
|
||||
exit(code);
|
||||
});
|
||||
connect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &WaylandTestApplication::finalizeStartup);
|
||||
connect(m_xwayland, &Xwl::Xwayland::started, this, &WaylandTestApplication::finalizeStartup);
|
||||
m_xwayland->start();
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ void ApplicationWayland::continueStartupWithScreens()
|
|||
void ApplicationWayland::finalizeStartup()
|
||||
{
|
||||
if (m_xwayland) {
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||
}
|
||||
startSession();
|
||||
|
@ -203,12 +204,7 @@ void ApplicationWayland::continueStartupWithScene()
|
|||
}
|
||||
|
||||
m_xwayland = new Xwl::Xwayland(this);
|
||||
connect(m_xwayland, &Xwl::Xwayland::criticalError, this, [](int code) {
|
||||
// we currently exit on Xwayland errors always directly
|
||||
// TODO: restart Xwayland
|
||||
std::cerr << "Xwayland had a critical error. Going to exit now." << std::endl;
|
||||
exit(code);
|
||||
});
|
||||
connect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||
connect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||
m_xwayland->start();
|
||||
}
|
||||
|
|
|
@ -91,32 +91,32 @@ void Xwayland::start()
|
|||
int pipeFds[2];
|
||||
if (pipe(pipeFds) != 0) {
|
||||
std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl;
|
||||
Q_EMIT criticalError(1);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
int sx[2];
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
|
||||
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
||||
Q_EMIT criticalError(1);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
int fd = dup(sx[1]);
|
||||
if (fd < 0) {
|
||||
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
||||
Q_EMIT criticalError(20);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
|
||||
const int waylandSocket = waylandServer()->createXWaylandConnection();
|
||||
if (waylandSocket == -1) {
|
||||
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
||||
Q_EMIT criticalError(1);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
const int wlfd = dup(waylandSocket);
|
||||
if (wlfd < 0) {
|
||||
std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl;
|
||||
Q_EMIT criticalError(20);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,6 @@ void Xwayland::handleXwaylandError(QProcess::ProcessError error)
|
|||
switch (error) {
|
||||
case QProcess::FailedToStart:
|
||||
qCWarning(KWIN_XWL) << "Xwayland process failed to start";
|
||||
emit criticalError(1);
|
||||
return;
|
||||
case QProcess::Crashed:
|
||||
qCWarning(KWIN_XWL) << "Xwayland process crashed";
|
||||
|
@ -295,6 +294,7 @@ void Xwayland::handleXwaylandError(QProcess::ProcessError error)
|
|||
qCWarning(KWIN_XWL) << "An unknown error has occurred in Xwayland";
|
||||
break;
|
||||
}
|
||||
emit errorOccurred();
|
||||
}
|
||||
|
||||
bool Xwayland::createX11Connection()
|
||||
|
@ -353,8 +353,7 @@ void Xwayland::destroyX11Connection()
|
|||
void Xwayland::continueStartupWithX()
|
||||
{
|
||||
if (!createX11Connection()) {
|
||||
// about to quit
|
||||
Q_EMIT criticalError(1);
|
||||
emit errorOccurred();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public Q_SLOTS:
|
|||
* Starts the Xwayland server.
|
||||
*
|
||||
* This method will spawn an Xwayland process and will establish a new XCB connection to it.
|
||||
* If a fatal error has occurred during the startup, the criticalError() signal is going to
|
||||
* If an error has occurred during the startup, the errorOccurred() signal is going to
|
||||
* be emitted. If the Xwayland server has started successfully, the started() signal will be
|
||||
* emitted.
|
||||
*
|
||||
|
@ -72,7 +72,10 @@ Q_SIGNALS:
|
|||
* ready to accept and manage X11 clients.
|
||||
*/
|
||||
void started();
|
||||
void criticalError(int code);
|
||||
/**
|
||||
* This signal is emitted when an error occurs with the Xwayland server.
|
||||
*/
|
||||
void errorOccurred();
|
||||
|
||||
private Q_SLOTS:
|
||||
void dispatchEvents();
|
||||
|
|
Loading…
Reference in a new issue