summaryrefslogtreecommitdiff
path: root/src/desktop/history/WindowHistoryTracker.hpp
blob: 926456839c85d685995b04e88ac85ec2f6e6406a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "../DesktopTypes.hpp"

#include <vector>

namespace Desktop::History {
    class CWindowHistoryTracker {
      public:
        CWindowHistoryTracker();
        ~CWindowHistoryTracker() = default;

        CWindowHistoryTracker(const CWindowHistoryTracker&) = delete;
        CWindowHistoryTracker(CWindowHistoryTracker&)       = delete;
        CWindowHistoryTracker(CWindowHistoryTracker&&)      = delete;

        // History is ordered old -> new, meaning .front() is oldest, while .back() is newest

        const std::vector<PHLWINDOWREF>& fullHistory();
        std::vector<PHLWINDOWREF>        historyForWorkspace(PHLWORKSPACE ws);

      private:
        std::vector<PHLWINDOWREF> m_history;

        void                      track(PHLWINDOW w);
        void                      gc();
    };

    SP<CWindowHistoryTracker> windowTracker();
};