diff --git a/main_wayland.cpp b/main_wayland.cpp index 9625706627..9b7290bd6d 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -458,7 +458,6 @@ int main(int argc, char * argv[]) qunsetenv("QT_DEVICE_PIXEL_RATIO"); qunsetenv("QT_IM_MODULE"); - qputenv("WAYLAND_SOCKET", QByteArray::number(server->createQtConnection())); qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); qputenv("QSG_RENDER_LOOP", "basic"); KWin::ApplicationWayland a(argc, argv); diff --git a/shell_client.cpp b/shell_client.cpp index 44c503d031..44e034247f 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -514,7 +514,7 @@ void ShellClient::createWindowId() void ShellClient::findInternalWindow() { - if (m_shellSurface->client() != waylandServer()->qtConnection()) { + if (m_shellSurface->client() != waylandServer()->internalConnection()) { return; } const QWindowList windows = kwinApp()->topLevelWindows(); @@ -550,8 +550,7 @@ void ShellClient::updateInternalWindowGeometry() bool ShellClient::isInternal() const { - return m_shellSurface->client() == waylandServer()->internalConnection() || - m_shellSurface->client() == waylandServer()->qtConnection(); + return m_shellSurface->client() == waylandServer()->internalConnection(); } xcb_window_t ShellClient::window() const diff --git a/wayland_server.cpp b/wayland_server.cpp index cd8c5a27ab..5f1df67ea5 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -113,7 +113,7 @@ void WaylandServer::init(const QByteArray &socketName) // skip Xwayland clients, those are created using standard X11 way return; } - if (surface->client() == m_qtConnection) { + if (surface->client() == m_internalConnection.server) { // one of Qt's windows if (m_dummyWindowSurface && (m_dummyWindowSurface->id() == surface->surface()->id())) { fakeDummyQtWindowInput(); @@ -124,7 +124,7 @@ void WaylandServer::init(const QByteArray &socketName) auto s = surface->surface(); connect(s, &SurfaceInterface::damaged, this, [this, s] { s->frameRendered(0); - m_qtConnection->flush(); + m_internalConnection.client->flush(); }); } auto client = new ShellClient(surface); @@ -257,17 +257,6 @@ int WaylandServer::createInputMethodConnection() return sx[1]; } -int WaylandServer::createQtConnection() -{ - int sx[2]; - if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) { - qCWarning(KWIN_CORE) << "Could not create socket"; - return -1; - } - m_qtConnection = m_display->createClient(sx[0]); - return sx[1]; -} - void WaylandServer::createInternalConnection() { int sx[2]; @@ -337,7 +326,7 @@ void WaylandServer::fakeDummyQtWindowInput() // we need to fake Qt into believing it has got any seat events // this is done only when receiving either a key press or button. // we simulate by sending a button press and release - auto surface = KWayland::Server::SurfaceInterface::get(m_dummyWindowSurface->id(), m_qtConnection); + auto surface = KWayland::Server::SurfaceInterface::get(m_dummyWindowSurface->id(), m_internalConnection.server); if (!surface) { return; } @@ -347,7 +336,7 @@ void WaylandServer::fakeDummyQtWindowInput() m_seat->setPointerPos(QPointF(0, 0)); m_seat->pointerButtonPressed(Qt::LeftButton); m_seat->pointerButtonReleased(Qt::LeftButton); - m_qtConnection->flush(); + m_internalConnection.server->flush(); m_dummyWindow->hide(); m_seat->setFocusedPointerSurface(oldSeatSurface, oldPos); } @@ -357,13 +346,8 @@ void WaylandServer::dispatch() if (!m_display) { return; } - if (!m_qtClientConnection) { - if (m_qtConnection && QGuiApplication::instance()) { - m_qtClientConnection = KWayland::Client::ConnectionThread::fromApplication(this); - } - } - if (m_qtClientConnection) { - m_qtClientConnection->flush(); + if (m_internalConnection.server) { + m_internalConnection.server->flush(); } m_display->dispatchEvents(0); } diff --git a/wayland_server.h b/wayland_server.h index 038f5a61e3..85ae4a7018 100644 --- a/wayland_server.h +++ b/wayland_server.h @@ -108,10 +108,6 @@ public: **/ int createInputMethodConnection(); - /** - * @returns file descriptor for QtWayland - **/ - int createQtConnection(); void createInternalConnection(); void createDummyQtWindow(); void initWorkspace(); @@ -119,9 +115,6 @@ public: KWayland::Server::ClientConnection *xWaylandConnection() const { return m_xwaylandConnection; } - KWayland::Server::ClientConnection *qtConnection() const { - return m_qtConnection; - } KWayland::Server::ClientConnection *inputMethodConnection() const { return m_inputMethodServerConnection; } @@ -156,8 +149,6 @@ private: KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr; KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr; KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr; - KWayland::Server::ClientConnection *m_qtConnection = nullptr; - KWayland::Client::ConnectionThread *m_qtClientConnection = nullptr; struct { KWayland::Server::ClientConnection *server = nullptr; KWayland::Client::ConnectionThread *client = nullptr;