summaryrefslogtreecommitdiff
path: root/src/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cpp')
-rw-r--r--src/Window.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 2c6781f4..d0465023 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -653,6 +653,27 @@ CWindow* CWindow::getGroupCurrent() {
return curr;
}
+int CWindow::getGroupSize() {
+ int size = 1;
+ CWindow* curr = this;
+ while (curr->m_sGroupData.pNextWindow != this) {
+ curr = curr->m_sGroupData.pNextWindow;
+ size++;
+ }
+ return size;
+}
+
+CWindow* CWindow::getGroupWindowByIndex(int index) {
+ const int SIZE = getGroupSize();
+ index = ((index % SIZE) + SIZE) % SIZE;
+ CWindow* curr = getGroupHead();
+ while (index > 0) {
+ curr = curr->m_sGroupData.pNextWindow;
+ index--;
+ }
+ return curr;
+}
+
void CWindow::setGroupCurrent(CWindow* pWindow) {
CWindow* curr = this->m_sGroupData.pNextWindow;
bool isMember = false;
@@ -701,10 +722,8 @@ void CWindow::setGroupCurrent(CWindow* pWindow) {
}
void CWindow::insertWindowToGroup(CWindow* pWindow) {
- static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("misc:group_insert_after_current")->intValue;
-
- const auto BEGINAT = *USECURRPOS ? this : getGroupTail();
- const auto ENDAT = *USECURRPOS ? m_sGroupData.pNextWindow : getGroupHead();
+ const auto BEGINAT = this;
+ const auto ENDAT = m_sGroupData.pNextWindow;
if (!pWindow->m_sGroupData.pNextWindow) {
BEGINAT->m_sGroupData.pNextWindow = pWindow;