2
* Copyright © 2005 Novell, Inc.
4
* Permission to use, copy, modify, distribute, and sell this software
5
* and its documentation for any purpose is hereby granted without
6
* fee, provided that the above copyright notice appear in all copies
7
* and that both that copyright notice and this permission notice
8
* appear in supporting documentation, and that the name of
9
* Novell, Inc. not be used in advertising or publicity pertaining to
10
* distribution of the software without specific, written prior permission.
11
* Novell, Inc. makes no representations about the suitability of this
12
* software for any purpose. It is provided "as is" without express or
15
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
* Author: David Reveman <davidr@novell.com>
26
#include <boost/shared_ptr.hpp>
27
#include <core/core.h>
28
#include <core/pluginclasshandler.h>
30
#include <composite/composite.h>
31
#include <opengl/opengl.h>
32
#include <core/atoms.h>
34
#include "decor_options.h"
36
#define DECOR_SCREEN(s) DecorScreen *ds = DecorScreen::get(s)
37
#define DECOR_WINDOW(w) DecorWindow *dw = DecorWindow::get(w)
47
#define DECOR_NORMAL 1
48
#define DECOR_ACTIVE 2
54
DecorTexture (Pixmap pixmap);
62
GLTexture::List textures;
70
static Decoration * create (Window id, Atom decorAtom);
71
static void release (Decoration *);
75
DecorTexture *texture;
76
CompWindowExtents output;
77
CompWindowExtents border;
78
CompWindowExtents input;
79
CompWindowExtents maxBorder;
80
CompWindowExtents maxInput;
89
GLTexture::Matrix matrix;
95
class WindowDecoration {
97
static WindowDecoration * create (Decoration *);
98
static void destroy (WindowDecoration *);
109
public ScreenInterface,
110
public PluginClassHandler<DecorScreen,CompScreen>,
114
DecorScreen (CompScreen *s);
117
bool setOption (const CompString &name, CompOption::Value &value);
119
void handleEvent (XEvent *event);
120
void matchPropertyChanged (CompWindow *);
121
void addSupportedAtoms (std::vector<Atom>&);
123
DecorTexture * getTexture (Pixmap);
124
void releaseTexture (DecorTexture *);
126
void checkForDm (bool);
127
bool decoratorStartTimeout ();
129
void updateDefaultShadowProperty ();
133
CompositeScreen *cScreen;
135
std::list<DecorTexture *> textures;
137
Atom supportingDmCheckAtom;
139
Atom decorAtom[DECOR_NUM];
141
Atom outputFrameAtom;
143
Atom decorTypePixmapAtom;
144
Atom decorTypeWindowAtom;
145
Atom requestFrameExtentsAtom;
146
Atom shadowColorAtom;
148
Atom decorSwitchWindowAtom;
153
Decoration *decor[DECOR_NUM];
154
Decoration windowDefault;
158
std::map<Window, DecorWindow *> frames;
160
CompTimer decoratorStart;
164
public WindowInterface,
165
public CompositeWindowInterface,
166
public GLWindowInterface,
167
public PluginClassHandler<DecorWindow,CompWindow>
170
DecorWindow (CompWindow *w);
173
void getOutputExtents (CompWindowExtents&);
174
void resizeNotify (int, int, int, int);
175
void moveNotify (int, int, bool);
176
void stateChangeNotify (unsigned int);
177
void updateFrameRegion (CompRegion ®ion);
179
bool damageRect (bool, const CompRect &);
181
void computeShadowRegion ();
183
bool glDraw (const GLMatrix &, GLFragment::Attrib &,
184
const CompRegion &, unsigned int);
185
void glDecorate (const GLMatrix &, GLFragment::Attrib &,
186
const CompRegion &, unsigned int);
188
void windowNotify (CompWindowNotify n);
190
void updateDecoration ();
192
void setDecorationMatrices ();
194
void updateDecorationScale ();
197
void updateInputFrame ();
198
void updateOutputFrame ();
199
void updateWindowRegions ();
201
bool checkSize (Decoration *decor);
208
bool resizeTimeout ();
210
void updateSwitcher ();
216
CompositeWindow *cWindow;
217
DecorScreen *dScreen;
219
WindowDecoration *wd;
222
CompRegion frameRegion;
223
CompRegion shadowRegion;
236
CompRegion::Vector regions;
239
CompTimer resizeUpdate;
240
CompTimer moveUpdate;
247
class DecorPluginVTable :
248
public CompPlugin::VTableForScreenAndWindow<DecorScreen, DecorWindow>