KWin
sm.h
Go to the documentation of this file.00001 /******************************************************************** 00002 KWin - the KDE window manager 00003 This file is part of the KDE project. 00004 00005 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> 00006 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 *********************************************************************/ 00021 00022 #ifndef KWIN_SM_H 00023 #define KWIN_SM_H 00024 00025 #include <QDataStream> 00026 #include <kapplication.h> 00027 #include <ksessionmanager.h> 00028 #include <X11/SM/SMlib.h> 00029 #include <netwm_def.h> 00030 #include <QRect> 00031 00032 class QSocketNotifier; 00033 00034 namespace KWin 00035 { 00036 00037 struct SessionInfo 00038 { 00039 QByteArray sessionId; 00040 QByteArray windowRole; 00041 QByteArray wmCommand; 00042 QByteArray wmClientMachine; 00043 QByteArray resourceName; 00044 QByteArray resourceClass; 00045 00046 QRect geometry; 00047 QRect restore; 00048 QRect fsrestore; 00049 int maximized; 00050 int fullscreen; 00051 int desktop; 00052 bool minimized; 00053 bool onAllDesktops; 00054 bool shaded; 00055 bool keepAbove; 00056 bool keepBelow; 00057 bool skipTaskbar; 00058 bool skipPager; 00059 bool noBorder; 00060 NET::WindowType windowType; 00061 QString shortcut; 00062 bool active; // means 'was active in the saved session' 00063 int stackingOrder; 00064 }; 00065 00066 00067 enum SMSavePhase 00068 { 00069 SMSavePhase0, // saving global state in "phase 0" 00070 SMSavePhase2, // saving window state in phase 2 00071 SMSavePhase2Full // complete saving in phase2, there was no phase 0 00072 }; 00073 00074 class SessionSaveDoneHelper 00075 : public QObject 00076 { 00077 Q_OBJECT 00078 public: 00079 SessionSaveDoneHelper(); 00080 virtual ~SessionSaveDoneHelper(); 00081 SmcConn connection() const { return conn; } 00082 void saveDone(); 00083 void close(); 00084 private slots: 00085 void processData(); 00086 private: 00087 QSocketNotifier* notifier; 00088 SmcConn conn; 00089 }; 00090 00091 00092 class SessionManager 00093 : public KSessionManager 00094 { 00095 public: 00096 virtual bool saveState( QSessionManager& sm ); 00097 virtual bool commitData( QSessionManager& sm ); 00098 }; 00099 00100 } // namespace 00101 00102 #endif