1 | /******************************************************************** |
2 | KWin - the KDE window manager |
3 | This file is part of the KDE project. |
4 | |
5 | Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> |
6 | Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> |
7 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | *********************************************************************/ |
21 | |
22 | #ifndef KWIN_SM_H |
23 | #define KWIN_SM_H |
24 | |
25 | #include <QDataStream> |
26 | #include <kapplication.h> |
27 | #include <ksessionmanager.h> |
28 | #include <netwm_def.h> |
29 | #include <QRect> |
30 | |
31 | #include <X11/SM/SMlib.h> |
32 | #include <fixx11h.h> |
33 | |
34 | class QSocketNotifier; |
35 | |
36 | namespace KWin |
37 | { |
38 | |
39 | class Client; |
40 | |
41 | struct SessionInfo { |
42 | QByteArray sessionId; |
43 | QByteArray windowRole; |
44 | QByteArray wmCommand; |
45 | QByteArray wmClientMachine; |
46 | QByteArray resourceName; |
47 | QByteArray resourceClass; |
48 | |
49 | QRect geometry; |
50 | QRect restore; |
51 | QRect fsrestore; |
52 | int maximized; |
53 | int fullscreen; |
54 | int desktop; |
55 | bool minimized; |
56 | bool onAllDesktops; |
57 | bool shaded; |
58 | bool keepAbove; |
59 | bool keepBelow; |
60 | bool skipTaskbar; |
61 | bool ; |
62 | bool skipSwitcher; |
63 | bool noBorder; |
64 | NET::WindowType windowType; |
65 | QString shortcut; |
66 | bool active; // means 'was active in the saved session' |
67 | int stackingOrder; |
68 | float opacity; |
69 | int tabGroup; // Unique identifier for the client group that this window is in |
70 | |
71 | Client* tabGroupClient; // The first client created that has an identical identifier |
72 | QStringList activities; |
73 | }; |
74 | |
75 | |
76 | enum SMSavePhase { |
77 | SMSavePhase0, // saving global state in "phase 0" |
78 | SMSavePhase2, // saving window state in phase 2 |
79 | SMSavePhase2Full // complete saving in phase2, there was no phase 0 |
80 | }; |
81 | |
82 | class SessionSaveDoneHelper |
83 | : public QObject |
84 | { |
85 | Q_OBJECT |
86 | public: |
87 | SessionSaveDoneHelper(); |
88 | virtual ~SessionSaveDoneHelper(); |
89 | SmcConn connection() const { |
90 | return conn; |
91 | } |
92 | void saveDone(); |
93 | void close(); |
94 | private slots: |
95 | void processData(); |
96 | private: |
97 | QSocketNotifier* notifier; |
98 | SmcConn conn; |
99 | }; |
100 | |
101 | |
102 | class SessionManager |
103 | : public KSessionManager |
104 | { |
105 | public: |
106 | virtual bool saveState(QSessionManager& sm); |
107 | virtual bool commitData(QSessionManager& sm); |
108 | }; |
109 | |
110 | } // namespace |
111 | |
112 | #endif |
113 | |