Desktop/history: Move history to desktop (#12676)

This commit is contained in:
Vaxry 2025-12-20 22:16:13 +00:00 committed by GitHub
parent 70f54a1e1b
commit b9bef69554
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 372 additions and 181 deletions

View file

@ -4,6 +4,7 @@
#include "../Compositor.hpp"
#include "../managers/TokenManager.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../desktop/history/WorkspaceHistoryTracker.hpp"
#include "Monitor.hpp"
#include "../config/ConfigManager.hpp"
#include "fs/FsUtils.hpp"
@ -179,7 +180,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
if (!valid(PWORKSPACE))
return {WORKSPACE_INVALID};
const auto PREVWORKSPACEIDNAME = PWORKSPACE->getPrevWorkspaceIDName();
const auto PREVWORKSPACEIDNAME = Desktop::History::workspaceTracker()->previousWorkspaceIDName(PWORKSPACE);
if (PREVWORKSPACEIDNAME.id == -1)
return {WORKSPACE_INVALID};

View file

@ -1480,29 +1480,6 @@ void CMonitor::moveTo(const Vector2D& pos) {
m_position = pos;
}
SWorkspaceIDName CMonitor::getPrevWorkspaceIDName(const WORKSPACEID id) {
while (!m_prevWorkSpaces.empty()) {
const int PREVID = m_prevWorkSpaces.top();
m_prevWorkSpaces.pop();
if (PREVID == id) // skip same workspace
continue;
// recheck if previous workspace's was moved to another monitor
const auto ws = g_pCompositor->getWorkspaceByID(PREVID);
if (ws && ws->monitorID() == m_id)
return {.id = PREVID, .name = ws->m_name};
}
return {.id = WORKSPACE_INVALID};
}
void CMonitor::addPrevWorkspaceID(const WORKSPACEID id) {
if (!m_prevWorkSpaces.empty() && m_prevWorkSpaces.top() == id)
return;
m_prevWorkSpaces.emplace(id);
}
Vector2D CMonitor::middle() {
return m_position + m_size / 2.f;
}

View file

@ -351,10 +351,6 @@ class CMonitor {
return m_position == rhs.m_position && m_size == rhs.m_size && m_name == rhs.m_name;
}
// workspace previous per monitor functionality
SWorkspaceIDName getPrevWorkspaceIDName(const WORKSPACEID id);
void addPrevWorkspaceID(const WORKSPACEID id);
private:
void setupDefaultWS(const SMonitorRule&);
WORKSPACEID findAvailableDefaultWS();