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/privatehandler.h>
30
#include <composite/composite.h>
31
#include <opengl/opengl.h>
32
#include <core/atoms.h>
34
#define DECOR_OPTION_SHADOW_RADIUS 0
35
#define DECOR_OPTION_SHADOW_OPACITY 1
36
#define DECOR_OPTION_SHADOW_COLOR 2
37
#define DECOR_OPTION_SHADOW_OFFSET_X 3
38
#define DECOR_OPTION_SHADOW_OFFSET_Y 4
39
#define DECOR_OPTION_COMMAND 5
40
#define DECOR_OPTION_MIPMAP 6
41
#define DECOR_OPTION_DECOR_MATCH 7
42
#define DECOR_OPTION_SHADOW_MATCH 8
43
#define DECOR_OPTION_NUM 9
45
#define DECOR_SCREEN(s) DecorScreen *ds = DecorScreen::get(s)
46
#define DECOR_WINDOW(w) DecorWindow *dw = DecorWindow::get(w)
56
#define DECOR_NORMAL 1
57
#define DECOR_ACTIVE 2
63
DecorTexture (Pixmap pixmap);
71
GLTexture::List textures;
79
static Decoration * create (Window id, Atom decorAtom);
80
static void release (Decoration *);
84
DecorTexture *texture;
85
CompWindowExtents output;
86
CompWindowExtents input;
87
CompWindowExtents maxInput;
96
GLTexture::Matrix matrix;
102
class WindowDecoration {
104
static WindowDecoration * create (Decoration *);
105
static void destroy (WindowDecoration *);
116
public ScreenInterface,
117
public PrivateHandler<DecorScreen,CompScreen>
120
DecorScreen (CompScreen *s);
123
CompOption::Vector & getOptions ();
124
bool setOption (const char *name, CompOption::Value &value);
126
void handleEvent (XEvent *event);
127
void matchPropertyChanged (CompWindow *);
129
DecorTexture * getTexture (Pixmap);
130
void releaseTexture (DecorTexture *);
133
void checkForDm (bool);
134
bool decoratorStartTimeout ();
138
CompositeScreen *cScreen;
140
std::list<DecorTexture *> textures;
142
Atom supportingDmCheckAtom;
144
Atom decorAtom[DECOR_NUM];
146
Atom outputFrameAtom;
148
Atom decorTypePixmapAtom;
149
Atom decorTypeWindowAtom;
154
Decoration *decor[DECOR_NUM];
155
Decoration windowDefault;
159
std::map<Window, DecorWindow *> frames;
161
CompOption::Vector opt;
163
CompTimer decoratorStart;
167
public WindowInterface,
168
public CompositeWindowInterface,
169
public GLWindowInterface,
170
public PrivateHandler<DecorWindow,CompWindow>
173
DecorWindow (CompWindow *w);
176
void getOutputExtents (CompWindowExtents&);
177
void resizeNotify (int, int, int, int);
178
void moveNotify (int, int, bool);
179
void stateChangeNotify (unsigned int);
180
void updateFrameRegion (CompRegion ®ion);
182
bool damageRect (bool, const CompRect &);
184
bool glDraw (const GLMatrix &, GLFragment::Attrib &,
185
const CompRegion &, unsigned int);
187
void updateDecoration ();
189
void setDecorationMatrices ();
191
void updateDecorationScale ();
194
void updateInputFrame ();
195
void updateOutputFrame ();
196
void updateWindowRegions ();
198
bool checkSize (Decoration *decor);
205
bool resizeTimeout ();
211
CompositeWindow *cWindow;
212
DecorScreen *dScreen;
214
WindowDecoration *wd;
217
CompRegion frameRegion;
230
CompRegion::Vector regions;
233
CompTimer resizeUpdate;
234
CompTimer moveUpdate;
237
class DecorPluginVTable :
238
public CompPlugin::VTableForScreenAndWindow<DecorScreen, DecorWindow>
244
PLUGIN_OPTION_HELPER (DecorScreen);