~linaro-graphics-wg/compiz-plugins-main/oneiric-gles2

« back to all changes in this revision

Viewing changes to session/src/session.h

  • Committer: Sam Spilsbury
  • Date: 2011-09-20 07:43:55 UTC
  • Revision ID: sam.spilsbury@canonical.com-20110920074355-puzdutejjwsu3ta2
Sync - Remove Plugins

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 *
3
 
 * Compiz session plugin
4
 
 *
5
 
 * session.c
6
 
 *
7
 
 * Copyright (c) 2008 Travis Watkins <amaranth@ubuntu.com>
8
 
 * Copyright (c) 2008 Danny Baumann <maniac@opencompositing.org>
9
 
 * Copyright (c) 2006 Patrick Niklaus
10
 
 *
11
 
 *
12
 
 * This program is free software; you can redistribute it and/or
13
 
 * modify it under the terms of the GNU General Public License
14
 
 * as published by the Free Software Foundation; either version 2
15
 
 * of the License, or (at your option) any later version.
16
 
 *
17
 
 * This program is distributed in the hope that it will be useful,
18
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
 * GNU General Public License for more details.
21
 
 *
22
 
 * Authors: Travis Watkins <amaranth@ubuntu.com>
23
 
 *          Patrick Niklaus
24
 
 **/
25
 
 
26
 
#include <core/core.h>
27
 
#include <core/pluginclasshandler.h>
28
 
 
29
 
#include <X11/Xatom.h>
30
 
#include <X11/SM/SM.h>
31
 
 
32
 
#include <libxml/xmlmemory.h>
33
 
#include <libxml/parser.h>
34
 
#include <libxml/xpath.h>
35
 
#include <libxml/xmlsave.h>
36
 
 
37
 
#include <iostream>
38
 
#include <fstream>
39
 
 
40
 
#include "session_options.h"
41
 
 
42
 
typedef struct
43
 
{
44
 
    CompString clientId;
45
 
    CompString title;
46
 
    CompString resName;
47
 
    CompString resClass;
48
 
    CompString role;
49
 
    CompString command;
50
 
 
51
 
    bool     geometrySet;
52
 
    CompRect geometry;
53
 
 
54
 
    unsigned int state;
55
 
    bool         minimized;
56
 
    int          workspace;
57
 
} SessionItem;
58
 
 
59
 
class SessionScreen :
60
 
    public ScreenInterface,
61
 
    public PluginClassHandler<SessionScreen, CompScreen>,
62
 
    public SessionOptions
63
 
{
64
 
    public:
65
 
        SessionScreen (CompScreen *);
66
 
 
67
 
        void handleEvent (XEvent *);
68
 
        void sessionEvent (CompSession::Event, CompOption::Vector &);
69
 
 
70
 
        bool readWindow (CompWindow *);
71
 
 
72
 
    private:
73
 
        bool getUtf8Property (Window, Atom, CompString&);
74
 
        bool getTextProperty (Window, Atom, CompString&);
75
 
        bool getWindowTitle (Window, CompString&);
76
 
        bool getWindowClass (Window, CompString&, CompString&);
77
 
        bool getIsEmbedded (Window);
78
 
        bool getClientLeaderProperty (CompWindow *, Atom, CompString&);
79
 
 
80
 
        int getIntForProp (xmlNodePtr, const char *);
81
 
        CompString getStringForProp (xmlNodePtr, const char *);
82
 
 
83
 
        bool isSessionWindow (CompWindow *);
84
 
        void addWindowNode (CompWindow *, xmlNodePtr);
85
 
 
86
 
        void saveState (const CompString &);
87
 
        void readState (xmlNodePtr);
88
 
        void loadState (const CompString &);
89
 
 
90
 
        bool matchWindowClass (CompWindow *, const SessionItem&);
91
 
 
92
 
        CompString getFileName (const CompString &);
93
 
        bool createDir (const CompString&);
94
 
        
95
 
        Atom visibleNameAtom;
96
 
        Atom clientIdAtom;
97
 
        Atom embedInfoAtom;
98
 
        Atom roleAtom;
99
 
        Atom commandAtom;
100
 
 
101
 
        typedef std::list<SessionItem> ItemList;
102
 
 
103
 
        ItemList     items;
104
 
        std::fstream file;
105
 
};
106
 
 
107
 
class SessionWindow :
108
 
    public WindowInterface,
109
 
    public PluginClassHandler<SessionWindow, CompWindow>
110
 
{
111
 
    public:
112
 
        SessionWindow (CompWindow *);
113
 
 
114
 
        bool place (CompPoint &);
115
 
 
116
 
        CompWindow *window;
117
 
        bool       positionSet;
118
 
        CompPoint  position;
119
 
};
120
 
 
121
 
class SessionPluginVTable :
122
 
    public CompPlugin::VTableForScreenAndWindow<SessionScreen, SessionWindow>
123
 
{
124
 
    public:
125
 
        bool init ();
126
 
};