2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_SM_H
|
|
|
|
#define KWIN_SM_H
|
|
|
|
|
|
|
|
#include <QDataStream>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <QRect>
|
2013-09-06 13:22:16 +00:00
|
|
|
#include <QStringList>
|
2022-04-04 22:53:48 +00:00
|
|
|
|
|
|
|
#include <KConfigGroup>
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <kwinglobals.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <netwm_def.h>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
class X11Client;
|
2022-04-04 22:53:48 +00:00
|
|
|
struct SessionInfo;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
class SessionManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-04-04 22:53:48 +00:00
|
|
|
enum SMSavePhase {
|
|
|
|
SMSavePhase0, // saving global state in "phase 0"
|
|
|
|
SMSavePhase2, // saving window state in phase 2
|
|
|
|
SMSavePhase2Full, // complete saving in phase2, there was no phase 0
|
|
|
|
};
|
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
SessionManager(QObject *parent);
|
|
|
|
~SessionManager() override;
|
|
|
|
|
|
|
|
SessionState state() const;
|
|
|
|
|
2022-04-04 22:53:48 +00:00
|
|
|
void loadSubSessionInfo(const QString &name);
|
|
|
|
void storeSubSession(const QString &name, QSet<QByteArray> sessionIds);
|
|
|
|
|
|
|
|
SessionInfo *takeSessionInfo(X11Client *);
|
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void stateChanged();
|
|
|
|
|
2020-04-02 11:44:27 +00:00
|
|
|
void loadSessionRequested(const QString &name);
|
|
|
|
void prepareSessionSaveRequested(const QString &name);
|
|
|
|
void finishSessionSaveRequested(const QString &name);
|
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
public Q_SLOTS: // DBus API
|
|
|
|
void setState(uint state);
|
2020-04-02 11:44:27 +00:00
|
|
|
void loadSession(const QString &name);
|
|
|
|
void aboutToSaveSession(const QString &name);
|
|
|
|
void finishSaveSession(const QString &name);
|
2020-11-13 13:08:02 +00:00
|
|
|
void quit();
|
2019-10-31 16:16:53 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setState(SessionState state);
|
2022-04-04 22:53:48 +00:00
|
|
|
|
|
|
|
void storeSession(const QString &sessionName, SMSavePhase phase);
|
|
|
|
void storeClient(KConfigGroup &cg, int num, X11Client *c);
|
|
|
|
void loadSessionInfo(const QString &sessionName);
|
|
|
|
void addSessionInfo(KConfigGroup &cg);
|
|
|
|
|
2021-01-27 13:18:35 +00:00
|
|
|
SessionState m_sessionState = SessionState::Normal;
|
2022-04-04 22:53:48 +00:00
|
|
|
|
2022-04-04 22:57:29 +00:00
|
|
|
int m_sessionActiveClient;
|
|
|
|
int m_sessionDesktop;
|
2022-04-04 22:53:48 +00:00
|
|
|
|
|
|
|
QList<SessionInfo *> session;
|
2019-10-31 16:16:53 +00:00
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct SessionInfo
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
QByteArray sessionId;
|
|
|
|
QByteArray windowRole;
|
2016-06-23 17:40:40 +00:00
|
|
|
QByteArray wmCommand;
|
2007-04-29 17:35:43 +00:00
|
|
|
QByteArray wmClientMachine;
|
|
|
|
QByteArray resourceName;
|
|
|
|
QByteArray resourceClass;
|
|
|
|
|
|
|
|
QRect geometry;
|
|
|
|
QRect restore;
|
|
|
|
QRect fsrestore;
|
|
|
|
int maximized;
|
|
|
|
int fullscreen;
|
|
|
|
int desktop;
|
|
|
|
bool minimized;
|
|
|
|
bool onAllDesktops;
|
|
|
|
bool shaded;
|
|
|
|
bool keepAbove;
|
|
|
|
bool keepBelow;
|
|
|
|
bool skipTaskbar;
|
|
|
|
bool skipPager;
|
2010-05-03 20:04:44 +00:00
|
|
|
bool skipSwitcher;
|
2008-03-23 00:12:11 +00:00
|
|
|
bool noBorder;
|
2007-04-29 17:35:43 +00:00
|
|
|
NET::WindowType windowType;
|
|
|
|
QString shortcut;
|
|
|
|
bool active; // means 'was active in the saved session'
|
|
|
|
int stackingOrder;
|
2009-08-15 17:33:47 +00:00
|
|
|
float opacity;
|
2009-11-15 03:24:04 +00:00
|
|
|
|
2010-10-02 17:04:24 +00:00
|
|
|
QStringList activities;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|