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

« back to all changes in this revision

Viewing changes to workarounds/src/workarounds.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
 
 * Copyright (C) 2007 Andrew Riedi <andrewriedi@gmail.com>
3
 
 *
4
 
 * Sticky window handling and OpenGL fixes:
5
 
 * Copyright (c) 2007 Dennis Kasprzyk <onestone@opencompositing.org>
6
 
 *
7
 
 * Ported to Compiz 0.9:
8
 
 * Copyright (c) 2008 Sam Spilsbury <smspillaz@gmail.com>
9
 
 *
10
 
 * This program is free software; you can redistribute it and/or modify
11
 
 * it under the terms of the GNU General Public License as published by
12
 
 * the Free Software Foundation; either version 2 of the License, or
13
 
 * (at your option) any later version.
14
 
 *
15
 
 * This program is distributed in the hope that it will be useful,
16
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU General Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU General Public License
21
 
 * along with this program; if not, write to the Free Software
22
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
 
 *
24
 
 * This plug-in for Metacity-like workarounds.
25
 
 */
26
 
 
27
 
#include <string.h>
28
 
#include <limits.h>
29
 
 
30
 
#include <core/core.h>
31
 
#include <composite/composite.h>
32
 
#include <opengl/opengl.h>
33
 
#include <core/atoms.h>
34
 
#include <core/propertywriter.h>
35
 
#include <X11/Xatom.h>
36
 
#include <X11/extensions/shape.h>
37
 
 
38
 
#include "workarounds_options.h"
39
 
 
40
 
extern bool haveOpenGL;
41
 
 
42
 
typedef void (*GLProgramParameter4dvProc) (GLenum         target,
43
 
                                           GLuint         index,
44
 
                                           const GLdouble *data);
45
 
 
46
 
class WorkaroundsScreen :
47
 
    public PluginClassHandler <WorkaroundsScreen, CompScreen>,
48
 
    public ScreenInterface,
49
 
    public GLScreenInterface,
50
 
    public CompositeScreenInterface,
51
 
    public WorkaroundsOptions
52
 
{
53
 
    public:
54
 
 
55
 
        WorkaroundsScreen (CompScreen *);
56
 
        ~WorkaroundsScreen ();
57
 
 
58
 
        CompositeScreen *cScreen;
59
 
        GLScreen        *gScreen;
60
 
 
61
 
        Atom            roleAtom;
62
 
        std::list <Window> mfwList;
63
 
        CompWindowList  minimizingWindows;
64
 
        bool            skipTransients;
65
 
 
66
 
        PropertyWriter  inputDisabledAtom;
67
 
 
68
 
        GL::GLProgramParameter4fProc origProgramEnvParameter4f;
69
 
        GLProgramParameter4dvProc    programEnvParameter4dv;
70
 
 
71
 
        GL::GLXGetVideoSyncProc      origGetVideoSync;
72
 
        GL::GLXWaitVideoSyncProc     origWaitVideoSync;
73
 
 
74
 
        GL::GLXCopySubBufferProc     origCopySubBuffer;
75
 
 
76
 
        void
77
 
        handleEvent (XEvent *);
78
 
 
79
 
        void
80
 
        preparePaint (int);
81
 
 
82
 
        bool
83
 
        glPaintOutput (const GLScreenPaintAttrib &,
84
 
                       const GLMatrix            &,
85
 
                       const CompRegion          &,
86
 
                       CompOutput                *,
87
 
                       unsigned int                );
88
 
 
89
 
        void
90
 
        handleCompizEvent (const char         *pluginName,
91
 
                           const char         *eventName,
92
 
                           CompOption::Vector &o);
93
 
 
94
 
        void
95
 
        addToFullscreenList (CompWindow *w);
96
 
 
97
 
        void
98
 
        removeFromFullscreenList (CompWindow *w);
99
 
 
100
 
        void
101
 
        updateParameterFix ();
102
 
 
103
 
        void
104
 
        updateVideoSyncFix ();
105
 
 
106
 
        void
107
 
        optionChanged (CompOption                     *opt,
108
 
                       WorkaroundsOptions::Options    num);
109
 
 
110
 
        void
111
 
        checkFunctions (bool window, bool screen);
112
 
 
113
 
        void
114
 
        setWindowState (unsigned int state, Window id);
115
 
 
116
 
 
117
 
};
118
 
 
119
 
#define WORKAROUNDS_SCREEN(s)                                                  \
120
 
    WorkaroundsScreen *ws = WorkaroundsScreen::get (s)
121
 
 
122
 
class WorkaroundsWindow :
123
 
    public PluginClassHandler <WorkaroundsWindow, CompWindow>,
124
 
    public WindowInterface,
125
 
    public GLWindowInterface
126
 
{
127
 
    public:
128
 
 
129
 
        typedef struct _HideInfo {
130
 
            Window shapeWindow;
131
 
 
132
 
            unsigned long skipState;
133
 
            unsigned long shapeMask;
134
 
 
135
 
            XRectangle *inputRects;
136
 
            int        nInputRects;
137
 
            int        inputRectOrdering;
138
 
 
139
 
        } HideInfo;
140
 
 
141
 
    public:
142
 
 
143
 
        WorkaroundsWindow (CompWindow *);
144
 
        ~WorkaroundsWindow ();
145
 
 
146
 
        CompWindow      *window;
147
 
        CompositeWindow *cWindow;
148
 
        GLWindow        *gWindow;
149
 
 
150
 
        bool adjustedWinType;
151
 
        bool madeSticky;
152
 
        bool madeFullscreen;
153
 
        bool isFullscreen;
154
 
        bool madeDemandAttention;
155
 
        bool isMinimized;
156
 
 
157
 
        unsigned int oldWmType;
158
 
 
159
 
        HideInfo *windowHideInfo;
160
 
 
161
 
        bool
162
 
        isGroupTransient (Window);
163
 
 
164
 
        void
165
 
        resizeNotify (int, int, int, int);
166
 
 
167
 
        void
168
 
        getAllowedActions (unsigned int &,
169
 
                           unsigned int &);
170
 
 
171
 
        void minimize ();
172
 
        void unminimize ();
173
 
        bool minimized ();
174
 
 
175
 
        bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
176
 
                      const CompRegion &, unsigned int);
177
 
 
178
 
        void setVisibility (bool);
179
 
        void restoreInputShape (HideInfo *);
180
 
        void clearInputShape (HideInfo *);
181
 
 
182
 
        void
183
 
        removeSticky ();
184
 
 
185
 
        CompString
186
 
        getRoleAtom ();
187
 
 
188
 
        void
189
 
        updateSticky ();
190
 
 
191
 
        void
192
 
        updateUrgencyState ();
193
 
 
194
 
        void
195
 
        fixupFullscreen ();
196
 
 
197
 
        void
198
 
        updateFixedWindow (unsigned int newWmType);
199
 
 
200
 
        unsigned int
201
 
        getFixedWindowType ();
202
 
 
203
 
};
204
 
 
205
 
#define WORKAROUNDS_WINDOW(w)                                                  \
206
 
    WorkaroundsWindow *ww = WorkaroundsWindow::get (w)
207
 
 
208
 
class WorkaroundsPluginVTable :
209
 
    public CompPlugin::VTableForScreenAndWindow <WorkaroundsScreen,
210
 
                                                 WorkaroundsWindow>
211
 
{
212
 
    public:
213
 
 
214
 
        bool init ();
215
 
};