sm.h 2 KB
Newer Older
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
1
2
3
/*
    KWin - the KDE window manager
    This file is part of the KDE project.
4

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
5
6
    SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
    SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
7

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
8
9
    SPDX-License-Identifier: GPL-2.0-or-later
*/
10
11
12
13
14

#ifndef KWIN_SM_H
#define KWIN_SM_H

#include <QDataStream>
15
16
#include <kwinglobals.h>
#include <QStringList>
17
#include <netwm_def.h>
Adriaan de Groot's avatar
Adriaan de Groot committed
18
#include <QRect>
19
20
21
22

namespace KWin
{

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
23
class X11Client;
24

25
26
27
28
29
30
31
32
33
34
35
36
class SessionManager : public QObject
{
    Q_OBJECT
public:
    SessionManager(QObject *parent);
    ~SessionManager() override;

    SessionState state() const;

Q_SIGNALS:
    void stateChanged();

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
37
38
39
40
    void loadSessionRequested(const QString &name);
    void prepareSessionSaveRequested(const QString &name);
    void finishSessionSaveRequested(const QString &name);

41
42
public Q_SLOTS: // DBus API
    void setState(uint state);
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
43
44
45
    void loadSession(const QString &name);
    void aboutToSaveSession(const QString &name);
    void finishSaveSession(const QString &name);
46
    void quit();
47
48
49
50
51
52

private:
    void setState(SessionState state);
    SessionState m_sessionState;
};

53
struct SessionInfo {
54
55
    QByteArray sessionId;
    QByteArray windowRole;
56
    QByteArray wmCommand;
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
    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;
74
    bool skipSwitcher;
75
    bool noBorder;
76
77
78
79
    NET::WindowType windowType;
    QString shortcut;
    bool active; // means 'was active in the saved session'
    int stackingOrder;
Thomas Lübking's avatar
Thomas Lübking committed
80
    float opacity;
81

82
    QStringList activities;
83
};
84
85


86
enum SMSavePhase {
87
88
89
    SMSavePhase0,     // saving global state in "phase 0"
    SMSavePhase2,     // saving window state in phase 2
    SMSavePhase2Full  // complete saving in phase2, there was no phase 0
90
91
};

92
93
94
} // namespace

#endif