~smspillaz/compiz-core/compiz-core.fix_936675

« back to all changes in this revision

Viewing changes to plugins/decor/src/decor.h

  • Committer: Daniel van Vugt
  • Author(s): Sam Spilsbury
  • Date: 2012-02-09 07:48:57 UTC
  • Revision ID: vanvugt@gmail.com-20120209074857-sw5wuk431uqkzgzb
Be a little smarter about updating decorations (LP: #928173)

Merged -r2983..2985 from lp:~smspillaz/compiz-core/compiz-core.decor_928173

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 */
25
25
 
26
26
#include <boost/shared_ptr.hpp>
 
27
#include <boost/shared_array.hpp>
27
28
#include <core/window.h>
28
29
#include <core/pluginclasshandler.h>
29
30
 
68
69
class Decoration {
69
70
 
70
71
    public:
71
 
        static Decoration * create (Window        id,
72
 
                                    long          *prop,
73
 
                                    unsigned int  size,
74
 
                                    unsigned int  type,
75
 
                                    unsigned int  nOffset);
76
 
        static void release (Decoration *);
 
72
 
 
73
        typedef boost::shared_ptr <Decoration> Ptr;
 
74
 
 
75
        static Decoration::Ptr create (Window        id,
 
76
                                       long          *prop,
 
77
                                       unsigned int  size,
 
78
                                       unsigned int  type,
 
79
                                       unsigned int  nOffset);
 
80
 
 
81
        Decoration (int   type,
 
82
                    const decor_extents_t &border,
 
83
                    const decor_extents_t &input,
 
84
                    const decor_extents_t &maxBorder,
 
85
                    const decor_extents_t &maxInput,
 
86
                    unsigned int frameType,
 
87
                    unsigned int frameState,
 
88
                    unsigned int frameActions,
 
89
                    unsigned int minWidth,
 
90
                    unsigned int minHeight,
 
91
                    Pixmap       pixmap,
 
92
                    const boost::shared_array <decor_quad_t> &quad,
 
93
                    unsigned int nQuad);
 
94
 
 
95
        ~Decoration ();
77
96
 
78
97
    public:
79
98
        int                       refCount;
88
107
        unsigned int              frameType;
89
108
        unsigned int              frameState;
90
109
        unsigned int              frameActions;
91
 
        decor_quad_t              *quad;
 
110
        boost::shared_array <decor_quad_t> quad;
92
111
        int                       nQuad;
93
112
        int                       type;
94
113
};
97
116
{
98
117
    public:
99
118
        bool updateDecoration  (Window id, Atom decorAtom);
100
 
        Decoration *findMatchingDecoration (CompWindow *w, bool sizeCheck);
 
119
        const Decoration::Ptr & findMatchingDecoration (CompWindow *w, bool sizeCheck);
101
120
        void clear ()
102
121
        {
103
 
            foreach (Decoration *d, mList)
104
 
                Decoration::release (d);
 
122
            mList.clear ();
105
123
        };
106
124
 
107
125
        DecorationList ();
108
126
 
109
 
        std::vector <Decoration *> mList;
 
127
        std::list <Decoration::Ptr> mList;
110
128
};
111
129
 
112
130
struct ScaledQuad {
118
136
 
119
137
class WindowDecoration {
120
138
    public:
121
 
        static WindowDecoration * create (Decoration *);
 
139
        static WindowDecoration * create (const Decoration::Ptr &);
122
140
        static void destroy (WindowDecoration *);
123
141
 
124
142
    public:
125
 
        Decoration *decor;
 
143
        Decoration::Ptr decor;
126
144
        ScaledQuad *quad;
127
145
        int        nQuad;
128
146
};
178
196
        Window dmWin;
179
197
        int    dmSupports;
180
198
 
 
199
        bool cmActive;
 
200
 
181
201
        DecorationList decor[DECOR_NUM];
182
 
        Decoration     windowDefault;
183
 
 
184
 
        bool cmActive;
 
202
        Decoration::Ptr     windowDefault;
185
203
 
186
204
        std::map<Window, DecorWindow *> frames;
187
205
 
226
244
        void updateOutputFrame ();
227
245
        void updateWindowRegions ();
228
246
 
229
 
        bool checkSize (Decoration *decor);
 
247
        bool checkSize (const Decoration::Ptr &decor);
230
248
 
231
249
        int shiftX ();
232
250
        int shiftY ();