Changeset View
Changeset View
Standalone View
Standalone View
main_wayland.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | |||||
96 | } | 96 | } | ||
97 | } | 97 | } | ||
98 | 98 | | |||
99 | //************************************ | 99 | //************************************ | ||
100 | // ApplicationWayland | 100 | // ApplicationWayland | ||
101 | //************************************ | 101 | //************************************ | ||
102 | 102 | | |||
103 | ApplicationWayland::ApplicationWayland(int &argc, char **argv) | 103 | ApplicationWayland::ApplicationWayland(int &argc, char **argv) | ||
104 | : Application(OperationModeWaylandOnly, argc, argv) | 104 | : ApplicationWaylandAbstract(OperationModeWaylandOnly, argc, argv) | ||
105 | { | 105 | { | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | ApplicationWayland::~ApplicationWayland() | 108 | ApplicationWayland::~ApplicationWayland() | ||
109 | { | 109 | { | ||
110 | if (!waylandServer()) { | 110 | if (!waylandServer()) { | ||
111 | return; | 111 | return; | ||
112 | } | 112 | } | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 188 | { | |||
198 | m_xwayland->init(); | 198 | m_xwayland->init(); | ||
199 | } | 199 | } | ||
200 | 200 | | |||
201 | void ApplicationWayland::startSession() | 201 | void ApplicationWayland::startSession() | ||
202 | { | 202 | { | ||
203 | if (!m_inputMethodServerToStart.isEmpty()) { | 203 | if (!m_inputMethodServerToStart.isEmpty()) { | ||
204 | int socket = dup(waylandServer()->createInputMethodConnection()); | 204 | int socket = dup(waylandServer()->createInputMethodConnection()); | ||
205 | if (socket >= 0) { | 205 | if (socket >= 0) { | ||
206 | QProcessEnvironment environment = m_environment; | 206 | QProcessEnvironment environment = processStartupEnvironment(); | ||
207 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | 207 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | ||
208 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | 208 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | ||
209 | environment.remove("DISPLAY"); | 209 | environment.remove("DISPLAY"); | ||
210 | environment.remove("WAYLAND_DISPLAY"); | 210 | environment.remove("WAYLAND_DISPLAY"); | ||
211 | QProcess *p = new Process(this); | 211 | QProcess *p = new Process(this); | ||
212 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 212 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
213 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 213 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | ||
214 | connect(p, finishedSignal, this, | 214 | connect(p, finishedSignal, this, | ||
Show All 9 Lines | |||||
224 | p->waitForStarted(); | 224 | p->waitForStarted(); | ||
225 | } | 225 | } | ||
226 | } | 226 | } | ||
227 | 227 | | |||
228 | // start session | 228 | // start session | ||
229 | if (!m_sessionArgument.isEmpty()) { | 229 | if (!m_sessionArgument.isEmpty()) { | ||
230 | QProcess *p = new Process(this); | 230 | QProcess *p = new Process(this); | ||
231 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 231 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
232 | p->setProcessEnvironment(m_environment); | 232 | p->setProcessEnvironment(processStartupEnvironment()); | ||
233 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 233 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | ||
234 | connect(p, finishedSignal, this, &ApplicationWayland::quit); | 234 | connect(p, finishedSignal, this, &ApplicationWayland::quit); | ||
235 | p->start(m_sessionArgument); | 235 | p->start(m_sessionArgument); | ||
236 | } | 236 | } | ||
237 | // start the applications passed to us as command line arguments | 237 | // start the applications passed to us as command line arguments | ||
238 | if (!m_applicationsToStart.isEmpty()) { | 238 | if (!m_applicationsToStart.isEmpty()) { | ||
239 | for (const QString &application: m_applicationsToStart) { | 239 | for (const QString &application: m_applicationsToStart) { | ||
240 | // note: this will kill the started process when we exit | 240 | // note: this will kill the started process when we exit | ||
241 | // this is going to happen anyway as we are the wayland and X server the app connects to | 241 | // this is going to happen anyway as we are the wayland and X server the app connects to | ||
242 | QProcess *p = new Process(this); | 242 | QProcess *p = new Process(this); | ||
243 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 243 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
244 | p->setProcessEnvironment(m_environment); | 244 | p->setProcessEnvironment(processStartupEnvironment()); | ||
245 | p->start(application); | 245 | p->start(application); | ||
246 | } | 246 | } | ||
247 | } | 247 | } | ||
248 | } | 248 | } | ||
249 | 249 | | |||
250 | static const QString s_waylandPlugin = QStringLiteral("KWinWaylandWaylandBackend"); | 250 | static const QString s_waylandPlugin = QStringLiteral("KWinWaylandWaylandBackend"); | ||
251 | static const QString s_x11Plugin = QStringLiteral("KWinWaylandX11Backend"); | 251 | static const QString s_x11Plugin = QStringLiteral("KWinWaylandX11Backend"); | ||
252 | static const QString s_fbdevPlugin = QStringLiteral("KWinWaylandFbdevBackend"); | 252 | static const QString s_fbdevPlugin = QStringLiteral("KWinWaylandFbdevBackend"); | ||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |