5
* Copyright © 2008 Dennis Kasprzyk
6
* Copyright © 2007 Novell, Inc.
8
* Permission to use, copy, modify, distribute, and sell this software
9
* and its documentation for any purpose is hereby granted without
10
* fee, provided that the above copyright notice appear in all copies
11
* and that both that copyright notice and this permission notice
12
* appear in supporting documentation, and that the name of
13
* Dennis Kasprzyk not be used in advertising or publicity pertaining to
14
* distribution of the software without specific, written prior permission.
15
* Dennis Kasprzyk makes no representations about the suitability of this
16
* software for any purpose. It is provided "as is" without express or
19
* DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
21
* NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
23
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
24
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
25
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27
* Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
28
* David Reveman <davidr@novell.com>
31
#ifndef _COMPIZ_COMPOSITE_H
32
#define _COMPIZ_COMPOSITE_H
34
#include <X11/extensions/Xcomposite.h>
36
#define COMPIZ_COMPOSITE_ABI 1
38
#include <core/privatehandler.h>
39
#include <core/timer.h>
40
#include <core/core.h>
42
#define COMPOSITE_SCREEN_DAMAGE_PENDING_MASK (1 << 0)
43
#define COMPOSITE_SCREEN_DAMAGE_REGION_MASK (1 << 1)
44
#define COMPOSITE_SCREEN_DAMAGE_ALL_MASK (1 << 2)
50
#define PAINT_SCREEN_REGION_MASK (1 << 0)
51
#define PAINT_SCREEN_FULL_MASK (1 << 1)
52
#define PAINT_SCREEN_TRANSFORMED_MASK (1 << 2)
53
#define PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK (1 << 3)
54
#define PAINT_SCREEN_CLEAR_MASK (1 << 4)
55
#define PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK (1 << 5)
56
#define PAINT_SCREEN_NO_BACKGROUND_MASK (1 << 6)
60
class PrivateCompositeScreen;
61
class PrivateCompositeWindow;
62
class CompositeScreen;
63
class CompositeWindow;
65
class CompositeScreenInterface :
66
public WrapableInterface<CompositeScreen, CompositeScreenInterface>
70
virtual void preparePaint (int);
71
virtual void donePaint ();
72
virtual void paint (CompOutput::ptrList &outputs, unsigned int);
74
virtual CompWindowList getWindowPaintList ();
78
class CompositeScreen :
79
public WrapableHandler<CompositeScreenInterface, 4>,
80
public PrivateHandler<CompositeScreen, CompScreen, COMPIZ_COMPOSITE_ABI>
86
virtual ~PaintHandler () {};
88
virtual void paintOutputs (CompOutput::ptrList &outputs,
90
const CompRegion ®ion) = 0;
92
virtual bool hasVSync () { return false; };
94
virtual void prepareDrawing () {};
98
CompositeScreen (CompScreen *s);
101
CompOption::Vector & getOptions ();
102
bool setOption (const char *name, CompOption::Value &value);
103
CompOption * getOption (const char *name);
105
bool registerPaintHandler (PaintHandler *pHnd);
106
void unregisterPaintHandler ();
108
bool compositingActive ();
112
void damageScreen ();
113
void damageRegion (const CompRegion &);
114
void damagePending ();
115
unsigned int damageMask ();
116
const CompRegion & currentDamage () const;
118
void showOutputWindow ();
119
void hideOutputWindow ();
120
void updateOutputWindow ();
125
int & overlayWindowCount ();
127
void setWindowPaintOffset (int x, int y);
128
CompPoint windowPaintOffset ();
131
void detectRefreshRate ();
132
int getTimeToNextRedraw (struct timeval *tv);
136
bool handlePaintTimeout ();
138
WRAPABLE_HND (0, CompositeScreenInterface, void, preparePaint, int);
139
WRAPABLE_HND (1, CompositeScreenInterface, void, donePaint);
140
WRAPABLE_HND (2, CompositeScreenInterface, void, paint,
141
CompOutput::ptrList &outputs, unsigned int);
143
WRAPABLE_HND (3, CompositeScreenInterface, CompWindowList,
146
friend class PrivateCompositeDisplay;
149
PrivateCompositeScreen *priv;
152
static bool toggleSlowAnimations (CompAction *action,
153
CompAction::State state,
154
CompOption::Vector &options);
160
bit 1-16 are used for read-only flags and they provide
161
information that describe the screen rendering pass
162
currently in process.
164
bit 17-32 are writable flags and they provide information
165
that is used to optimize rendering.
169
this flag is present when window is being painted
170
on a transformed screen.
172
#define PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK (1 << 0)
175
this flag is present when window is being tested
176
for occlusion of other windows.
178
#define PAINT_WINDOW_OCCLUSION_DETECTION_MASK (1 << 1)
181
this flag indicates that the window ist painted with
184
#define PAINT_WINDOW_WITH_OFFSET_MASK (1 << 2)
187
flag indicate that window is translucent.
189
#define PAINT_WINDOW_TRANSLUCENT_MASK (1 << 16)
192
flag indicate that window is transformed.
194
#define PAINT_WINDOW_TRANSFORMED_MASK (1 << 17)
197
flag indicate that core PaintWindow function should
198
not draw this window.
200
#define PAINT_WINDOW_NO_CORE_INSTANCE_MASK (1 << 18)
203
flag indicate that blending is required.
205
#define PAINT_WINDOW_BLEND_MASK (1 << 19)
207
class CompositeWindowInterface :
208
public WrapableInterface<CompositeWindow, CompositeWindowInterface>
211
virtual bool damageRect (bool, const CompRect &);
214
class CompositeWindow :
215
public WrapableHandler<CompositeWindowInterface, 1>,
216
public PrivateHandler<CompositeWindow, CompWindow, COMPIZ_COMPOSITE_ABI>
220
CompositeWindow (CompWindow *w);
230
bool overlayWindow ();
232
void damageTransformedRect (float xScale,
236
const CompRect &rect);
238
void damageOutputExtents ();
239
void addDamageRect (const CompRect &);
240
void addDamage (bool force = false);
244
void processDamage (XDamageNotifyEvent *de);
246
void updateOpacity ();
247
void updateBrightness ();
248
void updateSaturation ();
250
unsigned short opacity ();
251
unsigned short brightness ();
252
unsigned short saturation ();
254
WRAPABLE_HND (0, CompositeWindowInterface, bool, damageRect,
255
bool, const CompRect &);
257
friend class PrivateCompositeWindow;
258
friend class CompositeScreen;
261
PrivateCompositeWindow *priv;