1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org> 6 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org> 7 8 SPDX-License-Identifier: GPL-2.0-or-later 9 */ 10 11 #ifndef KWIN_SM_H 12 #define KWIN_SM_H 13 14 #include <QDataStream> 15 #include <kwinglobals.h> 16 #include <QStringList> 17 #include <netwm_def.h> 18 #include <QRect> 19 20 namespace KWin 21 { 22 23 class X11Client; 24 25 class SessionManager : public QObject 26 { 27 Q_OBJECT 28 public: 29 SessionManager(QObject *parent); 30 ~SessionManager() override; 31 32 SessionState state() const; 33 34 Q_SIGNALS: 35 void stateChanged(); 36 37 void loadSessionRequested(const QString &name); 38 void prepareSessionSaveRequested(const QString &name); 39 void finishSessionSaveRequested(const QString &name); 40 41 public Q_SLOTS: // DBus API 42 void setState(uint state); 43 void loadSession(const QString &name); 44 void aboutToSaveSession(const QString &name); 45 void finishSaveSession(const QString &name); 46 void quit(); 47 48 private: 49 void setState(SessionState state); 50 SessionState m_sessionState = SessionState::Normal; 51 }; 52 53 struct SessionInfo { 54 QByteArray sessionId; 55 QByteArray windowRole; 56 QByteArray wmCommand; 57 QByteArray wmClientMachine; 58 QByteArray resourceName; 59 QByteArray resourceClass; 60 61 QRect geometry; 62 QRect restore; 63 QRect fsrestore; 64 int maximized; 65 int fullscreen; 66 int desktop; 67 bool minimized; 68 bool onAllDesktops; 69 bool shaded; 70 bool keepAbove; 71 bool keepBelow; 72 bool skipTaskbar; 73 bool skipPager; 74 bool skipSwitcher; 75 bool noBorder; 76 NET::WindowType windowType; 77 QString shortcut; 78 bool active; // means 'was active in the saved session' 79 int stackingOrder; 80 float opacity; 81 82 QStringList activities; 83 }; 84 85 86 enum SMSavePhase { 87 SMSavePhase0, // saving global state in "phase 0" 88 SMSavePhase2, // saving window state in phase 2 89 SMSavePhase2Full, // complete saving in phase2, there was no phase 0 90 }; 91 92 } // namespace 93 94 #endif 95