Changeset View
Changeset View
Standalone View
Standalone View
xwl/xwayland.cpp
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | 111 | { | |||
---|---|---|---|---|---|
145 | 145 | | |||
146 | m_xwaylandProcess = new Process(this); | 146 | m_xwaylandProcess = new Process(this); | ||
147 | m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); | 147 | m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel); | ||
148 | m_xwaylandProcess->setProgram(QStringLiteral("Xwayland")); | 148 | m_xwaylandProcess->setProgram(QStringLiteral("Xwayland")); | ||
149 | QProcessEnvironment env = m_app->processStartupEnvironment(); | 149 | QProcessEnvironment env = m_app->processStartupEnvironment(); | ||
150 | env.insert("WAYLAND_SOCKET", QByteArray::number(wlfd)); | 150 | env.insert("WAYLAND_SOCKET", QByteArray::number(wlfd)); | ||
151 | env.insert("EGL_PLATFORM", QByteArrayLiteral("DRM")); | 151 | env.insert("EGL_PLATFORM", QByteArrayLiteral("DRM")); | ||
152 | m_xwaylandProcess->setProcessEnvironment(env); | 152 | m_xwaylandProcess->setProcessEnvironment(env); | ||
153 | m_xwaylandProcess->setArguments({QStringLiteral("-displayfd"), | 153 | | ||
154 | QStringList arguments = {QStringLiteral("-displayfd"), | ||||
154 | QString::number(pipeFds[1]), | 155 | QString::number(pipeFds[1]), | ||
155 | QStringLiteral("-rootless"), | 156 | QStringLiteral("-rootless"), | ||
156 | QStringLiteral("-wm"), | 157 | QStringLiteral("-wm"), | ||
157 | QString::number(fd)}); | 158 | QString::number(fd)}; | ||
159 | | ||||
160 | // TODO: Make this dependent on the release number. pkgconfig? | ||||
161 | arguments.append(QStringLiteral("-maxFactorRescale")); | ||||
162 | | ||||
163 | m_xwaylandProcess->setArguments(arguments); | ||||
164 | | ||||
158 | m_xwaylandFailConnection = connect(m_xwaylandProcess, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this, | 165 | m_xwaylandFailConnection = connect(m_xwaylandProcess, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this, | ||
159 | [this] (QProcess::ProcessError error) { | 166 | [this] (QProcess::ProcessError error) { | ||
160 | if (error == QProcess::FailedToStart) { | 167 | if (error == QProcess::FailedToStart) { | ||
161 | std::cerr << "FATAL ERROR: failed to start Xwayland" << std::endl; | 168 | std::cerr << "FATAL ERROR: failed to start Xwayland" << std::endl; | ||
162 | } else { | 169 | } else { | ||
163 | std::cerr << "FATAL ERROR: Xwayland failed, going to exit now" << std::endl; | 170 | std::cerr << "FATAL ERROR: Xwayland failed, going to exit now" << std::endl; | ||
164 | } | 171 | } | ||
165 | Q_EMIT criticalError(1); | 172 | Q_EMIT criticalError(1); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
213 | { | 220 | { | ||
214 | createX11Connection(); | 221 | createX11Connection(); | ||
215 | xcb_connection_t *xcbConn = m_app->x11Connection(); | 222 | xcb_connection_t *xcbConn = m_app->x11Connection(); | ||
216 | if (!xcbConn) { | 223 | if (!xcbConn) { | ||
217 | // about to quit | 224 | // about to quit | ||
218 | Q_EMIT criticalError(1); | 225 | Q_EMIT criticalError(1); | ||
219 | return; | 226 | return; | ||
220 | } | 227 | } | ||
228 | | ||||
229 | // Query the XWayland release number to decide if multi dpi support | ||||
230 | // should be enabled. For that force Screens to do a size update | ||||
231 | // TODO: better do this earlier when we provide the arguments for | ||||
232 | // Xwayland binary? | ||||
233 | m_releaseNumber = xcb_get_setup(xcbConn)->release_number; | ||||
234 | | ||||
221 | QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcbConn), QSocketNotifier::Read, this); | 235 | QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcbConn), QSocketNotifier::Read, this); | ||
222 | auto processXcbEvents = [this, xcbConn] { | 236 | auto processXcbEvents = [this, xcbConn] { | ||
223 | while (auto event = xcb_poll_for_event(xcbConn)) { | 237 | while (auto event = xcb_poll_for_event(xcbConn)) { | ||
224 | if (m_dataBridge->filterEvent(event)) { | 238 | if (m_dataBridge->filterEvent(event)) { | ||
225 | free(event); | 239 | free(event); | ||
226 | continue; | 240 | continue; | ||
227 | } | 241 | } | ||
228 | long result = 0; | 242 | long result = 0; | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |