File indexing completed on 2025-02-16 11:23:17
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include "utils/common.h" 0012 0013 #include <QHash> 0014 #include <QRect> 0015 #include <QString> 0016 #include <QUuid> 0017 #include <QVector> 0018 0019 namespace KWin 0020 { 0021 0022 class Window; 0023 class Workspace; 0024 0025 class PlacementTracker : public QObject 0026 { 0027 Q_OBJECT 0028 public: 0029 PlacementTracker(Workspace *workspace); 0030 0031 void add(Window *window); 0032 void remove(Window *window); 0033 0034 void restore(const QString &key); 0035 void init(const QString &key); 0036 0037 void inhibit(); 0038 void uninhibit(); 0039 0040 private: 0041 struct WindowData 0042 { 0043 QUuid outputUuid; 0044 QRectF geometry; 0045 MaximizeMode maximize; 0046 QuickTileMode quickTile; 0047 QRectF geometryRestore; 0048 bool fullscreen; 0049 QRectF fullscreenGeometryRestore; 0050 uint32_t interactiveMoveResizeCount; 0051 }; 0052 0053 void saveGeometry(Window *window); 0054 void saveInteractionCounter(Window *window); 0055 void saveMaximize(KWin::Window *window, MaximizeMode mode); 0056 void saveQuickTile(); 0057 void saveFullscreen(); 0058 WindowData dataForWindow(Window *window) const; 0059 0060 QVector<Window *> m_savedWindows; 0061 QHash<QString, QHash<Window *, WindowData>> m_data; 0062 QHash<Window *, WindowData> m_lastRestoreData; 0063 QString m_currentKey; 0064 int m_inhibitCount = 0; 0065 Workspace *const m_workspace; 0066 }; 0067 0068 }