修复:完善终端开机及串流交接并接入云管平台
This commit is contained in:
1 parent
8276da0d45
commit
18a9ce995d
25 files changed
+922
-48
No files matched your search
@@ -207,9 +207,50 @@ bool MoonlightSession::activateStreamWindow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The production kiosk X11 session intentionally runs without an EWMH
|
||||
// window manager. In that mode windowactivate always fails with
|
||||
// "Your windowmanager claims not to support _NET_ACTIVE_WINDOW", even
|
||||
// though the Moonlight window is already mapped and usable. Treating
|
||||
// that failure as a stream failure leaves the opaque transition overlay
|
||||
// up until the 30s timeout and then kills a healthy session.
|
||||
if (QProcess::execute(QStringLiteral("xdotool"),
|
||||
{QStringLiteral("windowactivate"), QStringLiteral("--sync"),
|
||||
windowId}) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback for the no-window-manager kiosk: map/raise the window and
|
||||
// enforce the physical output geometry directly. SDL's fullscreen hint
|
||||
// cannot be honoured by a WM-less X11 session, so geometry is the reliable
|
||||
// handoff signal here.
|
||||
if (QProcess::execute(QStringLiteral("xdotool"),
|
||||
{QStringLiteral("windowmap"), windowId}) != 0) {
|
||||
return false;
|
||||
}
|
||||
QProcess::execute(QStringLiteral("xdotool"), {QStringLiteral("windowraise"), windowId});
|
||||
|
||||
QProcess geometry;
|
||||
geometry.start(QStringLiteral("xdotool"), {QStringLiteral("getdisplaygeometry" )});
|
||||
if (!geometry.waitForFinished(500)) {
|
||||
geometry.kill();
|
||||
geometry.waitForFinished();
|
||||
return false;
|
||||
}
|
||||
const QStringList size = QString::fromUtf8(geometry.readAllStandardOutput())
|
||||
.simplified()
|
||||
.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
if (size.size() != 2) {
|
||||
return false;
|
||||
}
|
||||
const QString width = size.at(0);
|
||||
const QString height = size.at(1);
|
||||
if (QProcess::execute(QStringLiteral("xdotool"),
|
||||
{QStringLiteral("windowmove"), windowId, QStringLiteral("0"),
|
||||
QStringLiteral("0")}) != 0) {
|
||||
return false;
|
||||
}
|
||||
return QProcess::execute(QStringLiteral("xdotool"),
|
||||
{QStringLiteral("windowactivate"), QStringLiteral("--sync"),
|
||||
windowId}) == 0;
|
||||
{QStringLiteral("windowsize"), windowId, width, height}) == 0;
|
||||
}
|
||||
|
||||
bool MoonlightSession::start(const ConnectionTicket& ticket, EventCallback callback) {
|
||||
@@ -227,6 +268,7 @@ bool MoonlightSession::start(const ConnectionTicket& ticket, EventCallback callb
|
||||
|
||||
process_->setProgram(options_.program);
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
environment.insert(QStringLiteral("VDI_KIOSK_STREAM"), QStringLiteral("1"));
|
||||
environment.insert(QStringLiteral("GL_IS_SLOW"), QStringLiteral("0"));
|
||||
environment.insert(QStringLiteral("SDL_RENDER_DRIVER"),
|
||||
environment.value(QStringLiteral("VDI_SDL_RENDER_DRIVER"), QStringLiteral("opengles2")));
|
||||
@@ -286,11 +328,11 @@ void MoonlightSession::onProcessFinished(int exitCode, QProcess::ExitStatus exit
|
||||
return;
|
||||
}
|
||||
|
||||
const QString message = exitStatus == QProcess::CrashExit
|
||||
const bool failed = exitStatus == QProcess::CrashExit || exitCode != 0;
|
||||
const QString message = failed
|
||||
? QStringLiteral("串流异常退出 (code=%1)").arg(exitCode)
|
||||
: QStringLiteral("串流已结束 (code=%1)").arg(exitCode);
|
||||
emitTerminalEvent(exitStatus == QProcess::CrashExit ? EventType::kFailed
|
||||
: EventType::kFinished,
|
||||
emitTerminalEvent(failed ? EventType::kFailed : EventType::kFinished,
|
||||
message);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user