~vanvugt/compiz-plugins-main/fix-1084386

« back to all changes in this revision

Viewing changes to expo/src/expo.h

  • Committer: Sam Spilsbury
  • Date: 2011-08-12 06:36:10 UTC
  • Revision ID: sam.spilsbury@canonical.com-20110812063610-8mcxo2xohctyp2ak
Sync - Remove Plugins

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 *
3
 
 * Compiz expo plugin
4
 
 *
5
 
 * expo.c
6
 
 *
7
 
 * Copyright (c) 2008 Dennis Kasprzyk <racarr@opencompositing.org>
8
 
 * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org>
9
 
 *
10
 
 * Authors:
11
 
 * Robert Carr <racarr@beryl-project.org>
12
 
 * Dennis Kasprzyk <onestone@opencompositing.org>
13
 
 *
14
 
 * This program is free software; you can redistribute it and/or
15
 
 * modify it under the terms of the GNU General Public License
16
 
 * as published by the Free Software Foundation; either version 2
17
 
 * of the License, or (at your option) any later version.
18
 
 *
19
 
 * This program is distributed in the hope that it will be useful,
20
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 
 * GNU General Public License for more details.
23
 
 *
24
 
 **/
25
 
 
26
 
#include <core/core.h>
27
 
#include <core/pluginclasshandler.h>
28
 
 
29
 
#include <composite/composite.h>
30
 
#include <opengl/opengl.h>
31
 
 
32
 
#include "expo_options.h"
33
 
 
34
 
class ExpoScreen :
35
 
    public ScreenInterface,
36
 
    public CompositeScreenInterface,
37
 
    public GLScreenInterface,
38
 
    public PluginClassHandler<ExpoScreen, CompScreen>,
39
 
    public ExpoOptions
40
 
{
41
 
    public:
42
 
        ExpoScreen (CompScreen *);
43
 
 
44
 
        void handleEvent (XEvent *);
45
 
 
46
 
        void preparePaint (int);
47
 
        void paint (CompOutput::ptrList&, unsigned int);
48
 
        void donePaint ();
49
 
 
50
 
        bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&,
51
 
                            const CompRegion&, CompOutput *, unsigned int);
52
 
        void glPaintTransformedOutput (const GLScreenPaintAttrib&,
53
 
                                       const GLMatrix&, const CompRegion&,
54
 
                                       CompOutput *, unsigned int);
55
 
 
56
 
        bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);
57
 
        bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);
58
 
        bool doExpo (CompAction *, CompAction::State, CompOption::Vector&);
59
 
        bool exitExpo (CompAction *, CompAction::State, CompOption::Vector&);
60
 
        bool termExpo (CompAction *, CompAction::State, CompOption::Vector&);
61
 
        bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);
62
 
        bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);
63
 
 
64
 
        typedef enum {
65
 
            DnDNone,
66
 
            DnDDuring,
67
 
            DnDStart
68
 
        } DnDState;
69
 
 
70
 
        typedef enum {
71
 
            VPUpdateNone,
72
 
            VPUpdateMouseOver,
73
 
            VPUpdatePrevious
74
 
        } VPUpdateMode;
75
 
 
76
 
        CompositeScreen *cScreen;
77
 
        GLScreen        *gScreen;
78
 
 
79
 
        float expoCam;
80
 
        bool  expoActive;
81
 
        bool  expoMode;
82
 
 
83
 
        DnDState   dndState;
84
 
        CompWindow *dndWindow;
85
 
 
86
 
        CompPoint prevCursor;
87
 
        CompPoint newCursor;
88
 
 
89
 
        CompPoint origVp;
90
 
        CompPoint selectedVp;
91
 
        CompPoint paintingVp;
92
 
 
93
 
        std::vector<float> vpActivity;
94
 
        float              vpBrightness;
95
 
        float              vpSaturation;
96
 
 
97
 
        VPUpdateMode vpUpdateMode;
98
 
 
99
 
        bool         anyClick;
100
 
        unsigned int clickTime;
101
 
        bool         doubleClick;
102
 
 
103
 
        CompRegion tmpRegion;
104
 
 
105
 
        float curveAngle;
106
 
        float curveDistance;
107
 
        float curveRadius;
108
 
 
109
 
        std::vector<GLfloat> vpNormals;
110
 
        std::vector<GLfloat> winNormals;
111
 
 
112
 
        CompScreen::GrabHandle grabIndex;
113
 
 
114
 
    private:
115
 
        void moveFocusViewport (int, int);
116
 
        void finishWindowMovement ();
117
 
        void updateWraps (bool);
118
 
 
119
 
        void invertTransformedVertex (const GLScreenPaintAttrib&,
120
 
                                      const GLMatrix&, CompOutput *, int[2]);
121
 
        void paintWall (const GLScreenPaintAttrib&, const GLMatrix&,
122
 
                        const CompRegion&, CompOutput *, unsigned int, bool);
123
 
 
124
 
        KeyCode leftKey;
125
 
        KeyCode rightKey;
126
 
        KeyCode upKey;
127
 
        KeyCode downKey;
128
 
};
129
 
 
130
 
class ExpoWindow :
131
 
    public CompositeWindowInterface,
132
 
    public GLWindowInterface,
133
 
    public PluginClassHandler<ExpoWindow, CompWindow>
134
 
{
135
 
    public:
136
 
        ExpoWindow (CompWindow *);
137
 
 
138
 
        bool damageRect (bool, const CompRect&);
139
 
 
140
 
        bool glDraw (const GLMatrix&, GLFragment::Attrib&,
141
 
                     const CompRegion&, unsigned int);
142
 
        bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
143
 
                      const CompRegion&, unsigned int);
144
 
        void glAddGeometry (const GLTexture::MatrixList&,
145
 
                            const CompRegion&, const CompRegion&,
146
 
                            unsigned int, unsigned int);
147
 
        void glDrawTexture (GLTexture *, GLFragment::Attrib& attrib,
148
 
                            unsigned int);
149
 
 
150
 
        CompWindow      *window;
151
 
        CompositeWindow *cWindow;
152
 
        GLWindow        *gWindow;
153
 
        ExpoScreen      *eScreen;
154
 
};
155
 
 
156
 
class ExpoPluginVTable :
157
 
    public CompPlugin::VTableForScreenAndWindow<ExpoScreen, ExpoWindow>
158
 
{
159
 
    public:
160
 
        bool init ();
161
 
};
162