Changeset View
Changeset View
Standalone View
Standalone View
main_wayland.cpp
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | |||||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | void ApplicationWayland::continueStartupWithScreens() | 156 | void ApplicationWayland::continueStartupWithScreens() | ||
157 | { | 157 | { | ||
158 | disconnect(kwinApp()->platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens); | 158 | disconnect(kwinApp()->platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens); | ||
159 | createScreens(); | 159 | createScreens(); | ||
160 | 160 | | |||
161 | if (!m_startXWayland) { | 161 | if (!m_startXWayland) { | ||
162 | continueStartupWithX(); | 162 | createCompositor(); | ||
163 | connect(Compositor::self(), &Compositor::sceneCreated, this, | ||||
164 | [this] { | ||||
165 | startSession(); | ||||
166 | createWorkspace(); | ||||
167 | notifyKSplash(); | ||||
168 | } | ||||
169 | ); | ||||
163 | return; | 170 | return; | ||
164 | } | 171 | } | ||
165 | createCompositor(); | 172 | createCompositor(); | ||
166 | connect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::startXwaylandServer); | 173 | connect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::startXwaylandServer); | ||
167 | } | 174 | } | ||
168 | 175 | | |||
169 | void ApplicationWayland::continueStartupWithX() | 176 | void ApplicationWayland::continueStartupWithX() | ||
170 | { | 177 | { | ||
Show All 38 Lines | 215 | xcb_change_window_attributes_checked(connection(), | |||
209 | rootWindow(), | 216 | rootWindow(), | ||
210 | XCB_CW_EVENT_MASK, | 217 | XCB_CW_EVENT_MASK, | ||
211 | maskValues))); | 218 | maskValues))); | ||
212 | if (!redirectCheck.isNull()) { | 219 | if (!redirectCheck.isNull()) { | ||
213 | fputs(i18n("kwin_wayland: an X11 window manager is running on the X11 Display.\n").toLocal8Bit().constData(), stderr); | 220 | fputs(i18n("kwin_wayland: an X11 window manager is running on the X11 Display.\n").toLocal8Bit().constData(), stderr); | ||
214 | ::exit(1); | 221 | ::exit(1); | ||
215 | } | 222 | } | ||
216 | 223 | | |||
224 | m_environment.insert(QStringLiteral("DISPLAY"), QString::fromUtf8(qgetenv("DISPLAY"))); | ||||
225 | | ||||
226 | startSession(); | ||||
227 | createWorkspace(); | ||||
228 | | ||||
229 | Xcb::sync(); // Trigger possible errors, there's still a chance to abort | ||||
230 | | ||||
231 | notifyKSplash(); | ||||
232 | } | ||||
233 | | ||||
234 | void ApplicationWayland::startSession() | ||||
235 | { | ||||
217 | if (!m_inputMethodServerToStart.isEmpty()) { | 236 | if (!m_inputMethodServerToStart.isEmpty()) { | ||
218 | int socket = dup(waylandServer()->createInputMethodConnection()); | 237 | int socket = dup(waylandServer()->createInputMethodConnection()); | ||
219 | if (socket >= 0) { | 238 | if (socket >= 0) { | ||
220 | QProcessEnvironment environment = m_environment; | 239 | QProcessEnvironment environment = m_environment; | ||
221 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | 240 | environment.insert(QStringLiteral("WAYLAND_SOCKET"), QByteArray::number(socket)); | ||
222 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | 241 | environment.insert(QStringLiteral("QT_QPA_PLATFORM"), QStringLiteral("wayland")); | ||
223 | environment.remove("DISPLAY"); | 242 | environment.remove("DISPLAY"); | ||
224 | environment.remove("WAYLAND_DISPLAY"); | 243 | environment.remove("WAYLAND_DISPLAY"); | ||
Show All 9 Lines | 247 | connect(p, finishedSignal, this, | |||
234 | } | 253 | } | ||
235 | ); | 254 | ); | ||
236 | p->setProcessEnvironment(environment); | 255 | p->setProcessEnvironment(environment); | ||
237 | p->start(m_inputMethodServerToStart); | 256 | p->start(m_inputMethodServerToStart); | ||
238 | p->waitForStarted(); | 257 | p->waitForStarted(); | ||
239 | } | 258 | } | ||
240 | } | 259 | } | ||
241 | 260 | | |||
242 | m_environment.insert(QStringLiteral("DISPLAY"), QString::fromUtf8(qgetenv("DISPLAY"))); | | |||
243 | // start session | 261 | // start session | ||
244 | if (!m_sessionArgument.isEmpty()) { | 262 | if (!m_sessionArgument.isEmpty()) { | ||
245 | QProcess *p = new Process(this); | 263 | QProcess *p = new Process(this); | ||
246 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 264 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
247 | p->setProcessEnvironment(m_environment); | 265 | p->setProcessEnvironment(m_environment); | ||
248 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | 266 | auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished); | ||
249 | connect(p, finishedSignal, this, &ApplicationWayland::quit); | 267 | connect(p, finishedSignal, this, &ApplicationWayland::quit); | ||
250 | p->start(m_sessionArgument); | 268 | p->start(m_sessionArgument); | ||
251 | } | 269 | } | ||
252 | // start the applications passed to us as command line arguments | 270 | // start the applications passed to us as command line arguments | ||
253 | if (!m_applicationsToStart.isEmpty()) { | 271 | if (!m_applicationsToStart.isEmpty()) { | ||
254 | for (const QString &application: m_applicationsToStart) { | 272 | for (const QString &application: m_applicationsToStart) { | ||
255 | // note: this will kill the started process when we exit | 273 | // note: this will kill the started process when we exit | ||
256 | // this is going to happen anyway as we are the wayland and X server the app connects to | 274 | // this is going to happen anyway as we are the wayland and X server the app connects to | ||
257 | QProcess *p = new Process(this); | 275 | QProcess *p = new Process(this); | ||
258 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 276 | p->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
259 | p->setProcessEnvironment(m_environment); | 277 | p->setProcessEnvironment(m_environment); | ||
260 | p->start(application); | 278 | p->start(application); | ||
261 | } | 279 | } | ||
262 | } | 280 | } | ||
263 | | ||||
264 | createWorkspace(); | | |||
265 | | ||||
266 | Xcb::sync(); // Trigger possible errors, there's still a chance to abort | | |||
267 | | ||||
268 | notifyKSplash(); | | |||
269 | } | 281 | } | ||
270 | 282 | | |||
271 | void ApplicationWayland::createX11Connection() | 283 | void ApplicationWayland::createX11Connection() | ||
272 | { | 284 | { | ||
273 | int screenNumber = 0; | 285 | int screenNumber = 0; | ||
274 | xcb_connection_t *c = nullptr; | 286 | xcb_connection_t *c = nullptr; | ||
275 | if (m_xcbConnectionFd == -1) { | 287 | if (m_xcbConnectionFd == -1) { | ||
276 | c = xcb_connect(nullptr, &screenNumber); | 288 | c = xcb_connect(nullptr, &screenNumber); | ||
▲ Show 20 Lines • Show All 527 Lines • Show Last 20 Lines |