[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()
|
||||
{
|
||||
if (m_startXWayland) {
|
||||
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;
|
||||
}
|
||||
setOperationMode(m_startXWayland ? OperationModeXwayland : OperationModeWaylandAndX11);
|
||||
|
||||
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));
|
||||
} else {
|
||||
// try creating the Wayland Backend
|
||||
createInput();
|
||||
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);
|
||||
}
|
||||
);
|
||||
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();
|
||||
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()
|
||||
|
@ -144,15 +164,6 @@ void ApplicationWayland::continueStartupWithX()
|
|||
::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();
|
||||
|
||||
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
|
||||
|
|
|
@ -40,6 +40,7 @@ protected:
|
|||
|
||||
private:
|
||||
void createX11Connection();
|
||||
void continueStartupWithScreens();
|
||||
void continueStartupWithX();
|
||||
|
||||
bool m_startXWayland = false;
|
||||
|
|
Loading…
Reference in a new issue