desktop/group: fix movegroupwindow not following focus (#13426)
This commit is contained in:
parent
1c64ef06d9
commit
e333a330c0
2 changed files with 30 additions and 0 deletions
|
|
@ -127,6 +127,34 @@ static bool test() {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test movegroupwindow: focus should follow the moved window
|
||||||
|
NLog::log("{}Test movegroupwindow focus follows window", Colors::YELLOW);
|
||||||
|
try {
|
||||||
|
auto str = getFromSocket("/activewindow");
|
||||||
|
auto activeBeforeMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16);
|
||||||
|
OK(getFromSocket("/dispatch movegroupwindow f"));
|
||||||
|
str = getFromSocket("/activewindow");
|
||||||
|
auto activeAfterMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16);
|
||||||
|
EXPECT(activeAfterMove, activeBeforeMove);
|
||||||
|
} catch (...) {
|
||||||
|
NLog::log("{}Fail at getting prop", Colors::RED);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// and backwards
|
||||||
|
NLog::log("{}Test movegroupwindow backwards", Colors::YELLOW);
|
||||||
|
try {
|
||||||
|
auto str = getFromSocket("/activewindow");
|
||||||
|
auto activeBeforeMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16);
|
||||||
|
OK(getFromSocket("/dispatch movegroupwindow b"));
|
||||||
|
str = getFromSocket("/activewindow");
|
||||||
|
auto activeAfterMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16);
|
||||||
|
EXPECT(activeAfterMove, activeBeforeMove);
|
||||||
|
} catch (...) {
|
||||||
|
NLog::log("{}Fail at getting prop", Colors::RED);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
NLog::log("{}Disable autogrouping", Colors::YELLOW);
|
NLog::log("{}Disable autogrouping", Colors::YELLOW);
|
||||||
OK(getFromSocket("/keyword group:auto_group false"));
|
OK(getFromSocket("/keyword group:auto_group false"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ void CGroup::swapWithNext() {
|
||||||
|
|
||||||
size_t idx = m_current + 1 >= m_windows.size() ? 0 : m_current + 1;
|
size_t idx = m_current + 1 >= m_windows.size() ? 0 : m_current + 1;
|
||||||
std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx);
|
std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx);
|
||||||
|
m_current = idx;
|
||||||
|
|
||||||
updateWindowVisibility();
|
updateWindowVisibility();
|
||||||
|
|
||||||
|
|
@ -329,6 +330,7 @@ void CGroup::swapWithLast() {
|
||||||
|
|
||||||
size_t idx = m_current == 0 ? m_windows.size() - 1 : m_current - 1;
|
size_t idx = m_current == 0 ? m_windows.size() - 1 : m_current - 1;
|
||||||
std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx);
|
std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx);
|
||||||
|
m_current = idx;
|
||||||
|
|
||||||
updateWindowVisibility();
|
updateWindowVisibility();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue