Add safety guards in FocusChain::move{After,Before}Window()

If the `window` is the same as the `reference`, the `window` will be
inserted at index "-1", which is wrong.
This commit is contained in:
Vlad Zahorodnii 2024-08-21 15:59:05 +03:00
parent 22e10f6efb
commit ef9d3a1cd0

View file

@ -139,6 +139,9 @@ void FocusChain::moveAfterWindow(Window *window, Window *reference)
if (!window->wantsTabFocus()) {
return;
}
if (reference == window) {
return;
}
for (auto it = m_desktopFocusChains.begin();
it != m_desktopFocusChains.end();
@ -159,6 +162,9 @@ void FocusChain::moveBeforeWindow(Window *window, Window *reference)
if (!window->wantsTabFocus()) {
return;
}
if (reference == window) {
return;
}
for (auto it = m_desktopFocusChains.begin();
it != m_desktopFocusChains.end();