[kwin_wayland] Create screens prior to Xwayland
Gives us the correct outputs in Xwayland direct from start.
This commit is contained in:
parent
dc0f040185
commit
7e0fcc5f1a
2 changed files with 36 additions and 24 deletions
|
@ -79,24 +79,44 @@ ApplicationWayland::~ApplicationWayland()
|
||||||
|
|
||||||
void ApplicationWayland::performStartup()
|
void ApplicationWayland::performStartup()
|
||||||
{
|
{
|
||||||
if (m_startXWayland) {
|
setOperationMode(m_startXWayland ? OperationModeXwayland : OperationModeWaylandAndX11);
|
||||||
setOperationMode(KWin::Application::OperationModeXwayland);
|
|
||||||
int sx[2];
|
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
|
|
||||||
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
|
||||||
exit(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_xcbConnectionFd = sx[0];
|
// try creating the Wayland Backend
|
||||||
const int xDisplayPipe = startXServer(WaylandServer::self()->display()->socketName().toUtf8(), sx[1]);
|
createInput();
|
||||||
QFutureWatcher<void> *watcher = new QFutureWatcher<void>(this);
|
Wayland::WaylandBackend *backend = Wayland::WaylandBackend::create();
|
||||||
QObject::connect(watcher, &QFutureWatcher<void>::finished, this, &ApplicationWayland::continueStartupWithX, Qt::QueuedConnection);
|
connect(backend, &Wayland::WaylandBackend::connectionFailed, this,
|
||||||
QObject::connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater, Qt::QueuedConnection);
|
[] () {
|
||||||
watcher->setFuture(QtConcurrent::run(readDisplay, xDisplayPipe));
|
fputs(i18n("kwin_wayland: could not connect to Wayland Server, ensure WAYLAND_DISPLAY is set.\n").toLocal8Bit().constData(), stderr);
|
||||||
} else {
|
::exit(1);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
connect(backend, &Wayland::WaylandBackend::outputsChanged, this, &ApplicationWayland::continueStartupWithScreens);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplicationWayland::continueStartupWithScreens()
|
||||||
|
{
|
||||||
|
disconnect(Wayland::WaylandBackend::self(), &Wayland::WaylandBackend::outputsChanged, this, &ApplicationWayland::continueStartupWithScreens);
|
||||||
|
createScreens();
|
||||||
|
waylandServer()->initOutputs();
|
||||||
|
|
||||||
|
if (!m_startXWayland) {
|
||||||
continueStartupWithX();
|
continueStartupWithX();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sx[2];
|
||||||
|
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) {
|
||||||
|
std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_xcbConnectionFd = sx[0];
|
||||||
|
const int xDisplayPipe = startXServer(WaylandServer::self()->display()->socketName().toUtf8(), sx[1]);
|
||||||
|
QFutureWatcher<void> *watcher = new QFutureWatcher<void>(this);
|
||||||
|
QObject::connect(watcher, &QFutureWatcher<void>::finished, this, &ApplicationWayland::continueStartupWithX, Qt::QueuedConnection);
|
||||||
|
QObject::connect(watcher, &QFutureWatcher<void>::finished, watcher, &QFutureWatcher<void>::deleteLater, Qt::QueuedConnection);
|
||||||
|
watcher->setFuture(QtConcurrent::run(readDisplay, xDisplayPipe));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationWayland::continueStartupWithX()
|
void ApplicationWayland::continueStartupWithX()
|
||||||
|
@ -144,15 +164,6 @@ void ApplicationWayland::continueStartupWithX()
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// try creating the Wayland Backend
|
|
||||||
Wayland::WaylandBackend *backend = Wayland::WaylandBackend::create();
|
|
||||||
connect(backend, &Wayland::WaylandBackend::connectionFailed, this,
|
|
||||||
[] () {
|
|
||||||
fputs(i18n("kwin_wayland: could not connect to Wayland Server, ensure WAYLAND_DISPLAY is set.\n").toLocal8Bit().constData(), stderr);
|
|
||||||
::exit(1);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
createWorkspace();
|
createWorkspace();
|
||||||
|
|
||||||
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
|
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
|
||||||
|
|
|
@ -40,6 +40,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createX11Connection();
|
void createX11Connection();
|
||||||
|
void continueStartupWithScreens();
|
||||||
void continueStartupWithX();
|
void continueStartupWithX();
|
||||||
|
|
||||||
bool m_startXWayland = false;
|
bool m_startXWayland = false;
|
||||||
|
|
Loading…
Reference in a new issue