diff --git a/debug_console.cpp b/debug_console.cpp --- a/debug_console.cpp +++ b/debug_console.cpp @@ -899,8 +899,10 @@ m_x11Clients.append(c); } connect(workspace(), &Workspace::clientAdded, this, - [this] (X11Client *c) { - add(s_x11ClientId -1, m_x11Clients, c); + [this] (AbstractClient *client) { + if (X11Client *x11Client = qobject_cast(client)) { + add(s_x11ClientId -1, m_x11Clients, x11Client); + } } ); connect(workspace(), &Workspace::clientRemoved, this, diff --git a/effects.cpp b/effects.cpp --- a/effects.cpp +++ b/effects.cpp @@ -166,7 +166,7 @@ } ); connect(ws, &Workspace::clientAdded, this, - [this](X11Client *c) { + [this](AbstractClient *c) { if (c->readyForPainting()) slotClientShown(c); else @@ -564,8 +564,8 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t) { - Q_ASSERT(qobject_cast(t)); - X11Client *c = static_cast(t); + Q_ASSERT(qobject_cast(t)); + AbstractClient *c = static_cast(t); disconnect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotClientShown); setupClientConnections(c); emit windowAdded(c->effectWindow()); diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -351,8 +351,7 @@ void hideOutline(); private Q_SLOTS: - void setupAbstractClientConnections(AbstractClient *client); - void setupClientConnections(X11Client *client); + void setupClientConnections(AbstractClient *client); }; class QtScriptWorkspaceWrapper : public WorkspaceWrapper diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -69,7 +69,7 @@ connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int))); if (waylandServer()) { connect(waylandServer(), &WaylandServer::shellClientAdded, this, &WorkspaceWrapper::clientAdded); - connect(waylandServer(), &WaylandServer::shellClientAdded, this, &WorkspaceWrapper::setupAbstractClientConnections); + connect(waylandServer(), &WaylandServer::shellClientAdded, this, &WorkspaceWrapper::setupClientConnections); } foreach (KWin::X11Client *client, ws->clientList()) { setupClientConnections(client); @@ -277,20 +277,19 @@ return Workspace::self()->supportInformation(); } -void WorkspaceWrapper::setupAbstractClientConnections(AbstractClient *client) +void WorkspaceWrapper::setupClientConnections(AbstractClient *client) { connect(client, &AbstractClient::clientMinimized, this, &WorkspaceWrapper::clientMinimized); connect(client, &AbstractClient::clientUnminimized, this, &WorkspaceWrapper::clientUnminimized); connect(client, qOverload(&AbstractClient::clientMaximizedStateChanged), this, &WorkspaceWrapper::clientMaximizeSet); -} -void WorkspaceWrapper::setupClientConnections(X11Client *client) -{ - setupAbstractClientConnections(client); + X11Client *x11Client = qobject_cast(client); // TODO: Drop X11-specific signals. + if (!x11Client) + return; - connect(client, &X11Client::clientManaging, this, &WorkspaceWrapper::clientManaging); - connect(client, &X11Client::clientFullScreenSet, this, &WorkspaceWrapper::clientFullScreenSet); + connect(x11Client, &X11Client::clientManaging, this, &WorkspaceWrapper::clientManaging); + connect(x11Client, &X11Client::clientFullScreenSet, this, &WorkspaceWrapper::clientFullScreenSet); } void WorkspaceWrapper::showOutline(const QRect &geometry) diff --git a/workspace.h b/workspace.h --- a/workspace.h +++ b/workspace.h @@ -502,7 +502,7 @@ //Signals required for the scripting interface void desktopPresenceChanged(KWin::AbstractClient*, int); void currentDesktopChanged(int, KWin::AbstractClient*); - void clientAdded(KWin::X11Client *); + void clientAdded(KWin::AbstractClient *); void clientRemoved(KWin::AbstractClient*); void clientActivated(KWin::AbstractClient*); void clientDemandsAttentionChanged(KWin::AbstractClient*, bool);