diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -330,6 +330,11 @@ void slotWindowToDesktopUp(); void slotWindowToDesktopDown(); + /** + * Sends the AbstractClient to the given @p screen. + */ + void sendClientToScreen(KWin::AbstractClient *client, int screen); + /** * Shows an outline at the specified @p geometry. * If an outline is already shown the outline is moved to the new position. diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -347,6 +347,11 @@ return screens()->size(); } +void WorkspaceWrapper::sendClientToScreen(AbstractClient *client, int screen) +{ + return workspace()->sendClientToScreen(client, screen); +} + QtScriptWorkspaceWrapper::QtScriptWorkspaceWrapper(QObject* parent) : WorkspaceWrapper(parent) {} diff --git a/useractions.cpp b/useractions.cpp --- a/useractions.cpp +++ b/useractions.cpp @@ -779,9 +779,6 @@ if (m_client.isNull()) { return; } - if (screen >= screens()->count()) { - return; - } Workspace::self()->sendClientToScreen(m_client.data(), screen); } diff --git a/workspace.cpp b/workspace.cpp --- a/workspace.cpp +++ b/workspace.cpp @@ -1224,6 +1224,9 @@ void Workspace::sendClientToScreen(AbstractClient* c, int screen) { + if (screen < 0 || screen >= screens()->count()) { + return; + } c->sendToScreen(screen); }