From 8b4afa0ee58e64caafc89e4e155275f456476f40 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 26 May 2023 17:18:50 +0300 Subject: [PATCH] Remove null window checks in restacking requests Restacking null windows make no sense. If a window can be null, it should be guarded by the user. However, in practice, it shouldn't matter. --- src/layers.cpp | 14 +------------- src/scripting/workspace_wrapper.cpp | 4 +++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/layers.cpp b/src/layers.cpp index 1c3453a29d..c8f90d10e8 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -273,7 +273,7 @@ Window *Workspace::findDesktop(bool topmost, VirtualDesktop *desktop) const void Workspace::raiseOrLowerWindow(Window *window) { - if (!window || !window->isOnCurrentDesktop()) { + if (!window->isOnCurrentDesktop()) { return; } @@ -290,9 +290,6 @@ void Workspace::raiseOrLowerWindow(Window *window) void Workspace::lowerWindow(Window *window, bool nogroup) { - if (!window) { - return; - } if (window->isDeleted()) { qCWarning(KWIN_CORE) << "Workspace::lowerWindow: closed window" << window << "cannot be restacked"; return; @@ -320,9 +317,6 @@ void Workspace::lowerWindow(Window *window, bool nogroup) void Workspace::lowerWindowWithinApplication(Window *window) { - if (!window) { - return; - } if (window->isDeleted()) { qCWarning(KWIN_CORE) << "Workspace::lowerWindowWithinApplication: closed window" << window << "cannot be restacked"; return; @@ -354,9 +348,6 @@ void Workspace::lowerWindowWithinApplication(Window *window) void Workspace::raiseWindow(Window *window, bool nogroup) { - if (!window) { - return; - } if (window->isDeleted()) { qCWarning(KWIN_CORE) << "Workspace::raiseWindow: closed window" << window << "cannot be restacked"; return; @@ -383,9 +374,6 @@ void Workspace::raiseWindow(Window *window, bool nogroup) void Workspace::raiseWindowWithinApplication(Window *window) { - if (!window) { - return; - } if (window->isDeleted()) { qCWarning(KWIN_CORE) << "Workspace::raiseWindowWithinApplication: closed window" << window << "cannot be restacked"; return; diff --git a/src/scripting/workspace_wrapper.cpp b/src/scripting/workspace_wrapper.cpp index d534f2e9a3..c29c229c34 100644 --- a/src/scripting/workspace_wrapper.cpp +++ b/src/scripting/workspace_wrapper.cpp @@ -287,7 +287,9 @@ QList WorkspaceWrapper::stackingOrder() const void WorkspaceWrapper::raiseWindow(KWin::Window *window) { - KWin::Workspace::self()->raiseWindow(window); + if (window) { + KWin::Workspace::self()->raiseWindow(window); + } } Window *WorkspaceWrapper::getClient(qulonglong windowId)