Changeset View
Changeset View
Standalone View
Standalone View
main_wayland.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 218 | if (!m_inputMethodServerToStart.isEmpty()) { | |||
---|---|---|---|---|---|
220 | if (socket >= 0) { | 220 | if (socket >= 0) { | ||
221 | QProcessEnvironment environment = processStartupEnvironment(); | 221 | QProcessEnvironment environment = processStartupEnvironment(); | ||
222 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | 222 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | ||
223 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | 223 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | ||
224 | environment.remove("DISPLAY"); | 224 | environment.remove("DISPLAY"); | ||
225 | environment.remove("WAYLAND_DISPLAY"); | 225 | environment.remove("WAYLAND_DISPLAY"); | ||
226 | QProcess *p = new Process(this); | 226 | QProcess *p = new Process(this); | ||
227 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 227 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
228 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 228 | connect(p, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, | ||
229 | connect(p, finishedSignal, this, | 229 | [p] { | ||
230 | [this, p] { | | |||
231 | if (waylandServer()) { | 230 | if (waylandServer()) { | ||
232 | waylandServer()->destroyInputMethodConnection(); | 231 | waylandServer()->destroyInputMethodConnection(); | ||
233 | } | 232 | } | ||
234 | p->deleteLater(); | 233 | p->deleteLater(); | ||
235 | } | 234 | } | ||
236 | ); | 235 | ); | ||
237 | p->setProcessEnvironment(environment); | 236 | p->setProcessEnvironment(environment); | ||
238 | p->start(m_inputMethodServerToStart); | 237 | p->setProgram(m_inputMethodServerToStart); | ||
239 | p->waitForStarted(); | 238 | p->start(); | ||
239 | p->waitForStarted(); //do we really need to wait? | ||||
240 | } | 240 | } | ||
241 | } | 241 | } | ||
242 | 242 | | |||
243 | // start session | 243 | // start session | ||
244 | if (!m_sessionArgument.isEmpty()) { | 244 | if (!m_sessionArgument.isEmpty()) { | ||
245 | QProcess *p = new Process(this); | 245 | QProcess *p = new Process(this); | ||
246 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 246 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
247 | p->setProcessEnvironment(processStartupEnvironment()); | 247 | p->setProcessEnvironment(processStartupEnvironment()); | ||
248 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 248 | connect(p, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, [p] (int code, QProcess::ExitStatus status) { | ||
249 | connect(p, finishedSignal, this, [](int code, QProcess::ExitStatus status) { | 249 | p->deleteLater(); | ||
250 | if (status == QProcess::CrashExit) { | 250 | if (status == QProcess::CrashExit) { | ||
251 | qWarning() << "Session process has crashed"; | 251 | qWarning() << "Session process has crashed"; | ||
252 | QCoreApplication::exit(-1); | 252 | QCoreApplication::exit(-1); | ||
253 | return; | 253 | return; | ||
254 | } | 254 | } | ||
255 | 255 | | |||
256 | if (code) { | 256 | if (code) { | ||
257 | qWarning() << "Session process exited with code" << code; | 257 | qWarning() << "Session process exited with code" << code; | ||
258 | } | 258 | } | ||
259 | 259 | | |||
260 | QCoreApplication::exit(code); | 260 | QCoreApplication::exit(code); | ||
261 | }); | 261 | }); | ||
262 | p->start(m_sessionArgument); | 262 | p->setProgram(m_sessionArgument); | ||
263 | p->start(); | ||||
zzag: Could you please walk me through this change? Why do we need to call setProgram()? | |||||
void start(const QString &command, OpenMode mode = ReadWrite); is deprecated. We could also use apol: `void start(const QString &command, OpenMode mode = ReadWrite);` is deprecated.
We could also… | |||||
zzag: Is it deprecated in Qt 5.15? | |||||
263 | } | 264 | } | ||
zzag: Indentation is off. | |||||
264 | // start the applications passed to us as command line arguments | 265 | // start the applications passed to us as command line arguments | ||
265 | if (!m_applicationsToStart.isEmpty()) { | 266 | if (!m_applicationsToStart.isEmpty()) { | ||
266 | for (const QString &application: m_applicationsToStart) { | 267 | for (const QString &application: m_applicationsToStart) { | ||
267 | // note: this will kill the started process when we exit | 268 | // note: this will kill the started process when we exit | ||
268 | // this is going to happen anyway as we are the wayland and X server the app connects to | 269 | // this is going to happen anyway as we are the wayland and X server the app connects to | ||
269 | QProcess *p = new Process(this); | 270 | QProcess *p = new Process(this); | ||
270 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 271 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
271 | p->setProcessEnvironment(processStartupEnvironment()); | 272 | p->setProcessEnvironment(processStartupEnvironment()); | ||
272 | p->start(application); | 273 | p->setProgram(application); | ||
274 | p->startDetached(); | ||||
275 | p->deleteLater(); | ||||
273 | } | 276 | } | ||
274 | } | 277 | } | ||
275 | } | 278 | } | ||
276 | 279 | | |||
277 | static const QString s_waylandPlugin = QStringLiteral("KWinWaylandWaylandBackend"); | 280 | static const QString s_waylandPlugin = QStringLiteral("KWinWaylandWaylandBackend"); | ||
278 | static const QString s_x11Plugin = QStringLiteral("KWinWaylandX11Backend"); | 281 | static const QString s_x11Plugin = QStringLiteral("KWinWaylandX11Backend"); | ||
279 | static const QString s_fbdevPlugin = QStringLiteral("KWinWaylandFbdevBackend"); | 282 | static const QString s_fbdevPlugin = QStringLiteral("KWinWaylandFbdevBackend"); | ||
280 | #if HAVE_DRM | 283 | #if HAVE_DRM | ||
▲ Show 20 Lines • Show All 397 Lines • Show Last 20 Lines |
Could you please walk me through this change? Why do we need to call setProgram()?