[wayland] Remove the specific socket pair for QtWayland

Our own QPA plugin shares the internal connection, so we don't need the
dedicated connection for the QPA any more.
This commit is contained in:
Martin Gräßlin 2015-08-18 08:15:00 +02:00
parent 4851470ff9
commit e0103b15b7
4 changed files with 8 additions and 35 deletions

View file

@ -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);

View file

@ -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

View file

@ -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);
}

View file

@ -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;