2022-06-22 23:02:35 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "utils/common.h"
|
|
|
|
|
|
|
|
#include <QHash>
|
2023-10-19 06:50:15 +00:00
|
|
|
#include <QList>
|
2022-06-22 23:02:35 +00:00
|
|
|
#include <QRect>
|
|
|
|
#include <QString>
|
|
|
|
#include <QUuid>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class Window;
|
|
|
|
class Workspace;
|
|
|
|
|
|
|
|
class PlacementTracker : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PlacementTracker(Workspace *workspace);
|
|
|
|
|
|
|
|
void add(Window *window);
|
|
|
|
void remove(Window *window);
|
|
|
|
|
|
|
|
void restore(const QString &key);
|
|
|
|
void init(const QString &key);
|
|
|
|
|
|
|
|
void inhibit();
|
|
|
|
void uninhibit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct WindowData
|
|
|
|
{
|
|
|
|
QUuid outputUuid;
|
|
|
|
QRectF geometry;
|
|
|
|
MaximizeMode maximize;
|
|
|
|
QuickTileMode quickTile;
|
|
|
|
QRectF geometryRestore;
|
|
|
|
bool fullscreen;
|
|
|
|
QRectF fullscreenGeometryRestore;
|
|
|
|
uint32_t interactiveMoveResizeCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
void saveGeometry(Window *window);
|
2023-02-25 22:29:07 +00:00
|
|
|
void saveInteractionCounter(Window *window);
|
|
|
|
void saveMaximize(Window *window);
|
|
|
|
void saveQuickTile(Window *window);
|
|
|
|
void saveFullscreen(Window *window);
|
2024-02-19 14:50:07 +00:00
|
|
|
void saveMaximizeGeometryRestore(Window *window);
|
|
|
|
void saveFullscreenGeometryRestore(Window *window);
|
2022-06-22 23:02:35 +00:00
|
|
|
WindowData dataForWindow(Window *window) const;
|
|
|
|
|
2023-10-19 06:50:15 +00:00
|
|
|
QList<Window *> m_savedWindows;
|
2022-06-22 23:02:35 +00:00
|
|
|
QHash<QString, QHash<Window *, WindowData>> m_data;
|
|
|
|
QHash<Window *, WindowData> m_lastRestoreData;
|
|
|
|
QString m_currentKey;
|
|
|
|
int m_inhibitCount = 0;
|
|
|
|
Workspace *const m_workspace;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|