~dbarth/compiz/reworked-fix-744104

« back to all changes in this revision

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

  • Committer: David Barth
  • Date: 2011-04-06 14:49:44 UTC
  • Revision ID: david.barth@canonical.com-20110406144944-urrqzn5x00yzzbna
re-worked sam's grid improvements patch; needs a review though

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <composite/composite.h>
29
29
#include <opengl/opengl.h>
30
30
 
 
31
#include <cmath>
 
32
 
31
33
#include "grid_options.h"
32
34
 
33
35
#define SNAPOFF_THRESHOLD 50
85
87
        GridRectangle addBorders (CompWindow *w) const;
86
88
};
87
89
 
 
90
class Paintable
 
91
{
 
92
    public:
 
93
 
 
94
        Paintable ()
 
95
        {
 
96
        };
 
97
 
 
98
        virtual void paint (const GLMatrix &mat) = 0;
 
99
};
 
100
 
 
101
class AnimatedGridRectangle :
 
102
    public GridRectangle
 
103
{
 
104
    public:
 
105
 
 
106
        AnimatedGridRectangle () :
 
107
            GridRectangle::GridRectangle (),
 
108
            mFrom (CompRect (0, 0, 0, 0)),
 
109
            mProgress (0.0f),
 
110
            mTime (300)
 
111
        {
 
112
        };
 
113
 
 
114
        AnimatedGridRectangle (const GridRectangle &r) :
 
115
            GridRectangle::GridRectangle (r),
 
116
            mFrom (CompRect (0, 0, 0, 0)),
 
117
            mProgress (0.0f),
 
118
            mTime (300)
 
119
        {
 
120
        };
 
121
 
 
122
        AnimatedGridRectangle (const CompRect &r) :
 
123
            GridRectangle::GridRectangle (r),
 
124
            mFrom (CompRect (0, 0, 0, 0)),
 
125
            mProgress (0.0f),
 
126
            mTime (300)
 
127
        {
 
128
        };
 
129
 
 
130
        CompRect current ();
 
131
        float    progress ();
 
132
 
 
133
        void setFrom (CompRect &);
 
134
        void setProgress (float);
 
135
        void reset ();
 
136
        void setTime (unsigned int);
 
137
 
 
138
    private:
 
139
 
 
140
        CompRect mFrom;
 
141
        float    mProgress;
 
142
 
 
143
        unsigned int mTime;
 
144
};
 
145
 
 
146
class PaintableAnimatedGridRectangle :
 
147
    public Paintable,
 
148
    public AnimatedGridRectangle
 
149
{
 
150
    public:
 
151
 
 
152
        PaintableAnimatedGridRectangle () :
 
153
            Paintable::Paintable (),
 
154
            AnimatedGridRectangle::AnimatedGridRectangle ()
 
155
        {
 
156
        };
 
157
 
 
158
        PaintableAnimatedGridRectangle (const GridRectangle &r) :
 
159
            Paintable::Paintable (),
 
160
            AnimatedGridRectangle::AnimatedGridRectangle (r)
 
161
        {
 
162
        };
 
163
 
 
164
        PaintableAnimatedGridRectangle (const CompRect &r) :
 
165
            Paintable::Paintable (),
 
166
            AnimatedGridRectangle::AnimatedGridRectangle (r)
 
167
        {
 
168
        };
 
169
 
 
170
        virtual void paint (const GLMatrix &mat);
 
171
};
 
172
 
88
173
class GridScreen :
89
174
    public ScreenInterface,
90
175
    public CompositeScreenInterface,
98
183
        CompositeScreen *cScreen;
99
184
        GLScreen        *glScreen;
100
185
 
101
 
        GridRectangle desiredSlot;
 
186
        PaintableAnimatedGridRectangle *desiredSlot;
102
187
        CompRect workarea, currentRect,
103
188
                 desiredRect, lastWorkarea, currentWorkarea;
104
189
        GridProps props;
110
195
        bool initiateCommon (CompAction*, CompAction::State,
111
196
                             CompOption::Vector&, GridType, bool);
112
197
 
113
 
        void glPaintRectangle (const GLScreenPaintAttrib&,
114
 
                               const GLMatrix&, CompOutput *);
115
 
 
116
198
        bool glPaintOutput (const GLScreenPaintAttrib &,
117
199
                            const GLMatrix &, const CompRegion &,
118
200
                            CompOutput *, unsigned int);
132
214
 
133
215
class GridWindow :
134
216
    public WindowInterface,
 
217
    public GLWindowInterface,
135
218
    public PluginClassHandler <GridWindow, CompWindow>
136
219
{
137
220
    public:
138
221
 
139
222
        GridWindow (CompWindow *);
140
223
        CompWindow *window;
 
224
        GLWindow   *glWindow;
141
225
        GridScreen *gScreen;
142
226
 
143
227
        bool isGridResized;
154
238
        GridRectangle
155
239
        constrainSize (const GridRectangle & slot);
156
240
 
 
241
        bool
 
242
        glDraw (const GLMatrix            &transform,
 
243
                GLFragment::Attrib        &fragment,
 
244
                const CompRegion          &region,
 
245
                unsigned int              mask);
 
246
 
157
247
        void grabNotify (int, int, unsigned int, unsigned int);
158
248
 
159
249
        void ungrabNotify ();