summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--include/compdisplay.h7
-rw-r--r--include/compicon.h3
-rw-r--r--include/compiz-core.h9
-rw-r--r--include/compmatrix.h40
-rw-r--r--include/composite/composite.h181
-rw-r--r--include/compscreen.h317
-rw-r--r--include/compvector.h51
-rw-r--r--include/compwindow.h114
-rw-r--r--include/opengl/fragment.h (renamed from include/compfragment.h)25
-rw-r--r--include/opengl/matrix.h38
-rw-r--r--include/opengl/opengl.h345
-rw-r--r--include/opengl/texture.h (renamed from include/comptexture.h)39
-rw-r--r--include/opengl/vector.h51
-rw-r--r--metadata/Makefile.am4
-rw-r--r--metadata/composite.xml.in36
-rw-r--r--metadata/core.xml.in60
-rw-r--r--metadata/opengl.xml.in44
-rw-r--r--plugins/Makefile.am5
-rw-r--r--plugins/composite/Makefile.am26
-rw-r--r--plugins/composite/composite.cpp282
-rw-r--r--plugins/composite/display.cpp234
-rw-r--r--plugins/composite/privates.h148
-rw-r--r--plugins/composite/screen.cpp760
-rw-r--r--plugins/composite/window.cpp622
-rw-r--r--plugins/move.cpp69
-rw-r--r--plugins/opengl/Makefile.am36
-rw-r--r--plugins/opengl/display.cpp77
-rw-r--r--plugins/opengl/fragment.cpp (renamed from src/fragment.cpp)45
-rw-r--r--plugins/opengl/icon.cpp49
-rw-r--r--plugins/opengl/matrix.cpp (renamed from src/matrix.cpp)62
-rw-r--r--plugins/opengl/opengl.cpp264
-rw-r--r--plugins/opengl/paint.cpp (renamed from src/paint.cpp)406
-rw-r--r--plugins/opengl/privatefragment.h (renamed from src/privatefragment.h)4
-rw-r--r--plugins/opengl/privates.h184
-rw-r--r--plugins/opengl/privatetexture.h40
-rw-r--r--plugins/opengl/screen.cpp1138
-rw-r--r--plugins/opengl/texture.cpp (renamed from src/texture.cpp)139
-rw-r--r--plugins/opengl/vector.cpp (renamed from src/vector.cpp)84
-rw-r--r--plugins/opengl/window.cpp219
-rw-r--r--src/Makefile.am13
-rw-r--r--src/display.cpp91
-rw-r--r--src/event.cpp182
-rw-r--r--src/icon.cpp17
-rw-r--r--src/main.cpp75
-rw-r--r--src/option.cpp2
-rw-r--r--src/privatedisplay.h133
-rw-r--r--src/privatescreen.h125
-rw-r--r--src/privatetexture.h35
-rw-r--r--src/privatewindow.h43
-rw-r--r--src/screen.cpp1638
-rw-r--r--src/window.cpp609
52 files changed, 5479 insertions, 3743 deletions
diff --git a/configure.ac b/configure.ac
index 8588c49..79a9992 100644
--- a/configure.ac
+++ b/configure.ac
@@ -639,6 +639,8 @@ kde/window-decorator/Makefile
kde/window-decorator-kde4/Makefile
po/Makefile.in
metadata/Makefile
+plugins/composite/Makefile
+plugins/opengl/Makefile
])
echo ""
diff --git a/include/compdisplay.h b/include/compdisplay.h
index 2ef5a22..9d0a525 100644
--- a/include/compdisplay.h
+++ b/include/compdisplay.h
@@ -8,8 +8,6 @@
#include <X11/Xregion.h>
#include <X11/extensions/Xinerama.h>
-#include <GL/gl.h>
-
#include <compobject.h>
#include <compmatch.h>
#include <compcore.h>
@@ -211,9 +209,6 @@ class CompDisplay : public WrapableHandler<DisplayInterface>, public CompObject
CompScreenList &
screens();
- GLenum
- textureFilter ();
-
CompOption *
getOption (const char *);
@@ -282,8 +277,6 @@ class CompDisplay : public WrapableHandler<DisplayInterface>, public CompObject
findTopLevelWindow (Window id);
- void
- clearTargetOutput (unsigned int mask);
bool
readImageFromFile (const char *name,
diff --git a/include/compicon.h b/include/compicon.h
index 23b03e6..34cfce8 100644
--- a/include/compicon.h
+++ b/include/compicon.h
@@ -1,7 +1,6 @@
#ifndef _COMPICON_H
#define _COMPICON_H
-#include <comptexture.h>
class CompScreen;
class CompIcon {
@@ -9,13 +8,11 @@ class CompIcon {
CompIcon (CompScreen *screen, unsigned width, unsigned int height);
~CompIcon ();
- CompTexture & texture ();
unsigned int width ();
unsigned int height ();
unsigned char* data ();
private:
- CompTexture mTexture;
int mWidth;
unsigned int mHeight;
unsigned char *mData;
diff --git a/include/compiz-core.h b/include/compiz-core.h
index ba85f10..0b4f70f 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -34,15 +34,11 @@
#include <X11/Xlib-xcb.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xdamage.h>
-#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/sync.h>
#include <X11/Xregion.h>
#include <X11/XKBlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-
// X11 Bool defination breaks BOOST_FOREACH. Convert it to a typedef */
#ifdef Bool
typedef Bool XBool;
@@ -79,16 +75,13 @@ typedef XBool Bool;
#include <compoption.h>
#include <compmetadata.h>
#include <compaction.h>
-#include <compfragment.h>
#include <compicon.h>
#include <compmatch.h>
-#include <compmatrix.h>
#include <compoutput.h>
#include <comppoint.h>
#include <comprect.h>
#include <compsession.h>
#include <compsize.h>
-#include <comptexture.h>
-#include <compvector.h>
+
#endif
diff --git a/include/compmatrix.h b/include/compmatrix.h
deleted file mode 100644
index 3f9962e..0000000
--- a/include/compmatrix.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _COMPMATRIX_H
-#define _COMPMATRIX_H
-
-#include <compvector.h>
-
-class CompOutput;
-
-class CompMatrix {
- public:
- CompMatrix ();
-
- const float* getMatrix () const;
-
- CompMatrix& operator*= (const CompMatrix& rhs);
-
- void reset ();
- void toScreenSpace (CompOutput *output, float z);
-
- void rotate (const float angle, const float x,
- const float y, const float z);
- void rotate (const float angle, const CompVector& vector);
-
- void scale (const float x, const float y, const float z);
- void scale (const CompVector& vector);
-
- void translate (const float x, const float y, const float z);
- void translate (const CompVector& vector);
-
- private:
- friend CompMatrix operator* (const CompMatrix& lhs,
- const CompMatrix& rhs);
- friend CompVector operator* (const CompMatrix& lhs,
- const CompVector& rhs);
-
- float m[16];
-};
-
-typedef CompMatrix CompTransform;
-
-#endif
diff --git a/include/composite/composite.h b/include/composite/composite.h
new file mode 100644
index 0000000..67e45b7
--- /dev/null
+++ b/include/composite/composite.h
@@ -0,0 +1,181 @@
+#ifndef _COMPIZ_COMPOSITE_H
+#define _COMPIZ_COMPOSITE_H
+
+#include <X11/extensions/Xcomposite.h>
+
+#define COMPIZ_COMPOSITE_ABI 1
+
+#define PLUGIN Composite
+#include <compprivatehandler.h>
+#include <compiz-core.h>
+
+#define COMPOSITE_SCREEN_DAMAGE_PENDING_MASK (1 << 0)
+#define COMPOSITE_SCREEN_DAMAGE_REGION_MASK (1 << 1)
+#define COMPOSITE_SCREEN_DAMAGE_ALL_MASK (1 << 2)
+
+class PrivateCompositeDisplay;
+class PrivateCompositeScreen;
+class PrivateCompositeWindow;
+class CompositeScreen;
+class CompositeWindow;
+
+class CompositeDisplay :
+ public CompositePrivateHandler<CompositeDisplay, CompDisplay,
+ COMPIZ_COMPOSITE_ABI>
+{
+ public:
+ CompositeDisplay (CompDisplay *d);
+ ~CompositeDisplay ();
+
+ CompOption::Vector & getOptions ();
+ bool setOption (const char *name, CompOption::Value &value);
+
+ private:
+ PrivateCompositeDisplay *priv;
+};
+
+class CompositeScreenInterface : public WrapableInterface<CompositeScreen> {
+ public:
+ CompositeScreenInterface ();
+
+ WRAPABLE_DEF(void, preparePaint, int);
+ WRAPABLE_DEF(void, donePaint);
+ WRAPABLE_DEF(void, paint, CompOutput::ptrList &outputs, unsigned int);
+
+ WRAPABLE_DEF(CompWindowList, getWindowPaintList);
+};
+
+
+class CompositeScreen :
+ public WrapableHandler<CompositeScreenInterface>,
+ public CompositePrivateHandler<CompositeScreen, CompScreen,
+ COMPIZ_COMPOSITE_ABI>
+{
+ public:
+
+ class PaintHandler {
+ public:
+ virtual ~PaintHandler () {};
+
+ virtual void paintOutputs (CompOutput::ptrList &outputs,
+ unsigned int mask,
+ Region region) = 0;
+
+ virtual bool hasVSync () { return false; };
+
+ virtual void prepareDrawing () {};
+ };
+
+ public:
+ CompositeScreen (CompScreen *s);
+ ~CompositeScreen ();
+
+ CompOption::Vector & getOptions ();
+ bool setOption (const char *name, CompOption::Value &value);
+ CompOption * getOption (const char *name);
+
+ bool registerPaintHandler (PaintHandler *pHnd);
+ void unregisterPaintHandler ();
+
+ bool compositingActive ();
+
+
+ void damageScreen ();
+ void damageRegion (Region);
+ void damagePending ();
+ unsigned int damageMask ();
+
+ void showOutputWindow ();
+ void hideOutputWindow ();
+ void updateOutputWindow ();
+
+ Window overlay ();
+ Window output ();
+
+ int & overlayWindowCount ();
+
+ void setWindowPaintOffset (int x, int y);
+ CompPoint windowPaintOffset ();
+
+
+ void detectRefreshRate ();
+ int getTimeToNextRedraw (struct timeval *tv);
+
+ bool handlePaintTimeout ();
+
+ WRAPABLE_HND(void, preparePaint, int);
+ WRAPABLE_HND(void, donePaint);
+ WRAPABLE_HND(void, paint, CompOutput::ptrList &outputs, unsigned int);
+
+ WRAPABLE_HND(CompWindowList, getWindowPaintList);
+
+ friend class PrivateCompositeDisplay;
+
+ private:
+ PrivateCompositeScreen *priv;
+
+ public:
+ static bool toggleSlowAnimations (CompDisplay *d,
+ CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options);
+};
+
+class CompositeWindowInterface : public WrapableInterface<CompositeWindow> {
+ public:
+ CompositeWindowInterface ();
+
+ WRAPABLE_DEF(bool, damageRect, bool, BoxPtr);
+};
+
+class CompositeWindow :
+ public WrapableHandler<CompositeWindowInterface>,
+ public CompositePrivateHandler<CompositeWindow, CompWindow,
+ COMPIZ_COMPOSITE_ABI>
+{
+ public:
+
+ CompositeWindow (CompWindow *w);
+ ~CompositeWindow ();
+
+ bool bind ();
+ void release ();
+ Pixmap pixmap ();
+
+ void redirect ();
+ void unredirect ();
+ bool redirected ();
+ bool overlayWindow ();
+
+ void damageTransformedRect (float xScale,
+ float yScale,
+ float xTranslate,
+ float yTranslate,
+ BoxPtr rect);
+
+ void damageOutputExtents ();
+ void addDamageRect (BoxPtr rect);
+ void addDamage ();
+
+ bool damaged ();
+
+ void processDamage (XDamageNotifyEvent *de);
+
+ void updateOpacity ();
+ void updateBrightness ();
+ void updateSaturation ();
+
+ unsigned short opacity ();
+ unsigned short brightness ();
+ unsigned short saturation ();
+
+ WRAPABLE_HND(bool, damageRect, bool, BoxPtr);
+
+ friend class PrivateCompositeWindow;
+ friend class CompositeScreen;
+
+ private:
+ PrivateCompositeWindow *priv;
+};
+
+#endif
diff --git a/include/compscreen.h b/include/compscreen.h
index 2a26765..db495a7 100644
--- a/include/compscreen.h
+++ b/include/compscreen.h
@@ -2,9 +2,6 @@
#define _COMPSCREEN_H
#include <compwindow.h>
-#include <comptexture.h>
-#include <compfragment.h>
-#include <compmatrix.h>
#include <compoutput.h>
#include <compsession.h>
@@ -12,11 +9,11 @@ class CompScreen;
class PrivateScreen;
typedef std::list<CompWindow *> CompWindowList;
-extern GLushort defaultColor[4];
-
-#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR > 2
-#define USE_COW
-#endif
+extern char *backgroundImage;
+extern bool replaceCurrentWm;
+extern bool indirectRendering;
+extern bool strictBinding;
+extern bool noDetection;
/* camera distance from screen, 0.5 * tan (FOV) */
#define DEFAULT_Z_CAMERA 0.866025404f
@@ -36,119 +33,7 @@ extern GLushort defaultColor[4];
#define PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK (1 << 5)
#define PAINT_SCREEN_NO_BACKGROUND_MASK (1 << 6)
-#ifndef GLX_EXT_texture_from_pixmap
-#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
-#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
-#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
-#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
-#define GLX_Y_INVERTED_EXT 0x20D4
-#define GLX_TEXTURE_FORMAT_EXT 0x20D5
-#define GLX_TEXTURE_TARGET_EXT 0x20D6
-#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
-#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
-#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
-#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
-#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
-#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
-#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
-#define GLX_TEXTURE_1D_EXT 0x20DB
-#define GLX_TEXTURE_2D_EXT 0x20DC
-#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
-#define GLX_FRONT_LEFT_EXT 0x20DE
-#endif
-
-typedef void (*FuncPtr) (void);
-typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
-
-typedef void (*GLXBindTexImageProc) (Display *display,
- GLXDrawable drawable,
- int buffer,
- int *attribList);
-typedef void (*GLXReleaseTexImageProc) (Display *display,
- GLXDrawable drawable,
- int buffer);
-typedef void (*GLXQueryDrawableProc) (Display *display,
- GLXDrawable drawable,
- int attribute,
- unsigned int *value);
-
-typedef void (*GLXCopySubBufferProc) (Display *display,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height);
-
-typedef int (*GLXGetVideoSyncProc) (unsigned int *count);
-typedef int (*GLXWaitVideoSyncProc) (int divisor,
- int remainder,
- unsigned int *count);
-
-#ifndef GLX_VERSION_1_3
-typedef struct __GLXFBConfigRec *GLXFBConfig;
-#endif
-typedef GLXFBConfig *(*GLXGetFBConfigsProc) (Display *display,
- int screen,
- int *nElements);
-typedef int (*GLXGetFBConfigAttribProc) (Display *display,
- GLXFBConfig config,
- int attribute,
- int *value);
-typedef GLXPixmap (*GLXCreatePixmapProc) (Display *display,
- GLXFBConfig config,
- Pixmap pixmap,
- const int *attribList);
-
-typedef void (*GLActiveTextureProc) (GLenum texture);
-typedef void (*GLClientActiveTextureProc) (GLenum texture);
-typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
-
-typedef void (*GLGenProgramsProc) (GLsizei n,
- GLuint *programs);
-typedef void (*GLDeleteProgramsProc) (GLsizei n,
- GLuint *programs);
-typedef void (*GLBindProgramProc) (GLenum target,
- GLuint program);
-typedef void (*GLProgramStringProc) (GLenum target,
- GLenum format,
- GLsizei len,
- const GLvoid *string);
-typedef void (*GLProgramParameter4fProc) (GLenum target,
- GLuint index,
- GLfloat x,
- GLfloat y,
- GLfloat z,
- GLfloat w);
-typedef void (*GLGetProgramivProc) (GLenum target,
- GLenum pname,
- int *params);
-
-typedef void (*GLGenFramebuffersProc) (GLsizei n,
- GLuint *framebuffers);
-typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
- GLuint *framebuffers);
-typedef void (*GLBindFramebufferProc) (GLenum target,
- GLuint framebuffer);
-typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
-typedef void (*GLFramebufferTexture2DProc) (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level);
-typedef void (*GLGenerateMipmapProc) (GLenum target);
-
-struct CompScreenPaintAttrib {
- GLfloat xRotate;
- GLfloat yRotate;
- GLfloat vRotate;
- GLfloat xTranslate;
- GLfloat yTranslate;
- GLfloat zTranslate;
- GLfloat zCamera;
-};
-
-extern CompScreenPaintAttrib defaultScreenPaintAttrib;
struct CompGroup {
unsigned int refCnt;
@@ -161,19 +46,6 @@ struct CompStartupSequence {
unsigned int viewportY;
};
-#define MAX_DEPTH 32
-
-struct CompFBConfig {
- GLXFBConfig fbConfig;
- int yInverted;
- int mipmap;
- int textureFormat;
- int textureTargets;
-};
-
-#define NOTHING_TRANS_FILTER 0
-#define SCREEN_TRANS_FILTER 1
-#define WINDOW_TRANS_FILTER 2
#define SCREEN_EDGE_LEFT 0
#define SCREEN_EDGE_RIGHT 1
@@ -205,30 +77,10 @@ class ScreenInterface : public WrapableInterface<CompScreen> {
public:
ScreenInterface ();
- WRAPABLE_DEF(void, preparePaint, int);
- WRAPABLE_DEF(void, donePaint);
- WRAPABLE_DEF(void, paint, CompOutput::ptrList &outputs, unsigned int);
-
- WRAPABLE_DEF(bool, paintOutput, const CompScreenPaintAttrib *,
- const CompTransform *, Region, CompOutput *,
- unsigned int);
- WRAPABLE_DEF(void, paintTransformedOutput,
- const CompScreenPaintAttrib *,
- const CompTransform *, Region, CompOutput *,
- unsigned int);
- WRAPABLE_DEF(void, applyTransform, const CompScreenPaintAttrib *,
- CompOutput *, CompTransform *);
-
- WRAPABLE_DEF(void, enableOutputClipping, const CompTransform *,
- Region, CompOutput *);
- WRAPABLE_DEF(void, disableOutputClipping);
-
WRAPABLE_DEF(void, enterShowDesktopMode);
WRAPABLE_DEF(void, leaveShowDesktopMode, CompWindow *);
WRAPABLE_DEF(void, outputChangeNotify);
-
- WRAPABLE_DEF(CompWindowList, getWindowPaintList);
};
@@ -255,6 +107,9 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
Window
root ();
+ XWindowAttributes
+ attrib ();
+
int
screenNum ();
@@ -268,9 +123,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
showingDesktopMask ();
bool
- handlePaintTimeout ();
-
- bool
setOption (const char *name,
CompOption::Value &value);
@@ -302,30 +154,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
updateWorkareaForScreen ();
void
- setDefaultViewport ();
-
- void
- damageScreen ();
-
- FuncPtr
- getProcAddress (const char *name);
-
- void
- showOutputWindow ();
-
- void
- hideOutputWindow ();
-
- void
- updateOutputWindow ();
-
- void
- damageRegion (Region);
-
- void
- damagePending ();
-
- void
forEachWindow (CompWindow::ForEach);
void
@@ -399,11 +227,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
void
sendWindowActivationRequest (Window id);
- void
- setTexEnvMode (GLenum mode);
-
- void
- setLighting (bool lighting);
void
enableEdge (int edge);
@@ -414,12 +237,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
Window
getTopWindow ();
- void
- makeCurrent ();
-
- void
- finishDrawing ();
-
int
outputDeviceForPoint (int x, int y);
@@ -435,8 +252,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
void
getWorkareaForOutput (int output, XRectangle *area);
- void
- clearOutput (CompOutput *output, unsigned int mask);
void
viewportForGeometry (CompWindow::Geometry gm,
@@ -455,21 +270,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
void
addToCurrentActiveWindowHistory (Window id);
- void
- setWindowPaintOffset (int x, int y);
-
- int
- getTimeToNextRedraw (struct timeval *tv);
-
- void
- waitForVideoSync ();
-
- int
- maxTextureSize ();
-
- unsigned int
- damageMask ();
-
CompPoint vp ();
CompSize vpSize ();
@@ -479,15 +279,15 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
unsigned int &
pendingDestroys ();
+ void
+ removeDestroyed ();
+
unsigned int &
mapNum ();
int &
desktopWindowCount ();
- int &
- overlayWindowCount ();
-
CompOutput::vector &
outputDevs ();
@@ -506,106 +306,23 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
CompScreenEdge &
screenEdge (int);
- Window
- overlay ();
-
unsigned int &
activeNum ();
- void
- handleExposeEvent (XExposeEvent *event);
-
- void
- detectRefreshRate ();
-
- void
- updateBackground ();
-
- bool
- textureNonPowerOfTwo ();
-
- bool
- textureCompression ();
-
- bool
- canDoSaturated ();
-
- bool
- canDoSlightlySaturated ();
-
- bool
- lighting ();
-
- CompTexture::Filter
- filter (int);
-
- CompFragment::Storage *
- fragmentStorage ();
+ Region region ();
- bool
- fragmentProgram ();
+ bool hasOverlappingOutputs ();
- bool
- framebufferObject ();
-
- CompFBConfig * glxPixmapFBConfig (unsigned int depth);
+ CompOutput & fullscreenOutput ();
static int allocPrivateIndex ();
static void freePrivateIndex (int index);
- WRAPABLE_HND(void, preparePaint, int);
- WRAPABLE_HND(void, donePaint);
- WRAPABLE_HND(void, paint, CompOutput::ptrList &outputs, unsigned int);
-
- WRAPABLE_HND(bool, paintOutput, const CompScreenPaintAttrib *,
- const CompTransform *, Region, CompOutput *,
- unsigned int);
- WRAPABLE_HND(void, paintTransformedOutput,
- const CompScreenPaintAttrib *,
- const CompTransform *, Region, CompOutput *,
- unsigned int);
- WRAPABLE_HND(void, applyTransform, const CompScreenPaintAttrib *,
- CompOutput *, CompTransform *);
-
- WRAPABLE_HND(void, enableOutputClipping, const CompTransform *,
- Region, CompOutput *);
- WRAPABLE_HND(void, disableOutputClipping);
-
WRAPABLE_HND(void, enterShowDesktopMode);
WRAPABLE_HND(void, leaveShowDesktopMode, CompWindow *);
WRAPABLE_HND(void, outputChangeNotify);
- WRAPABLE_HND(CompWindowList, getWindowPaintList);
-
- GLXBindTexImageProc bindTexImage;
- GLXReleaseTexImageProc releaseTexImage;
- GLXQueryDrawableProc queryDrawable;
- GLXCopySubBufferProc copySubBuffer;
- GLXGetVideoSyncProc getVideoSync;
- GLXWaitVideoSyncProc waitVideoSync;
- GLXGetFBConfigsProc getFBConfigs;
- GLXGetFBConfigAttribProc getFBConfigAttrib;
- GLXCreatePixmapProc createPixmap;
-
- GLActiveTextureProc activeTexture;
- GLClientActiveTextureProc clientActiveTexture;
- GLMultiTexCoord2fProc multiTexCoord2f;
-
- GLGenProgramsProc genPrograms;
- GLDeleteProgramsProc deletePrograms;
- GLBindProgramProc bindProgram;
- GLProgramStringProc programString;
- GLProgramParameter4fProc programEnvParameter4f;
- GLProgramParameter4fProc programLocalParameter4f;
- GLGetProgramivProc getProgramiv;
-
- GLGenFramebuffersProc genFramebuffers;
- GLDeleteFramebuffersProc deleteFramebuffers;
- GLBindFramebufferProc bindFramebuffer;
- GLCheckFramebufferStatusProc checkFramebufferStatus;
- GLFramebufferTexture2DProc framebufferTexture2D;
- GLGenerateMipmapProc generateMipmap;
private:
PrivateScreen *priv;
@@ -630,12 +347,6 @@ class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
CompOption::Vector &options);
static bool
- toggleSlowAnimations (CompDisplay *d,
- CompAction *action,
- CompAction::State state,
- CompOption::Vector &options);
-
- static bool
windowMenu (CompDisplay *d,
CompAction *action,
CompAction::State state,
diff --git a/include/compvector.h b/include/compvector.h
deleted file mode 100644
index 17e9403..0000000
--- a/include/compvector.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _COMPVECTOR_H
-#define _COMPVECTOR_H
-
-class CompVector {
- public:
- typedef enum {
- x,
- y,
- z,
- w
- } VectorCoordsEnum;
-
- CompVector ();
- CompVector (float x, float y, float z, float w);
-
- float& operator[] (int item);
- float& operator[] (VectorCoordsEnum coord);
-
- const float operator[] (int item) const;
- const float operator[] (VectorCoordsEnum coord) const;
-
- CompVector& operator+= (const CompVector& rhs);
- CompVector& operator-= (const CompVector& rhs);
- CompVector& operator*= (const float k);
- CompVector& operator/= (const float k);
- CompVector& operator^= (const CompVector& rhs);
-
- float norm ();
- CompVector& normalize ();
-
- private:
- friend CompVector operator+ (const CompVector& lhs,
- const CompVector& rhs);
- friend CompVector operator- (const CompVector& lhs,
- const CompVector& rhs);
- friend CompVector operator- (const CompVector& vector);
- friend float operator* (const CompVector& lhs,
- const CompVector& rhs);
- friend CompVector operator* (const float k,
- const CompVector& vector);
- friend CompVector operator* (const CompVector& vector,
- const float k);
- friend CompVector operator/ (const CompVector& lhs,
- const CompVector& rhs);
- friend CompVector operator^ (const CompVector& lhs,
- const CompVector& rhs);
-
- float v[4];
-};
-
-#endif
diff --git a/include/compwindow.h b/include/compwindow.h
index 56a6132..a76597d 100644
--- a/include/compwindow.h
+++ b/include/compwindow.h
@@ -3,20 +3,16 @@
#include <boost/function.hpp>
+#include <X11/Xlib-xcb.h>
+#include <X11/Xutil.h>
#include <X11/Xregion.h>
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/sync.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-
#include <compaction.h>
#include <compobject.h>
#include <compsize.h>
#include <comppoint.h>
-#include <comptexture.h>
-#include <compfragment.h>
-#include <compmatrix.h>
#include <wrapable.h>
@@ -173,15 +169,7 @@ struct CompStartupSequence;
#define CompWindowGrabMoveMask (1 << 2)
#define CompWindowGrabResizeMask (1 << 3)
-struct CompWindowPaintAttrib {
- GLushort opacity;
- GLushort brightness;
- GLushort saturation;
- GLfloat xScale;
- GLfloat yScale;
- GLfloat xTranslate;
- GLfloat yTranslate;
-};
+
enum CompStackingUpdateMode {
CompStackingUpdateModeNone = 0,
@@ -191,6 +179,16 @@ enum CompStackingUpdateMode {
CompStackingUpdateModeInitialMapDeniedFocus
};
+enum CompWindowNotify {
+ CompWindowNotifyMap,
+ CompWindowNotifyUnmap,
+ CompWindowNotifyRestack,
+ CompWindowNotifyHide,
+ CompWindowNotifyShow,
+ CompWindowNotifyAliveChanged,
+ CompWindowNotifySyncAlarm
+};
+
struct CompWindowExtents {
int left;
int right;
@@ -209,17 +207,6 @@ class WindowInterface : public WrapableInterface<CompWindow> {
public:
WindowInterface ();
- WRAPABLE_DEF(bool, paint, const CompWindowPaintAttrib *,
- const CompTransform *, Region, unsigned int);
- WRAPABLE_DEF(bool, draw, const CompTransform *,
- CompFragment::Attrib &, Region, unsigned int);
- WRAPABLE_DEF(void, addGeometry, CompTexture::Matrix *matrix,
- int, Region, Region);
- WRAPABLE_DEF(void, drawTexture, CompTexture *texture,
- CompFragment::Attrib &, unsigned int);
- WRAPABLE_DEF(void, drawGeometry);
- WRAPABLE_DEF(bool, damageRect, bool, BoxPtr);
-
WRAPABLE_DEF(void, getOutputExtents, CompWindowExtents *);
WRAPABLE_DEF(void, getAllowedActions, unsigned int *,
unsigned int *);
@@ -232,6 +219,7 @@ class WindowInterface : public WrapableInterface<CompWindow> {
WRAPABLE_DEF(void, resizeNotify, int, int, int, int);
WRAPABLE_DEF(void, moveNotify, int, int, bool);
+ WRAPABLE_DEF(void, windowNotify, CompWindowNotify);
WRAPABLE_DEF(void, grabNotify, int, int,
unsigned int, unsigned int);
WRAPABLE_DEF(void, ungrabNotify);
@@ -259,7 +247,7 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
unsigned int mBorder;
};
- static CompWindowPaintAttrib defaultPaintAttrib;
+
typedef boost::function<void (CompWindow *)> ForEach;
@@ -312,8 +300,7 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
void
handlePing (int lastPing);
- bool
- overlayWindow ();
+
Region
region ();
@@ -399,28 +386,6 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
void
updateWindowOutputExtents ();
- bool
- bind ();
-
- void
- release ();
-
- void
- damageTransformedRect (float xScale,
- float yScale,
- float xTranslate,
- float yTranslate,
- BoxPtr rect);
-
- void
- damageOutputExtents ();
-
- void
- addDamageRect (BoxPtr rect);
-
- void
- addDamage ();
-
void
updateRegion ();
@@ -532,12 +497,6 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
Time timestamp);
void
- unredirect ();
-
- void
- redirect ();
-
- void
defaultViewport (int *vx, int *vy);
CompIcon *
@@ -591,17 +550,13 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
CompWindowExtents
input ();
+ CompWindowExtents
+ output ();
+
XSizeHints
sizeHints ();
- void
- updateOpacity ();
-
- void
- updateBrightness ();
- void
- updateSaturation ();
void
updateMwmHints ();
@@ -612,8 +567,7 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
void
processMap ();
- void
- processDamage (XDamageNotifyEvent *de);
+
XSyncAlarm
syncAlarm ();
@@ -621,26 +575,18 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
bool
destroyed ();
- bool
- damaged ();
bool
invisible ();
bool
- redirected ();
+ syncWait ();
- Region
- clip ();
+ bool alpha ();
- CompWindowPaintAttrib &
- paintAttrib ();
+ bool alive ();
- bool
- moreVertices (int newSize);
- bool
- moreIndices (int newSize);
static unsigned int
constrainWindowState (unsigned int state,
@@ -656,19 +602,6 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
static int allocPrivateIndex ();
static void freePrivateIndex (int index);
- WRAPABLE_HND(bool, paint, const CompWindowPaintAttrib *,
- const CompTransform *, Region, unsigned int);
- WRAPABLE_HND(bool, draw, const CompTransform *,
- CompFragment::Attrib &, Region, unsigned int);
- WRAPABLE_HND(void, addGeometry, CompTexture::Matrix *matrix,
- int, Region, Region);
- WRAPABLE_HND(void, drawTexture, CompTexture *texture,
- CompFragment::Attrib &, unsigned int);
- WRAPABLE_HND(void, drawGeometry);
-
-
- WRAPABLE_HND(bool, damageRect, bool, BoxPtr);
-
WRAPABLE_HND(void, getOutputExtents, CompWindowExtents *);
WRAPABLE_HND(void, getAllowedActions, unsigned int *,
unsigned int *);
@@ -681,6 +614,7 @@ class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
WRAPABLE_HND(void, resizeNotify, int, int, int, int);
WRAPABLE_HND(void, moveNotify, int, int, bool);
+ WRAPABLE_HND(void, windowNotify, CompWindowNotify);
WRAPABLE_HND(void, grabNotify, int, int,
unsigned int, unsigned int);
WRAPABLE_HND(void, ungrabNotify);
diff --git a/include/compfragment.h b/include/opengl/fragment.h
index fdeda74..04dda6f 100644
--- a/include/compfragment.h
+++ b/include/opengl/fragment.h
@@ -1,5 +1,5 @@
-#ifndef _COMPFRAGMENT_H
-#define _COMPFRAGMENT_H
+#ifndef _GLFRAGMENT_H
+#define _GLFRAGMENT_H
#define MAX_FRAGMENT_FUNCTIONS 16
@@ -7,9 +7,10 @@
#define COMP_FETCH_TARGET_RECT 1
#define COMP_FETCH_TARGET_NUM 2
-struct CompWindowPaintAttrib;
+struct GLWindowPaintAttrib;
+class GLScreen;
-namespace CompFragment {
+namespace GLFragment {
class Storage;
@@ -40,7 +41,7 @@ namespace CompFragment {
void addBlendOp (const char *str, ...);
- FunctionId createFragmentFunction (CompScreen *s,const char *name);
+ FunctionId createFragmentFunction (GLScreen *s,const char *name);
private:
PrivateFunctionData *priv;
@@ -48,7 +49,7 @@ namespace CompFragment {
class Attrib {
public:
- Attrib (const CompWindowPaintAttrib *paint);
+ Attrib (const GLWindowPaintAttrib &paint);
Attrib (const Attrib&);
~Attrib ();
@@ -58,8 +59,8 @@ namespace CompFragment {
void addFunction (FunctionId function);
- bool enable (CompScreen *s, bool *blending);
- void disable (CompScreen *s);
+ bool enable (GLScreen *s, bool *blending);
+ void disable (GLScreen *s);
unsigned short getSaturation ();
unsigned short getBrightness ();
@@ -75,11 +76,11 @@ namespace CompFragment {
PrivateAttrib *priv;
};
- void destroyFragmentFunction (CompScreen *s, FunctionId id);
+ void destroyFragmentFunction (GLScreen *s, FunctionId id);
- FunctionId getSaturateFragmentFunction (CompScreen *s,
- CompTexture *texture,
- int param);
+ FunctionId getSaturateFragmentFunction (GLScreen *s,
+ GLTexture *texture,
+ int param);
};
diff --git a/include/opengl/matrix.h b/include/opengl/matrix.h
new file mode 100644
index 0000000..8d3b801
--- /dev/null
+++ b/include/opengl/matrix.h
@@ -0,0 +1,38 @@
+#ifndef _GLMATRIX_H
+#define _GLMATRIX_H
+
+#include <opengl/vector.h>
+
+class CompOutput;
+
+class GLMatrix {
+ public:
+ GLMatrix ();
+
+ const float* getMatrix () const;
+
+ GLMatrix& operator*= (const GLMatrix& rhs);
+
+ void reset ();
+ void toScreenSpace (CompOutput *output, float z);
+
+ void rotate (const float angle, const float x,
+ const float y, const float z);
+ void rotate (const float angle, const GLVector& vector);
+
+ void scale (const float x, const float y, const float z);
+ void scale (const GLVector& vector);
+
+ void translate (const float x, const float y, const float z);
+ void translate (const GLVector& vector);
+
+ private:
+ friend GLMatrix operator* (const GLMatrix& lhs,
+ const GLMatrix& rhs);
+ friend GLVector operator* (const GLMatrix& lhs,
+ const GLVector& rhs);
+
+ float m[16];
+};
+
+#endif
diff --git a/include/opengl/opengl.h b/include/opengl/opengl.h
new file mode 100644
index 0000000..dcd8272
--- /dev/null
+++ b/include/opengl/opengl.h
@@ -0,0 +1,345 @@
+#ifndef _COMPIZ_OPENGL_H
+#define _COMPIZ_OPENGL_H
+
+#include <GL/gl.h>
+#include <GL/glx.h>
+
+#include <opengl/matrix.h>
+#include <opengl/texture.h>
+#include <opengl/fragment.h>
+
+#define COMPIZ_OPENGL_ABI 1
+
+#define PLUGIN OpenGL
+#include <compprivatehandler.h>
+
+class PrivateGLDisplay;
+class PrivateGLScreen;
+class PrivateGLWindow;
+
+class GLDisplay :
+ public OpenGLPrivateHandler<GLDisplay, CompDisplay, COMPIZ_OPENGL_ABI>
+{
+ public:
+ GLDisplay (CompDisplay *d);
+ ~GLDisplay ();
+
+ CompOption::Vector & getOptions ();
+ bool setOption (const char *name, CompOption::Value &value);
+
+ GLenum textureFilter ();
+
+ void clearTargetOutput (unsigned int mask);
+
+ private:
+ PrivateGLDisplay *priv;
+};
+
+
+extern GLushort defaultColor[4];
+
+#ifndef GLX_EXT_texture_from_pixmap
+#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
+#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
+#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
+#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
+#define GLX_Y_INVERTED_EXT 0x20D4
+#define GLX_TEXTURE_FORMAT_EXT 0x20D5
+#define GLX_TEXTURE_TARGET_EXT 0x20D6
+#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
+#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
+#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
+#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
+#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
+#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
+#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
+#define GLX_TEXTURE_1D_EXT 0x20DB
+#define GLX_TEXTURE_2D_EXT 0x20DC
+#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
+#define GLX_FRONT_LEFT_EXT 0x20DE
+#endif
+
+typedef void (*FuncPtr) (void);
+typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
+
+typedef void (*GLXBindTexImageProc) (Display *display,
+ GLXDrawable drawable,
+ int buffer,
+ int *attribList);
+typedef void (*GLXReleaseTexImageProc) (Display *display,
+ GLXDrawable drawable,
+ int buffer);
+typedef void (*GLXQueryDrawableProc) (Display *display,
+ GLXDrawable drawable,
+ int attribute,
+ unsigned int *value);
+
+typedef void (*GLXCopySubBufferProc) (Display *display,
+ GLXDrawable drawable,
+ int x,
+ int y,
+ int width,
+ int height);
+
+typedef int (*GLXGetVideoSyncProc) (unsigned int *count);
+typedef int (*GLXWaitVideoSyncProc) (int divisor,
+ int remainder,
+ unsigned int *count);
+
+#ifndef GLX_VERSION_1_3
+typedef struct __GLXFBConfigRec *GLXFBConfig;
+#endif
+
+typedef GLXFBConfig *(*GLXGetFBConfigsProc) (Display *display,
+ int screen,
+ int *nElements);
+typedef int (*GLXGetFBConfigAttribProc) (Display *display,
+ GLXFBConfig config,
+ int attribute,
+ int *value);
+typedef GLXPixmap (*GLXCreatePixmapProc) (Display *display,
+ GLXFBConfig config,
+ Pixmap pixmap,
+ const int *attribList);
+
+typedef void (*GLActiveTextureProc) (GLenum texture);
+typedef void (*GLClientActiveTextureProc) (GLenum texture);
+typedef void (*GLMultiTexCoord2fProc) (GLenum, GLfloat, GLfloat);
+
+typedef void (*GLGenProgramsProc) (GLsizei n,
+ GLuint *programs);
+typedef void (*GLDeleteProgramsProc) (GLsizei n,
+ GLuint *programs);
+typedef void (*GLBindProgramProc) (GLenum target,
+ GLuint program);
+typedef void (*GLProgramStringProc) (GLenum target,
+ GLenum format,
+ GLsizei len,
+ const GLvoid *string);
+typedef void (*GLProgramParameter4fProc) (GLenum target,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+typedef void (*GLGetProgramivProc) (GLenum target,
+ GLenum pname,
+ int *params);
+
+typedef void (*GLGenFramebuffersProc) (GLsizei n,
+ GLuint *framebuffers);
+typedef void (*GLDeleteFramebuffersProc) (GLsizei n,
+ GLuint *framebuffers);
+typedef void (*GLBindFramebufferProc) (GLenum target,
+ GLuint framebuffer);
+typedef GLenum (*GLCheckFramebufferStatusProc) (GLenum target);
+typedef void (*GLFramebufferTexture2DProc) (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+typedef void (*GLGenerateMipmapProc) (GLenum target);
+
+struct GLScreenPaintAttrib {
+ GLfloat xRotate;
+ GLfloat yRotate;
+ GLfloat vRotate;
+ GLfloat xTranslate;
+ GLfloat yTranslate;
+ GLfloat zTranslate;
+ GLfloat zCamera;
+};
+
+#define MAX_DEPTH 32
+
+struct GLFBConfig {
+ GLXFBConfig fbConfig;
+ int yInverted;
+ int mipmap;
+ int textureFormat;
+ int textureTargets;
+};
+
+#define NOTHING_TRANS_FILTER 0
+#define SCREEN_TRANS_FILTER 1
+#define WINDOW_TRANS_FILTER 2
+
+
+extern GLScreenPaintAttrib defaultScreenPaintAttrib;
+
+class GLScreen;
+
+class GLScreenInterface : public WrapableInterface<GLScreen> {
+ public:
+ GLScreenInterface ();
+
+ WRAPABLE_DEF(bool, glPaintOutput, const GLScreenPaintAttrib &,
+ const GLMatrix &, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_DEF(void, glPaintTransformedOutput,
+ const GLScreenPaintAttrib &,
+ const GLMatrix &, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_DEF(void, glApplyTransform, const GLScreenPaintAttrib &,
+ CompOutput *, GLMatrix *);
+
+ WRAPABLE_DEF(void, glEnableOutputClipping, const GLMatrix &,
+ Region, CompOutput *);
+ WRAPABLE_DEF(void, glDisableOutputClipping);
+
+};
+
+
+class GLScreen :
+ public WrapableHandler<GLScreenInterface>,
+ public OpenGLPrivateHandler<GLScreen, CompScreen, COMPIZ_OPENGL_ABI>
+{
+ public:
+ GLScreen (CompScreen *s);
+ ~GLScreen ();
+
+ CompOption::Vector & getOptions ();
+ bool setOption (const char *name, CompOption::Value &value);
+ CompOption * getOption (const char *name);
+
+ FuncPtr getProcAddress (const char *name);
+
+ void updateBackground ();
+
+ int maxTextureSize ();
+ bool textureNonPowerOfTwo ();
+ bool textureCompression ();
+ bool canDoSaturated ();
+ bool canDoSlightlySaturated ();
+ bool fragmentProgram ();
+ bool framebufferObject ();
+
+ GLTexture::Filter filter (int);
+
+ GLFragment::Storage * fragmentStorage ();
+
+ void setTexEnvMode (GLenum mode);
+ void setLighting (bool lighting);
+ bool lighting ();
+
+ void makeCurrent ();
+
+ void clearOutput (CompOutput *output, unsigned int mask);
+
+ void setDefaultViewport ();
+
+ GLFBConfig * glxPixmapFBConfig (unsigned int depth);
+
+ WRAPABLE_HND(bool, glPaintOutput, const GLScreenPaintAttrib &,
+ const GLMatrix &, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_HND(void, glPaintTransformedOutput,
+ const GLScreenPaintAttrib &,
+ const GLMatrix &, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_HND(void, glApplyTransform, const GLScreenPaintAttrib &,
+ CompOutput *, GLMatrix *);
+
+ WRAPABLE_HND(void, glEnableOutputClipping, const GLMatrix &,
+ Region, CompOutput *);
+ WRAPABLE_HND(void, glDisableOutputClipping);
+
+ GLXBindTexImageProc bindTexImage;
+ GLXReleaseTexImageProc releaseTexImage;
+ GLXQueryDrawableProc queryDrawable;
+ GLXCopySubBufferProc copySubBuffer;
+ GLXGetVideoSyncProc getVideoSync;
+ GLXWaitVideoSyncProc waitVideoSync;
+ GLXGetFBConfigsProc getFBConfigs;
+ GLXGetFBConfigAttribProc getFBConfigAttrib;
+ GLXCreatePixmapProc createPixmap;
+
+ GLActiveTextureProc activeTexture;
+ GLClientActiveTextureProc clientActiveTexture;
+ GLMultiTexCoord2fProc multiTexCoord2f;
+
+ GLGenProgramsProc genPrograms;
+ GLDeleteProgramsProc deletePrograms;
+ GLBindProgramProc bindProgram;
+ GLProgramStringProc programString;
+ GLProgramParameter4fProc programEnvParameter4f;
+ GLProgramParameter4fProc programLocalParameter4f;
+ GLGetProgramivProc getProgramiv;
+
+ GLGenFramebuffersProc genFramebuffers;
+ GLDeleteFramebuffersProc deleteFramebuffers;
+ GLBindFramebufferProc bindFramebuffer;
+ GLCheckFramebufferStatusProc checkFramebufferStatus;
+ GLFramebufferTexture2DProc framebufferTexture2D;
+ GLGenerateMipmapProc generateMipmap;
+
+ private:
+ PrivateGLScreen *priv;
+};
+
+struct GLWindowPaintAttrib {
+ GLushort opacity;
+ GLushort brightness;
+ GLushort saturation;
+ GLfloat xScale;
+ GLfloat yScale;
+ GLfloat xTranslate;
+ GLfloat yTranslate;
+};
+
+class GLWindow;
+
+class GLWindowInterface : public WrapableInterface<GLWindow> {
+ public:
+ GLWindowInterface ();
+
+ WRAPABLE_DEF(bool, glPaint, const GLWindowPaintAttrib &,
+ const GLMatrix &, Region, unsigned int);
+ WRAPABLE_DEF(bool, glDraw, const GLMatrix &,
+ GLFragment::Attrib &, Region, unsigned int);
+ WRAPABLE_DEF(void, glAddGeometry, GLTexture::Matrix *matrix,
+ int, Region, Region);
+ WRAPABLE_DEF(void, glDrawTexture, GLTexture *texture,
+ GLFragment::Attrib &, unsigned int);
+ WRAPABLE_DEF(void, glDrawGeometry);
+};
+
+class GLWindow :
+ public WrapableHandler<GLWindowInterface>,
+ public OpenGLPrivateHandler<GLWindow, CompWindow, COMPIZ_OPENGL_ABI>
+{
+ public:
+ static GLWindowPaintAttrib defaultPaintAttrib;
+ public:
+
+ GLWindow (CompWindow *w);
+ ~GLWindow ();
+
+ Region clip ();
+
+ GLWindowPaintAttrib & paintAttrib ();
+
+ bool moreVertices (int newSize);
+
+ bool moreIndices (int newSize);
+
+ bool bind ();
+ void release ();
+
+ void updatePaintAttribs ();
+
+ WRAPABLE_HND(bool, glPaint, const GLWindowPaintAttrib &,
+ const GLMatrix &, Region, unsigned int);
+ WRAPABLE_HND(bool, glDraw, const GLMatrix &,
+ GLFragment::Attrib &, Region, unsigned int);
+ WRAPABLE_HND(void, glAddGeometry, GLTexture::Matrix *matrix,
+ int, Region, Region);
+ WRAPABLE_HND(void, glDrawTexture, GLTexture *texture,
+ GLFragment::Attrib &, unsigned int);
+ WRAPABLE_HND(void, glDrawGeometry);
+
+ private:
+ PrivateGLWindow *priv;
+};
+
+#endif
diff --git a/include/comptexture.h b/include/opengl/texture.h
index 7bc3ba5..ae8746c 100644
--- a/include/comptexture.h
+++ b/include/opengl/texture.h
@@ -1,5 +1,5 @@
-#ifndef _COMPTEXTURE_H
-#define _COMPTEXTURE_H
+#ifndef _GLTEXTURE_H
+#define _GLTEXTURE_H
#include <X11/Xlib-xcb.h>
@@ -21,7 +21,7 @@
class CompScreen;
class PrivateTexture;
-class CompTexture {
+class GLTexture {
public:
typedef enum {
@@ -36,46 +36,43 @@ class CompTexture {
} Matrix;
public:
- CompTexture (CompScreen *);
- ~CompTexture ();
+ GLTexture (CompScreen *);
+ ~GLTexture ();
+ void reset ();
+
GLuint name ();
GLenum target ();
- void damage ();
-
Matrix & matrix ();
-
- void reset ();
- bool bindPixmap (Pixmap pixmap, int width, int height, int depth);
+ void damage ();
+ bool bindPixmap (Pixmap pixmap, int width, int height, int depth);
void releasePixmap ();
-
+ bool hasPixmap ();
+
void enable (Filter filter);
-
void disable ();
- bool hasPixmap ();
- static bool imageBufferToTexture (CompTexture *texture,
+ static bool imageBufferToTexture (GLTexture *texture,
const char *image,
unsigned int width,
unsigned int height);
- static bool imageDataToTexture (CompTexture *texture,
+ static bool imageDataToTexture (GLTexture *texture,
const char *image,
unsigned int width,
unsigned int height,
GLenum format,
GLenum type);
- static bool
- readImageToTexture (CompScreen *screen,
- CompTexture *texture,
- const char *imageFileName,
- unsigned int *returnWidth,
- unsigned int *returnHeight);
+ static bool readImageToTexture (CompScreen *screen,
+ GLTexture *texture,
+ const char *imageFileName,
+ unsigned int *returnWidth,
+ unsigned int *returnHeight);
private:
diff --git a/include/opengl/vector.h b/include/opengl/vector.h
new file mode 100644
index 0000000..3a92c8e
--- /dev/null
+++ b/include/opengl/vector.h
@@ -0,0 +1,51 @@
+#ifndef _GLVECTOR_H
+#define _GLVECTOR_H
+
+class GLVector {
+ public:
+ typedef enum {
+ x,
+ y,
+ z,
+ w
+ } VectorCoordsEnum;
+
+ GLVector ();
+ GLVector (float x, float y, float z, float w);
+
+ float& operator[] (int item);
+ float& operator[] (VectorCoordsEnum coord);
+
+ const float operator[] (int item) const;
+ const float operator[] (VectorCoordsEnum coord) const;
+
+ GLVector& operator+= (const GLVector& rhs);
+ GLVector& operator-= (const GLVector& rhs);
+ GLVector& operator*= (const float k);
+ GLVector& operator/= (const float k);
+ GLVector& operator^= (const GLVector& rhs);
+
+ float norm ();
+ GLVector& normalize ();
+
+ private:
+ friend GLVector operator+ (const GLVector& lhs,
+ const GLVector& rhs);
+ friend GLVector operator- (const GLVector& lhs,
+ const GLVector& rhs);
+ friend GLVector operator- (const GLVector& vector);
+ friend float operator* (const GLVector& lhs,
+ const GLVector& rhs);
+ friend GLVector operator* (const float k,
+ const GLVector& vector);
+ friend GLVector operator* (const GLVector& vector,
+ const float k);
+ friend GLVector operator/ (const GLVector& lhs,
+ const GLVector& rhs);
+ friend GLVector operator^ (const GLVector& lhs,
+ const GLVector& rhs);
+
+ float v[4];
+};
+
+#endif
diff --git a/metadata/Makefile.am b/metadata/Makefile.am
index a73ac20..60066de 100644
--- a/metadata/Makefile.am
+++ b/metadata/Makefile.am
@@ -28,7 +28,9 @@ xml_in_files = \
video.xml.in \
water.xml.in \
wobbly.xml.in \
- zoom.xml.in
+ zoom.xml.in \
+ composite.xml.in \
+ opengl.xml.in
xml_files = $(xml_in_files:.xml.in=.xml)
xml_DATA = $(xml_files)
diff --git a/metadata/composite.xml.in b/metadata/composite.xml.in
new file mode 100644
index 0000000..4ab5d0b
--- /dev/null
+++ b/metadata/composite.xml.in
@@ -0,0 +1,36 @@
+<compiz>
+ <plugin name="composite">
+ <_short>Composite</_short>
+ <_long>Composite plugin</_long>
+ <display>
+ <option name="slow_animations_key" type="key">
+ <_short>Slow Animations</_short>
+ <_long>Toggle use of slow animations</_long>
+ </option>
+ </display>
+ <screen>
+ <option name="detect_refresh_rate" type="bool">
+ <_short>Detect Refresh Rate</_short>
+ <_long>Automatic detection of refresh rate</_long>
+ <default>true</default>
+ </option>
+ <option name="refresh_rate" type="int">
+ <_short>Refresh Rate</_short>
+ <_long>The rate at which the screen is redrawn (times/second)</_long>
+ <default>50</default>
+ <min>1</min>
+ <max>200</max>
+ </option>
+ <option name="unredirect_fullscreen_windows" type="bool">
+ <_short>Unredirect Fullscreen Windows</_short>
+ <_long>Allow drawing of fullscreen windows to not be redirected to offscreen pixmaps</_long>
+ <default>false</default>
+ </option>
+ <option name="force_independent_output_painting" type="bool">
+ <_short>Force independent output painting.</_short>
+ <_long>Paint each output device independly, even if the output devices overlap</_long>
+ <default>false</default>
+ </option>
+ </screen>
+ </plugin>
+</compiz>
diff --git a/metadata/core.xml.in b/metadata/core.xml.in
index 5b72bfb..61c0947 100644
--- a/metadata/core.xml.in
+++ b/metadata/core.xml.in
@@ -11,25 +11,6 @@
<value>core</value>
</default>
</option>
- <option name="texture_filter" type="int">
- <_short>Texture Filter</_short>
- <_long>Texture filtering</_long>
- <default>1</default>
- <min>0</min>
- <max>2</max>
- <desc>
- <value>0</value>
- <_name>Fast</_name>
- </desc>
- <desc>
- <value>1</value>
- <_name>Good</_name>
- </desc>
- <desc>
- <value>2</value>
- <_name>Best</_name>
- </desc>
- </option>
<option name="click_to_focus" type="bool">
<_short>Click To Focus</_short>
<_long>Click on window moves input focus to it</_long>
@@ -181,10 +162,6 @@
<_short>Run command 11</_short>
<_long>A keybinding that when invoked, will run the shell command identified by command11</_long>
</option>
- <option name="slow_animations_key" type="key">
- <_short>Slow Animations</_short>
- <_long>Toggle use of slow animations</_long>
- </option>
<option name="raise_window_key" type="key">
<_short>Raise Window</_short>
<_long>Raise window above other windows</_long>
@@ -329,23 +306,6 @@
</option>
</display>
<screen>
- <option name="detect_refresh_rate" type="bool">
- <_short>Detect Refresh Rate</_short>
- <_long>Automatic detection of refresh rate</_long>
- <default>true</default>
- </option>
- <option name="lighting" type="bool">
- <_short>Lighting</_short>
- <_long>Use diffuse light when screen is transformed</_long>
- <default>true</default>
- </option>
- <option name="refresh_rate" type="int">
- <_short>Refresh Rate</_short>
- <_long>The rate at which the screen is redrawn (times/second)</_long>
- <default>50</default>
- <min>1</min>
- <max>200</max>
- </option>
<option name="hsize" type="int">
<_short>Horizontal Virtual Size</_short>
<_long>Screen size multiplier for horizontal virtual size</_long>
@@ -360,21 +320,11 @@
<min>1</min>
<max>32</max>
</option>
- <option name="unredirect_fullscreen_windows" type="bool">
- <_short>Unredirect Fullscreen Windows</_short>
- <_long>Allow drawing of fullscreen windows to not be redirected to offscreen pixmaps</_long>
- <default>false</default>
- </option>
<option name="default_icon" type="string">
<_short>Default Icon</_short>
<_long>Default window icon image</_long>
<default>icon</default>
</option>
- <option name="sync_to_vblank" type="bool">
- <_short>Sync To VBlank</_short>
- <_long>Only perform screen updates during vertical blanking period</_long>
- <default>true</default>
- </option>
<option name="number_of_desktops" type="int">
<_short>Number of Desktops</_short>
<_long>Number of virtual desktops</_long>
@@ -414,11 +364,6 @@
<_name>Prefer smaller output</_name>
</desc>
</option>
- <option name="force_independent_output_painting" type="bool">
- <_short>Force independent output painting.</_short>
- <_long>Paint each output device independly, even if the output devices overlap</_long>
- <default>false</default>
- </option>
<option name="focus_prevention_level" type="int">
<_short>Focus Prevention Level</_short>
<_long>Level of focus stealing prevention</_long>
@@ -447,11 +392,6 @@
<_long>Focus prevention windows</_long>
<default>any</default>
</option>
- <option name="texture_compression" type="bool">
- <_short>Texture Compression</_short>
- <_long>If available use compression for textures converted from images</_long>
- <default>true</default>
- </option>
</screen>
</core>
</compiz>
diff --git a/metadata/opengl.xml.in b/metadata/opengl.xml.in
new file mode 100644
index 0000000..7ce29c9
--- /dev/null
+++ b/metadata/opengl.xml.in
@@ -0,0 +1,44 @@
+<compiz>
+ <plugin name="opengl">
+ <_short>OpenGL</_short>
+ <_long>OpenGL Plugin</_long>
+ <display>
+ <option name="texture_filter" type="int">
+ <_short>Texture Filter</_short>
+ <_long>Texture filtering</_long>
+ <default>1</default>
+ <min>0</min>
+ <max>2</max>
+ <desc>
+ <value>0</value>
+ <_name>Fast</_name>
+ </desc>
+ <desc>
+ <value>1</value>
+ <_name>Good</_name>
+ </desc>
+ <desc>
+ <value>2</value>
+ <_name>Best</_name>
+ </desc>
+ </option>
+ </display>
+ <screen>
+ <option name="lighting" type="bool">
+ <_short>Lighting</_short>
+ <_long>Use diffuse light when screen is transformed</_long>
+ <default>true</default>
+ </option>
+ <option name="sync_to_vblank" type="bool">
+ <_short>Sync To VBlank</_short>
+ <_long>Only perform screen updates during vertical blanking period</_long>
+ <default>true</default>
+ </option>
+ <option name="texture_compression" type="bool">
+ <_short>Texture Compression</_short>
+ <_long>If available use compression for textures converted from images</_long>
+ <default>true</default>
+ </option>
+ </screen>
+ </plugin>
+</compiz>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 94055f7..f0cfc24 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = composite opengl
+
# libfade_la_LDFLAGS = -module -avoid-version -no-undefined
# libfade_la_SOURCES = fade.cpp
#
@@ -20,6 +22,9 @@ libzoom_la_SOURCES = zoom.cpp
# libminimize_la_SOURCES = minimize.cpp
libmove_la_LDFLAGS = -module -avoid-version -no-undefined
+libmove_la_LIBADD = \
+ $(top_builddir)/plugins/composite/libcomposite.la \
+ $(top_builddir)/plugins/opengl/libopengl.la
libmove_la_SOURCES = move.cpp
libresize_la_LDFLAGS = -module -avoid-version -no-undefined
diff --git a/plugins/composite/Makefile.am b/plugins/composite/Makefile.am
new file mode 100644
index 0000000..eb49acc
--- /dev/null
+++ b/plugins/composite/Makefile.am
@@ -0,0 +1,26 @@
+libcomposite_la_LDFLAGS = -avoid-version -no-undefined
+libcomposite_la_SOURCES = composite.cpp display.cpp screen.cpp window.cpp
+
+INCLUDES = \
+ @COMPIZ_CFLAGS@ \
+ @LIBPNG_CFLAGS@ \
+ @LIBRSVG_CFLAGS@ \
+ @ANNOTATE_CFLAGS@ \
+ @GCONF_CFLAGS@ \
+ @KCONFIG_CFLAGS@ \
+ @DBUS_CFLAGS@ \
+ @GLIB_CFLAGS@ \
+ @FUSE_CFLAGS@ \
+ -DFUSE_USE_VERSION=26 \
+ -DALL_LINGUAS="\"@ALL_LINGUAS@\"" \
+ -DLOCALEDIR="\"@datadir@/locale\"" \
+ -DPLUGINDIR=\"$(plugindir)\" \
+ -DIMAGEDIR=\"$(imagedir)\" \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -DMETADATADIR=\"$(metadatadir)\"
+
+moduledir = $(plugindir)
+
+module_LTLIBRARIES = \
+ libcomposite.la
diff --git a/plugins/composite/composite.cpp b/plugins/composite/composite.cpp
new file mode 100644
index 0000000..e44d8bb
--- /dev/null
+++ b/plugins/composite/composite.cpp
@@ -0,0 +1,282 @@
+#include <compiz-core.h>
+#include <composite/composite.h>
+
+#include "privates.h"
+
+CompMetadata *compositeMetadata = NULL;
+
+class CompositePluginVTable : public CompPlugin::VTable
+{
+ public:
+
+ const char * name () { return "composite"; };
+
+ CompMetadata * getMetadata ();
+
+ bool init ();
+ void fini ();
+
+ bool initObject (CompObject *object);
+ void finiObject (CompObject *object);
+
+ CompOption::Vector & getObjectOptions (CompObject *object);
+
+ bool setObjectOption (CompObject *object,
+ const char *name,
+ CompOption::Value &value);
+};
+
+const CompMetadata::OptionInfo
+ compositeDisplayOptionInfo[COMPOSITE_DISPLAY_OPTION_NUM] = {
+ { "slow_animations_key", "key", 0,
+ CompositeScreen::toggleSlowAnimations, 0 }
+};
+
+const CompMetadata::OptionInfo
+ compositeScreenOptionInfo[COMPOSITE_SCREEN_OPTION_NUM] = {
+ { "detect_refresh_rate", "bool", 0, 0, 0 },
+ { "refresh_rate", "int", "<min>1</min>", 0, 0 },
+ { "unredirect_fullscreen_windows", "bool", 0, 0, 0 },
+ { "force_independent_output_painting", "bool", 0, 0, 0 }
+};
+
+CompOption::Vector &
+CompositeDisplay::getOptions ()
+{
+ return priv->opt;
+}
+
+CompOption::Vector &
+CompositeScreen::getOptions ()
+{
+ return priv->opt;
+}
+
+CompOption *
+CompositeScreen::getOption (const char *name)
+{
+ CompOption *o = CompOption::findOption (priv->opt, name);
+ return o;
+}
+
+bool
+CompositeDisplay::setOption (const char *name,
+ CompOption::Value &value)
+{
+ CompOption *o;
+ unsigned int index;
+
+ o = CompOption::findOption (priv->opt, name, &index);
+ if (!o)
+ return false;
+
+ return CompOption::setDisplayOption (priv->display, *o, value);
+}
+
+
+bool
+CompositeScreen::setOption (const char *name,
+ CompOption::Value &value)
+{
+ CompOption *o;
+ unsigned int index;
+
+ o = CompOption::findOption (priv->opt, name, &index);
+ if (!o)
+ return false;
+
+ switch (index) {
+ case COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE:
+ if (o->set (value))
+ {
+ if (value.b ())
+ detectRefreshRate ();
+
+ return true;
+ }
+ break;
+ case COMPOSITE_SCREEN_OPTION_REFRESH_RATE:
+ if (priv->opt[COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE].
+ value ().b ())
+ return false;
+ if (o->set (value))
+ {
+ priv->redrawTime = 1000 / o->value ().i ();
+ priv->optimalRedrawTime = priv->redrawTime;
+ return true;
+ }
+ break;
+ default:
+ if (CompOption::setScreenOption (priv->screen, *o, value))
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+
+
+
+bool
+CompositePluginVTable::initObject (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ {
+ CompositeDisplay *d =
+ new CompositeDisplay (GET_CORE_DISPLAY (o));
+ if (!d)
+ return false;
+ if (d->loadFailed ())
+ {
+ delete d;
+ return false;
+ }
+ return true;
+ }
+ break;
+ case COMP_OBJECT_TYPE_SCREEN:
+ {
+ CompositeScreen *s =
+ new CompositeScreen (GET_CORE_SCREEN (o));
+ if (!s)
+ return false;
+ if (s->loadFailed ())
+ {
+ delete s;
+ return false;
+ }
+ return true;
+ }
+ break;
+ case COMP_OBJECT_TYPE_WINDOW:
+ {
+ CompositeWindow *w =
+ new CompositeWindow (GET_CORE_WINDOW (o));
+ if (!w)
+ return false;
+ if (w->loadFailed ())
+ {
+ delete w;
+ return false;
+ }
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+void
+CompositePluginVTable::finiObject (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ {
+ CompositeDisplay *d =
+ CompositeDisplay::get (GET_CORE_DISPLAY (o));
+ if (d)
+ delete d;
+ }
+ break;
+ case COMP_OBJECT_TYPE_SCREEN:
+ {
+ CompositeScreen *s =
+ CompositeScreen::get (GET_CORE_SCREEN (o));
+ if (s)
+ delete s;
+ }
+ break;
+ case COMP_OBJECT_TYPE_WINDOW:
+ {
+ CompositeWindow *w =
+ CompositeWindow::get (GET_CORE_WINDOW (o));
+ if (w)
+ delete w;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+CompOption::Vector &
+CompositePluginVTable::getObjectOptions (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ return CompositeDisplay::get (GET_CORE_DISPLAY (o))->getOptions ();
+ case COMP_OBJECT_TYPE_SCREEN:
+ return CompositeScreen::get (GET_CORE_SCREEN (o))->getOptions ();
+ default:
+ break;
+ }
+ return noOptions;
+}
+
+bool
+CompositePluginVTable::setObjectOption (CompObject *o,
+ const char *name,
+ CompOption::Value &value)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ return CompositeDisplay::get (GET_CORE_DISPLAY (o))->
+ setOption (name, value);
+ case COMP_OBJECT_TYPE_SCREEN:
+ return CompositeScreen::get (GET_CORE_SCREEN (o))->
+ setOption (name, value);
+ default:
+ break;
+ }
+ return false;
+}
+
+bool
+CompositePluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
+ return false;
+
+ CompPrivate p;
+ p.uval = COMPIZ_COMPOSITE_ABI;
+ core->storeValue ("composite_ABI", p);
+
+ compositeMetadata = new CompMetadata
+ (name (), compositeDisplayOptionInfo, COMPOSITE_DISPLAY_OPTION_NUM,
+ compositeScreenOptionInfo, COMPOSITE_SCREEN_OPTION_NUM);
+
+ if (!compositeMetadata)
+ return false;
+
+ compositeMetadata->addFromFile (name ());
+
+ return true;
+}
+
+void
+CompositePluginVTable::fini ()
+{
+ delete compositeMetadata;
+}
+
+CompMetadata *
+CompositePluginVTable::getMetadata ()
+{
+ return compositeMetadata;
+}
+
+CompositePluginVTable compositeVTable;
+
+CompPlugin::VTable *
+getCompPluginInfo20080805 (void)
+{
+ return &compositeVTable;
+}
diff --git a/plugins/composite/display.cpp b/plugins/composite/display.cpp
new file mode 100644
index 0000000..eee63d1
--- /dev/null
+++ b/plugins/composite/display.cpp
@@ -0,0 +1,234 @@
+#include "privates.h"
+
+#include <X11/extensions/shape.h>
+#include <X11/extensions/Xrandr.h>
+
+CompWindow *lastDamagedWindow = 0;
+
+
+CompositeDisplay::CompositeDisplay (CompDisplay *d) :
+ CompositePrivateHandler<CompositeDisplay, CompDisplay,
+ COMPIZ_COMPOSITE_ABI> (d),
+ priv (new PrivateCompositeDisplay (d, this))
+{
+ int compositeMajor, compositeMinor;
+
+ if (!compositeMetadata->initDisplayOptions
+ (d, compositeDisplayOptionInfo,
+ COMPOSITE_DISPLAY_OPTION_NUM, priv->opt))
+ {
+ setFailed ();
+ return;
+ }
+
+ if (!XQueryExtension (d->dpy (),
+ COMPOSITE_NAME,
+ &priv->compositeOpcode,
+ &priv->compositeEvent,
+ &priv->compositeError))
+ {
+ compLogMessage (d, "core", CompLogLevelFatal,
+ "No composite extension");
+ setFailed ();
+ return;
+ }
+
+ XCompositeQueryVersion (d->dpy (), &compositeMajor, &compositeMinor);
+ if (compositeMajor == 0 && compositeMinor < 2)
+ {
+ compLogMessage (d, "core", CompLogLevelFatal,
+ "Old composite extension");
+ setFailed ();
+ return;
+ }
+
+ if (!XDamageQueryExtension (d->dpy (), &priv->damageEvent,
+ &priv->damageError))
+ {
+ compLogMessage (d, "core", CompLogLevelFatal,
+ "No damage extension");
+ setFailed ();
+ return;
+ }
+
+ if (!XFixesQueryExtension (d->dpy (), &priv->fixesEvent, &priv->fixesError))
+ {
+ compLogMessage (d, "core", CompLogLevelFatal,
+ "No fixes extension");
+ setFailed ();
+ return;
+ }
+
+ priv->shapeExtension = XShapeQueryExtension (d->dpy (), &priv->shapeEvent,
+ &priv->shapeError);
+ priv->randrExtension = XRRQueryExtension (d->dpy (), &priv->randrEvent,
+ &priv->randrError);
+}
+
+CompositeDisplay::~CompositeDisplay ()
+{
+ delete priv;
+}
+
+PrivateCompositeDisplay::PrivateCompositeDisplay (CompDisplay *d,
+ CompositeDisplay *cd) :
+ display (d),
+ cDisplay (cd),
+ opt (COMPOSITE_DISPLAY_OPTION_NUM)
+{
+ // Wrap handleEvent
+ d->add (this);
+ DisplayInterface::setHandler (d);
+}
+
+PrivateCompositeDisplay::~PrivateCompositeDisplay ()
+{
+}
+
+void
+PrivateCompositeDisplay::handleEvent (XEvent *event)
+{
+ CompScreen *s;
+ CompWindow *w;
+
+ switch (event->type) {
+
+ case CreateNotify:
+ s = display->findScreen (event->xcreatewindow.parent);
+ if (s)
+ {
+ /* The first time some client asks for the composite
+ * overlay window, the X server creates it, which causes
+ * an errorneous CreateNotify event. We catch it and
+ * ignore it. */
+ if (CompositeScreen::get (s)->overlay () ==
+ event->xcreatewindow.window)
+ return;
+ }
+ break;
+ case PropertyNotify:
+ if (event->xproperty.atom == display->atoms ().winOpacity)
+ {
+ w = display->findWindow (event->xproperty.window);
+ if (w)
+ CompositeWindow::get (w)->updateOpacity ();
+ }
+ else if (event->xproperty.atom == display->atoms ().winBrightness)
+ {
+ w = display->findWindow (event->xproperty.window);
+ if (w)
+ CompositeWindow::get (w)->updateBrightness ();
+ }
+ else if (event->xproperty.atom == display->atoms ().winSaturation)
+ {
+ w = display->findWindow (event->xproperty.window);
+ if (w)
+ CompositeWindow::get (w)->updateSaturation ();
+ }
+ break;
+ default:
+ if (shapeExtension &&
+ event->type == shapeEvent + ShapeNotify)
+ {
+ w = display->findWindow (((XShapeEvent *) event)->window);
+ if (w)
+ {
+ if (w->mapNum ())
+ {
+ CompositeWindow::get (w)->addDamage ();
+ }
+ }
+ }
+ break;
+ }
+
+ display->handleEvent (event);
+
+ switch (event->type) {
+ case Expose:
+ foreach (s, display->screens ())
+ CompositeScreen::get (s)->priv->
+ handleExposeEvent (&event->xexpose);
+ break;
+ case ClientMessage:
+ if (event->xclient.message_type == display->atoms ().winOpacity)
+ {
+ w = display->findWindow (event->xclient.window);
+ if (w && (w->type () & CompWindowTypeDesktopMask) == 0)
+ {
+ unsigned short opacity = event->xclient.data.l[0] >> 16;
+
+ display->setWindowProp32 (w->id (),
+ display->atoms ().winOpacity, opacity);
+ }
+ }
+ else if (event->xclient.message_type ==
+ display->atoms ().winBrightness)
+ {
+ w = display->findWindow (event->xclient.window);
+ if (w)
+ {
+ unsigned short brightness = event->xclient.data.l[0] >> 16;
+
+ display->setWindowProp32 (w->id (),
+ display->atoms ().winBrightness, brightness);
+ }
+ }
+ else if (event->xclient.message_type ==
+ display->atoms ().winSaturation)
+ {
+ w = display->findWindow (event->xclient.window);
+ if (w)
+ {
+ unsigned short saturation = event->xclient.data.l[0] >> 16;
+
+ display->setWindowProp32 (w->id (),
+ display->atoms ().winSaturation, saturation);
+ }
+ }
+ break;
+ default:
+ if (event->type == damageEvent + XDamageNotify)
+ {
+ XDamageNotifyEvent *de = (XDamageNotifyEvent *) event;
+
+ if (lastDamagedWindow && de->drawable == lastDamagedWindow->id ())
+ {
+ w = lastDamagedWindow;
+ }
+ else
+ {
+ w = display->findWindow (de->drawable);
+ if (w)
+ lastDamagedWindow = w;
+ }
+
+ if (w)
+ CompositeWindow::get (w)->processDamage (de);
+ }
+ else if (shapeExtension &&
+ event->type == shapeEvent + ShapeNotify)
+ {
+ w = display->findWindow (((XShapeEvent *) event)->window);
+ if (w)
+ {
+ if (w->mapNum ())
+ {
+ CompositeWindow::get (w)->addDamage ();
+ }
+ }
+ }
+ else if (randrExtension &&
+ event->type == randrEvent + RRScreenChangeNotify)
+ {
+ XRRScreenChangeNotifyEvent *rre;
+
+ rre = (XRRScreenChangeNotifyEvent *) event;
+
+ s = display->findScreen (rre->root);
+ if (s)
+ CompositeScreen::get (s)->detectRefreshRate ();
+ }
+ break;
+ }
+}
diff --git a/plugins/composite/privates.h b/plugins/composite/privates.h
new file mode 100644
index 0000000..b376346
--- /dev/null
+++ b/plugins/composite/privates.h
@@ -0,0 +1,148 @@
+#ifndef _COMPOSITE_PRIVATES_H
+#define _COMPOSITE_PRIVATES_H
+
+#include <composite/composite.h>
+
+#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR > 2
+#define USE_COW
+extern bool useCow;
+#endif
+
+#define COMPOSITE_DISPLAY_OPTION_SLOW_ANIMATIONS_KEY 0
+#define COMPOSITE_DISPLAY_OPTION_NUM 1
+
+#define COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE 0
+#define COMPOSITE_SCREEN_OPTION_REFRESH_RATE 1
+#define COMPOSITE_SCREEN_OPTION_UNREDIRECT_FS 2
+#define COMPOSITE_SCREEN_OPTION_FORCE_INDEPENDENT 3
+#define COMPOSITE_SCREEN_OPTION_NUM 4
+
+extern CompMetadata *compositeMetadata;
+extern const CompMetadata::OptionInfo
+ compositeDisplayOptionInfo[COMPOSITE_DISPLAY_OPTION_NUM];
+
+extern const CompMetadata::OptionInfo
+ compositeScreenOptionInfo[COMPOSITE_SCREEN_OPTION_NUM];
+
+extern CompWindow *lastDamagedWindow;
+
+class PrivateCompositeDisplay : public DisplayInterface
+{
+ public:
+ PrivateCompositeDisplay (CompDisplay *d, CompositeDisplay *cd);
+ ~PrivateCompositeDisplay ();
+
+ void handleEvent (XEvent *event);
+
+ public:
+ CompDisplay *display;
+ CompositeDisplay *cDisplay;
+
+ int compositeEvent, compositeError, compositeOpcode;
+ int damageEvent, damageError;
+ int fixesEvent, fixesError, fixesVersion;
+
+ bool shapeExtension;
+ int shapeEvent, shapeError;
+
+ bool randrExtension;
+ int randrEvent, randrError;
+
+ CompOption::Vector opt;
+};
+
+class PrivateCompositeScreen : ScreenInterface
+{
+ public:
+ PrivateCompositeScreen (CompScreen *s, CompositeScreen *cs);
+ ~PrivateCompositeScreen ();
+
+ void outputChangeNotify ();
+
+ void makeOutputWindow ();
+
+ bool init ();
+
+ void handleExposeEvent (XExposeEvent *event);
+
+ public:
+ CompScreen *screen;
+ CompositeScreen *cScreen;
+
+ Region damage;
+ unsigned long damageMask;
+
+ Window overlay;
+ Window output;
+
+ std::list <CompRect> exposeRects;
+
+ CompPoint windowPaintOffset;
+
+ int overlayWindowCount;
+
+ struct timeval lastRedraw;
+ int nextRedraw;
+ int redrawTime;
+ int optimalRedrawTime;
+ int frameStatus;
+ int timeMult;
+ bool idle;
+ int timeLeft;
+
+ bool slowAnimations;
+
+ CompCore::Timer paintTimer;
+
+ Region tmpRegion;
+
+ bool active;
+ CompositeScreen::PaintHandler *pHnd;
+
+ CompOption::Vector opt;
+};
+
+class PrivateCompositeWindow : WindowInterface
+{
+ public:
+ PrivateCompositeWindow (CompWindow *w, CompositeWindow *cw);
+ ~PrivateCompositeWindow ();
+
+ void windowNotify (CompWindowNotify n);
+ void resizeNotify (int dx, int dy, int dwidth, int dheight);
+ void moveNotify (int dx, int dy, bool now);
+
+ static void handleDamageRect (CompositeWindow *w,
+ int x,
+ int y,
+ int width,
+ int height);
+
+ public:
+
+ CompWindow *window;
+ CompositeWindow *cWindow;
+ CompScreen *screen;
+ CompositeScreen *cScreen;
+
+ Pixmap pixmap;
+
+ Damage damage;
+
+ bool damaged;
+ bool redirected;
+ bool overlayWindow;
+ bool bindFailed;
+
+ unsigned short opacity;
+ unsigned short brightness;
+ unsigned short saturation;
+
+ XRectangle *damageRects;
+ int sizeDamage;
+ int nDamage;
+
+
+};
+
+#endif
diff --git a/plugins/composite/screen.cpp b/plugins/composite/screen.cpp
new file mode 100644
index 0000000..5a55f78
--- /dev/null
+++ b/plugins/composite/screen.cpp
@@ -0,0 +1,760 @@
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
+#include <sys/time.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xproto.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/Xrandr.h>
+#include <X11/extensions/shape.h>
+
+#include "privates.h"
+
+CompositeScreen::CompositeScreen (CompScreen *s) :
+ CompositePrivateHandler<CompositeScreen, CompScreen,
+ COMPIZ_COMPOSITE_ABI> (s),
+ priv (new PrivateCompositeScreen (s, this))
+{
+ WRAPABLE_INIT_HND(preparePaint);
+ WRAPABLE_INIT_HND(donePaint);
+ WRAPABLE_INIT_HND(paint);
+ WRAPABLE_INIT_HND(getWindowPaintList);
+
+ priv->tmpRegion = XCreateRegion ();
+ if (!priv->tmpRegion)
+ {
+ setFailed ();
+ return;
+ }
+
+ priv->damage = XCreateRegion ();
+ if (!priv->damage)
+ {
+ setFailed ();
+ return;
+ }
+
+ if (!compositeMetadata->initScreenOptions
+ (s, compositeScreenOptionInfo, COMPOSITE_SCREEN_OPTION_NUM, priv->opt))
+ {
+ setFailed ();
+ return;
+ }
+
+ priv->makeOutputWindow ();
+
+ detectRefreshRate ();
+
+ priv->slowAnimations = false;
+
+ if (!priv->init ())
+ {
+ setFailed ();
+ }
+
+}
+
+CompositeScreen::~CompositeScreen ()
+{
+ priv->paintTimer.stop ();
+
+#ifdef USE_COW
+ if (useCow)
+ XCompositeReleaseOverlayWindow (priv->screen->display()->dpy (),
+ priv->screen->root ());
+#endif
+
+ if (priv->damage)
+ XDestroyRegion (priv->damage);
+
+ delete priv;
+}
+
+
+PrivateCompositeScreen::PrivateCompositeScreen (CompScreen *s,
+ CompositeScreen *cs) :
+ screen (s),
+ cScreen (cs),
+ damageMask (COMPOSITE_SCREEN_DAMAGE_ALL_MASK),
+ overlay (None),
+ output (None),
+ exposeRects (),
+ windowPaintOffset (0, 0),
+ overlayWindowCount (0),
+ nextRedraw (0),
+ redrawTime (1000 / 50),
+ optimalRedrawTime (1000 / 50),
+ frameStatus (0),
+ timeMult (1),
+ idle (true),
+ timeLeft (0),
+ slowAnimations (false),
+ tmpRegion (NULL),
+ active (false),
+ pHnd (NULL),
+ opt (COMPOSITE_SCREEN_OPTION_NUM)
+{
+ gettimeofday (&lastRedraw, 0);
+ // wrap outputChangeNotify
+ s->add (this);
+ ScreenInterface::setHandler (s);
+}
+
+PrivateCompositeScreen::~PrivateCompositeScreen ()
+{
+ if (tmpRegion)
+ XDestroyRegion (tmpRegion);
+}
+
+bool
+PrivateCompositeScreen::init ()
+{
+ Display *dpy = screen->display ()->dpy ();
+ Window newCmSnOwner = None;
+ Atom cmSnAtom = 0;
+ Time cmSnTimestamp = 0;
+ XEvent event;
+ XSetWindowAttributes attr;
+ Window currentCmSnOwner;
+ char buf[128];
+
+ sprintf (buf, "_NET_WM_CM_S%d", screen->screenNum ());
+ cmSnAtom = XInternAtom (dpy, buf, 0);
+
+ currentCmSnOwner = XGetSelectionOwner (dpy, cmSnAtom);
+
+ if (currentCmSnOwner != None)
+ {
+ if (!replaceCurrentWm)
+ {
+ compLogMessage (screen->display (), "composite",
+ CompLogLevelError,
+ "Screen %d on display \"%s\" already "
+ "has a compositing manager; try using the "
+ "--replace option to replace the current "
+ "compositing manager.",
+ screen->screenNum (), DisplayString (dpy));
+
+ return false;
+ }
+ }
+
+ attr.override_redirect = TRUE;
+ attr.event_mask = PropertyChangeMask;
+
+ newCmSnOwner =
+ XCreateWindow (dpy, XRootWindow (dpy, screen->screenNum ()),
+ -100, -100, 1, 1, 0,
+ CopyFromParent, CopyFromParent,
+ CopyFromParent,
+ CWOverrideRedirect | CWEventMask,
+ &attr);
+
+ XChangeProperty (dpy,
+ newCmSnOwner,
+ screen->display ()->atoms ().wmName,
+ screen->display ()->atoms ().utf8String, 8,
+ PropModeReplace,
+ (unsigned char *) PACKAGE,
+ strlen (PACKAGE));
+
+ XWindowEvent (dpy, newCmSnOwner, PropertyChangeMask, &event);
+
+ cmSnTimestamp = event.xproperty.time;
+
+
+ XSetSelectionOwner (dpy, cmSnAtom, newCmSnOwner, cmSnTimestamp);
+
+ if (XGetSelectionOwner (dpy, cmSnAtom) != newCmSnOwner)
+ {
+ compLogMessage (screen->display (), "composite", CompLogLevelError,
+ "Could not acquire compositing manager "
+ "selection on screen %d display \"%s\"",
+ screen->screenNum (), DisplayString (dpy));
+
+ return false;
+ }
+
+ return true;
+}
+
+
+bool
+CompositeScreen::registerPaintHandler (PaintHandler *pHnd)
+{
+ Display *dpy = priv->screen->display ()->dpy ();
+
+ if (priv->active)
+ return false;
+
+ CompDisplay::checkForError (dpy);
+
+ XCompositeRedirectSubwindows (dpy, priv->screen->root (),
+ CompositeRedirectManual);
+
+ priv->overlayWindowCount = 0;
+
+ if (CompDisplay::checkForError (dpy))
+ {
+ compLogMessage (priv->screen->display (), "composite",
+ CompLogLevelError,
+ "Another composite manager is already "
+ "running on screen: %d", priv->screen->screenNum ());
+
+ return false;
+ }
+
+ foreach (CompWindow *w, priv->screen->windows ())
+ {
+ CompositeWindow *cw = CompositeWindow::get (w);
+ cw->priv->overlayWindow = false;
+ cw->priv->redirected = true;
+ }
+
+ priv->pHnd = pHnd;
+ priv->active = true;
+
+ showOutputWindow ();
+
+ priv->paintTimer.start
+ (boost::bind(&CompositeScreen::handlePaintTimeout, this),
+ priv->optimalRedrawTime, MAXSHORT);
+ return true;
+}
+
+void
+CompositeScreen::unregisterPaintHandler ()
+{
+ Display *dpy = priv->screen->display ()->dpy ();
+
+ foreach (CompWindow *w, priv->screen->windows ())
+ {
+ CompositeWindow *cw = CompositeWindow::get (w);
+ cw->priv->overlayWindow = false;
+ cw->priv->redirected = false;
+ cw->release ();
+ }
+
+ priv->overlayWindowCount = 0;
+
+ XCompositeUnredirectSubwindows (dpy, priv->screen->root (),
+ CompositeRedirectManual);
+
+ priv->pHnd = NULL;
+ priv->active = false;
+ priv->paintTimer.stop ();
+
+ hideOutputWindow ();
+}
+
+bool
+CompositeScreen::compositingActive ()
+{
+ return priv->active;
+}
+
+void
+CompositeScreen::damageScreen ()
+{
+ if (priv->damageMask == 0)
+ priv->paintTimer.setTimes (priv->paintTimer.minLeft ());
+
+ priv->damageMask |= COMPOSITE_SCREEN_DAMAGE_ALL_MASK;
+ priv->damageMask &= ~COMPOSITE_SCREEN_DAMAGE_REGION_MASK;
+}
+
+void
+CompositeScreen::damageRegion (Region region)
+{
+ if (priv->damageMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
+ return;
+
+ if (priv->damageMask == 0)
+ priv->paintTimer.setTimes (priv->paintTimer.minLeft ());
+
+ XUnionRegion (priv->damage, region, priv->damage);
+
+ priv->damageMask |= COMPOSITE_SCREEN_DAMAGE_REGION_MASK;
+
+}
+
+void
+CompositeScreen::damagePending ()
+{
+ if (priv->damageMask == 0)
+ priv->paintTimer.setTimes (priv->paintTimer.minLeft ());
+
+ priv->damageMask |= COMPOSITE_SCREEN_DAMAGE_PENDING_MASK;
+}
+
+unsigned int
+CompositeScreen::damageMask ()
+{
+ return priv->damageMask;
+}
+
+void
+CompositeScreen::showOutputWindow ()
+{
+#ifdef USE_COW
+ if (useCow && priv->active)
+ {
+ Display *dpy = priv->screen->display ()->dpy ();
+ XserverRegion region;
+
+ region = XFixesCreateRegion (dpy, NULL, 0);
+
+ XFixesSetWindowShapeRegion (dpy,
+ priv->output,
+ ShapeBounding,
+ 0, 0, 0);
+ XFixesSetWindowShapeRegion (dpy,
+ priv->output,
+ ShapeInput,
+ 0, 0, region);
+
+ XFixesDestroyRegion (dpy, region);
+
+ damageScreen ();
+ }
+#endif
+
+}
+
+void
+CompositeScreen::hideOutputWindow ()
+{
+#ifdef USE_COW
+ if (useCow)
+ {
+ Display *dpy = priv->screen->display ()->dpy ();
+ XserverRegion region;
+
+ region = XFixesCreateRegion (dpy, NULL, 0);
+
+ XFixesSetWindowShapeRegion (dpy,
+ priv->output,
+ ShapeBounding,
+ 0, 0, region);
+
+ XFixesDestroyRegion (dpy, region);
+ }
+#endif
+
+}
+
+void
+CompositeScreen::updateOutputWindow ()
+{
+#ifdef USE_COW
+ if (useCow && priv->active)
+ {
+ Display *dpy = priv->screen->display ()->dpy ();
+ XserverRegion region;
+ static Region tmpRegion = NULL;
+
+ if (!tmpRegion)
+ {
+ tmpRegion = XCreateRegion ();
+ if (!tmpRegion)
+ return;
+ }
+
+ XSubtractRegion (priv->screen->region (), &emptyRegion, tmpRegion);
+
+
+ for (CompWindowList::reverse_iterator rit =
+ priv->screen->windows ().rbegin ();
+ rit != priv->screen->windows ().rend (); rit++)
+ if (CompositeWindow::get (*rit)->overlayWindow ())
+ {
+ XSubtractRegion (tmpRegion, (*rit)->region (), tmpRegion);
+ }
+
+ XShapeCombineRegion (dpy, priv->output, ShapeBounding,
+ 0, 0, tmpRegion, ShapeSet);
+
+
+ region = XFixesCreateRegion (dpy, NULL, 0);
+
+ XFixesSetWindowShapeRegion (dpy,
+ priv->output,
+ ShapeInput,
+ 0, 0, region);
+
+ XFixesDestroyRegion (dpy, region);
+ }
+#endif
+
+}
+
+void
+PrivateCompositeScreen::makeOutputWindow ()
+{
+#ifdef USE_COW
+ if (useCow)
+ {
+ overlay = XCompositeGetOverlayWindow (screen->display ()->dpy (),
+ screen->root ());
+ output = overlay;
+
+ XSelectInput (screen->display ()->dpy (), output, ExposureMask);
+ }
+ else
+#endif
+ output = overlay = screen->root ();
+
+ cScreen->hideOutputWindow ();
+}
+
+Window
+CompositeScreen::output ()
+{
+ return priv->output;
+}
+
+Window
+CompositeScreen::overlay ()
+{
+ return priv->overlay;
+}
+
+int &
+CompositeScreen::overlayWindowCount ()
+{
+ return priv->overlayWindowCount;
+}
+
+void
+CompositeScreen::setWindowPaintOffset (int x, int y)
+{
+ priv->windowPaintOffset = CompPoint (x, y);
+}
+
+CompPoint
+CompositeScreen::windowPaintOffset ()
+{
+ return priv->windowPaintOffset;
+}
+
+void
+CompositeScreen::detectRefreshRate ()
+{
+ if (!noDetection &&
+ priv->opt[COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE].value ().b ())
+ {
+ CompString name;
+ CompOption::Value value;
+
+ value.set ((int) 0);
+
+ if (priv->screen->display ()->XRandr())
+ {
+ XRRScreenConfiguration *config;
+
+ config = XRRGetScreenInfo (priv->screen->display ()->dpy (),
+ priv->screen->root ());
+ value.set ((int) XRRConfigCurrentRate (config));
+
+ XRRFreeScreenConfigInfo (config);
+ }
+
+ if (value.i () == 0)
+ value.set ((int) 50);
+
+ name = priv->opt[COMPOSITE_SCREEN_OPTION_REFRESH_RATE].name ();
+
+ priv->opt[COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE].value ().set (false);
+ core->setOptionForPlugin (priv->screen, "composite", name.c_str (), value);
+ priv->opt[COMPOSITE_SCREEN_OPTION_DETECT_REFRESH_RATE].value ().set (true);
+ }
+ else
+ {
+ priv->redrawTime = 1000 /
+ priv->opt[COMPOSITE_SCREEN_OPTION_REFRESH_RATE].value ().i ();
+ priv->optimalRedrawTime = priv->redrawTime;
+ }
+}
+
+int
+CompositeScreen::getTimeToNextRedraw (struct timeval *tv)
+{
+ int diff, next;
+
+ diff = TIMEVALDIFF (tv, &priv->lastRedraw);
+
+ /* handle clock rollback */
+ if (diff < 0)
+ diff = 0;
+
+ if (priv->idle || (priv->pHnd && priv->pHnd->hasVSync ()))
+ {
+ if (priv->timeMult > 1)
+ {
+ priv->frameStatus = -1;
+ priv->redrawTime = priv->optimalRedrawTime;
+ priv->timeMult--;
+ }
+ }
+ else
+ {
+ if (diff > priv->redrawTime)
+ {
+ if (priv->frameStatus > 0)
+ priv->frameStatus = 0;
+
+ next = priv->optimalRedrawTime * (priv->timeMult + 1);
+ if (diff > next)
+ {
+ priv->frameStatus--;
+ if (priv->frameStatus < -1)
+ {
+ priv->timeMult++;
+ priv->redrawTime = diff = next;
+ }
+ }
+ }
+ else if (diff < priv->redrawTime)
+ {
+ if (priv->frameStatus < 0)
+ priv->frameStatus = 0;
+
+ if (priv->timeMult > 1)
+ {
+ next = priv->optimalRedrawTime * (priv->timeMult - 1);
+ if (diff < next)
+ {
+ priv->frameStatus++;
+ if (priv->frameStatus > 4)
+ {
+ priv->timeMult--;
+ priv->redrawTime = next;
+ }
+ }
+ }
+ }
+ }
+ if (diff >= priv->redrawTime)
+ return 1;
+
+ return priv->redrawTime - diff;
+}
+
+bool
+CompositeScreen::handlePaintTimeout ()
+{
+ int timeDiff;
+ struct timeval tv;
+
+ gettimeofday (&tv, 0);
+
+ if (priv->damageMask)
+ {
+ if (priv->pHnd)
+ priv->pHnd->prepareDrawing ();
+
+ timeDiff = TIMEVALDIFF (&tv, &priv->lastRedraw);
+
+ /* handle clock rollback */
+ if (timeDiff < 0)
+ timeDiff = 0;
+
+ if (priv->slowAnimations)
+ {
+ preparePaint (priv->idle ? 2 : (timeDiff * 2) / priv->redrawTime);
+ }
+ else
+ preparePaint (priv->idle ? priv->redrawTime : timeDiff);
+
+ /* substract top most overlay window region */
+ if (priv->overlayWindowCount)
+ {
+ for (CompWindowList::reverse_iterator rit =
+ priv->screen->windows ().rbegin ();
+ rit != priv->screen->windows ().rend (); rit++)
+ {
+ CompWindow *w = (*rit);
+
+ if (w->destroyed () || w->invisible ())
+ continue;
+
+ if (!CompositeWindow::get (w)->redirected ())
+ XSubtractRegion (priv->damage, w->region (),
+ priv->damage);
+
+ break;
+ }
+
+ if (priv->damageMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
+ {
+ priv->damageMask &= ~COMPOSITE_SCREEN_DAMAGE_ALL_MASK;
+ priv->damageMask |= COMPOSITE_SCREEN_DAMAGE_REGION_MASK;
+ }
+ }
+
+ if (priv->damageMask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK)
+ {
+ XIntersectRegion (priv->damage, priv->screen->region (),
+ priv->tmpRegion);
+
+ if (priv->tmpRegion->numRects == 1 &&
+ priv->tmpRegion->rects->x1 == 0 &&
+ priv->tmpRegion->rects->y1 == 0 &&
+ priv->tmpRegion->rects->x2 ==
+ (int) priv->screen->size ().width () &&
+ priv->tmpRegion->rects->y2 ==
+ (int) priv->screen->size ().height ())
+ damageScreen ();
+ }
+
+ EMPTY_REGION (priv->damage);
+
+ int mask = priv->damageMask;
+ priv->damageMask = 0;
+
+ CompOutput::ptrList outputs (0);
+
+ if (priv->opt[COMPOSITE_SCREEN_OPTION_FORCE_INDEPENDENT].value ().b ()
+ || !priv->screen->hasOverlappingOutputs ())
+ {
+ foreach (CompOutput &o, priv->screen->outputDevs ())
+ outputs.push_back (&o);
+ }
+ else
+ outputs.push_back (&priv->screen->fullscreenOutput ());
+
+ paint (outputs, mask);
+
+ priv->lastRedraw = tv;
+
+ donePaint ();
+
+ foreach (CompWindow *w, priv->screen->windows ())
+ {
+ if (w->destroyed ())
+ {
+ CompositeWindow::get (w)->addDamage ();
+ break;
+ }
+ }
+
+ priv->idle = false;
+ }
+ else
+ {
+ priv->idle = true;
+ }
+
+ gettimeofday (&tv, 0);
+
+ priv->paintTimer.setTimes (getTimeToNextRedraw (&tv), MAXSHORT);
+ return true;
+}
+
+void
+CompositeScreen::preparePaint (int msSinceLastPaint)
+ WRAPABLE_HND_FUNC(preparePaint, msSinceLastPaint)
+
+void
+CompositeScreen::donePaint ()
+ WRAPABLE_HND_FUNC(donePaint)
+
+void
+CompositeScreen::paint (CompOutput::ptrList &outputs,
+ unsigned int mask)
+{
+ WRAPABLE_HND_FUNC(paint, outputs, mask)
+
+ if (priv->pHnd)
+ priv->pHnd->paintOutputs (outputs, mask, priv->tmpRegion);
+}
+
+CompWindowList
+CompositeScreen::getWindowPaintList ()
+{
+ WRAPABLE_HND_FUNC_RETURN (CompWindowList, getWindowPaintList)
+
+ return priv->screen->windows ();
+}
+
+void
+PrivateCompositeScreen::handleExposeEvent (XExposeEvent *event)
+{
+ if (output == event->window)
+ return;
+
+ exposeRects.push_back (CompRect (event->x, event->x + event->width,
+ event->y, event->y + event->height));
+
+ if (event->count == 0)
+ {
+ CompRect rect;
+ foreach (CompRect rect, exposeRects)
+ {
+ cScreen->damageRegion (rect.region ());
+ }
+ exposeRects.clear ();
+ }
+}
+
+void
+PrivateCompositeScreen::outputChangeNotify ()
+{
+ screen->outputChangeNotify ();
+#ifdef USE_COW
+ if (useCow)
+ XMoveResizeWindow (screen->display ()->dpy (), overlay, 0, 0,
+ screen->size ().width (), screen->size ().height ());
+#endif
+ cScreen->damageScreen ();
+}
+
+bool
+CompositeScreen::toggleSlowAnimations (CompDisplay *d,
+ CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options)
+{
+ CompScreen *s;
+ Window xid;
+
+ xid = CompOption::getIntOptionNamed (options, "root");
+ s = d->findScreen (xid);
+ if (s)
+ {
+ CompositeScreen *cs = CompositeScreen::get (s);
+ if (cs)
+ cs->priv->slowAnimations = !cs->priv->slowAnimations;
+ }
+
+ return true;
+}
+
+CompositeScreenInterface::CompositeScreenInterface ()
+{
+ WRAPABLE_INIT_FUNC(preparePaint);
+ WRAPABLE_INIT_FUNC(donePaint);
+ WRAPABLE_INIT_FUNC(paint);
+
+ WRAPABLE_INIT_FUNC(getWindowPaintList);
+}
+
+void
+CompositeScreenInterface::preparePaint (int msSinceLastPaint)
+ WRAPABLE_DEF_FUNC(preparePaint, msSinceLastPaint)
+
+void
+CompositeScreenInterface::donePaint ()
+ WRAPABLE_DEF_FUNC(donePaint)
+
+void
+CompositeScreenInterface::paint (CompOutput::ptrList &outputs,
+ unsigned int mask)
+ WRAPABLE_DEF_FUNC(paint, outputs, mask)
+
+CompWindowList
+CompositeScreenInterface::getWindowPaintList ()
+ WRAPABLE_DEF_FUNC_WITH_RETURN(CompWindowList (), getWindowPaintList)
diff --git a/plugins/composite/window.cpp b/plugins/composite/window.cpp
new file mode 100644
index 0000000..463876b
--- /dev/null
+++ b/plugins/composite/window.cpp
@@ -0,0 +1,622 @@
+#include "privates.h"
+
+CompositeWindow::CompositeWindow (CompWindow *w) :
+ CompositePrivateHandler<CompositeWindow, CompWindow,
+ COMPIZ_COMPOSITE_ABI> (w),
+ priv (new PrivateCompositeWindow (w, this))
+{
+ WRAPABLE_INIT_HND(damageRect);
+
+ CompDisplay *d = w->screen ()->display ();
+
+ if (w->attrib ().c_class != InputOnly)
+ {
+ priv->damage = XDamageCreate (d->dpy (), w->id (),
+ XDamageReportRawRectangles);
+ }
+ else
+ {
+ priv->damage = None;
+ }
+
+ priv->opacity = OPAQUE;
+ if (!(w->type () & CompWindowTypeDesktopMask))
+ priv->opacity = d->getWindowProp32 (w->id (),
+ d->atoms ().winOpacity, OPAQUE);
+
+ priv->brightness = d->getWindowProp32 (w->id (),
+ d->atoms ().winBrightness, BRIGHT);
+
+ priv->saturation = d->getWindowProp32 (w->id (),
+ d->atoms ().winSaturation, COLOR);
+
+ if (w->attrib ().map_state == IsViewable)
+ {
+ priv->damaged = true;
+ }
+}
+
+CompositeWindow::~CompositeWindow ()
+{
+
+ if (priv->damage)
+ XDamageDestroy (priv->screen->display ()->dpy (), priv->damage);
+
+ if (!priv->redirected)
+ {
+ priv->cScreen->overlayWindowCount ()--;
+
+ if (priv->cScreen->overlayWindowCount () < 1)
+ priv->cScreen->showOutputWindow ();
+ }
+
+ release ();
+
+ if (lastDamagedWindow == priv->window)
+ lastDamagedWindow = NULL;
+
+ delete priv;
+}
+
+PrivateCompositeWindow::PrivateCompositeWindow (CompWindow *w,
+ CompositeWindow *cw) :
+ window (w),
+ cWindow (cw),
+ screen (w->screen ()),
+ cScreen (CompositeScreen::get (screen)),
+ pixmap (None),
+ damage (None),
+ damaged (false),
+ redirected (cScreen->compositingActive ()),
+ overlayWindow (false),
+ bindFailed (false),
+ opacity (OPAQUE),
+ brightness (BRIGHT),
+ saturation (COLOR),
+ damageRects (0),
+ sizeDamage (0),
+ nDamage (0)
+{
+ w->add (this);
+ WindowInterface::setHandler (w);
+}
+
+PrivateCompositeWindow::~PrivateCompositeWindow ()
+{
+
+ if (sizeDamage)
+ free (damageRects);
+}
+
+bool
+CompositeWindow::bind ()
+{
+ if (!priv->cScreen->compositingActive ())
+ return false;
+
+ redirect ();
+ if (!priv->pixmap)
+ {
+ XWindowAttributes attr;
+
+ /* don't try to bind window again if it failed previously */
+ if (priv->bindFailed)
+ return false;
+
+ /* We have to grab the server here to make sure that window
+ is mapped when getting the window pixmap */
+ XGrabServer (priv->screen->display ()->dpy ());
+ XGetWindowAttributes (priv->screen->display ()->dpy (),
+ priv->window->id (), &attr);
+ if (attr.map_state != IsViewable)
+ {
+ XUngrabServer (priv->screen->display ()->dpy ());
+ priv->bindFailed = true;
+ return false;
+ }
+
+ priv->pixmap = XCompositeNameWindowPixmap
+ (priv->screen->display ()->dpy (), priv->window->id ());
+
+ XUngrabServer (priv->screen->display ()->dpy ());
+ }
+ return true;
+}
+
+void
+CompositeWindow::release ()
+{
+ if (priv->pixmap)
+ {
+ XFreePixmap (priv->screen->display ()->dpy (), priv->pixmap);
+ priv->pixmap = None;
+ }
+}
+
+Pixmap
+CompositeWindow::pixmap ()
+{
+ return priv->pixmap;
+}
+
+void
+CompositeWindow::redirect ()
+{
+ if (priv->redirected || !priv->cScreen->compositingActive ())
+ return;
+
+ XCompositeRedirectWindow (priv->screen->display ()->dpy (),
+ priv->window->id (),
+ CompositeRedirectManual);
+
+ priv->redirected = true;
+
+ if (priv->overlayWindow)
+ {
+ priv->cScreen->overlayWindowCount ()--;
+ priv->overlayWindow = false;
+ }
+
+ if (priv->cScreen->overlayWindowCount () < 1)
+ priv->cScreen->showOutputWindow ();
+ else
+ priv->cScreen->updateOutputWindow ();
+}
+
+void
+CompositeWindow::unredirect ()
+{
+ if (!priv->redirected || !priv->cScreen->compositingActive ())
+ return;
+
+ release ();
+
+ XCompositeUnredirectWindow (priv->screen->display ()->dpy (),
+ priv->window->id (),
+ CompositeRedirectManual);
+
+ priv->redirected = false;
+ priv->overlayWindow = true;
+ priv->cScreen->overlayWindowCount ()++;
+
+ if (priv->cScreen->overlayWindowCount () > 0)
+ priv->cScreen->updateOutputWindow ();
+}
+
+bool
+CompositeWindow::redirected ()
+{
+ return priv->redirected;
+}
+
+bool
+CompositeWindow::overlayWindow ()
+{
+ return priv->overlayWindow;
+}
+
+void
+CompositeWindow::damageTransformedRect (float xScale,
+ float yScale,
+ float xTranslate,
+ float yTranslate,
+ BoxPtr rect)
+{
+ REGION reg;
+
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
+
+ reg.extents.x1 = (short) (rect->x1 * xScale) - 1;
+ reg.extents.y1 = (short) (rect->y1 * yScale) - 1;
+ reg.extents.x2 = (short) (rect->x2 * xScale + 0.5f) + 1;
+ reg.extents.y2 = (short) (rect->y2 * yScale + 0.5f) + 1;
+
+ reg.extents.x1 += (short) xTranslate;
+ reg.extents.y1 += (short) yTranslate;
+ reg.extents.x2 += (short) (xTranslate + 0.5f);
+ reg.extents.y2 += (short) (yTranslate + 0.5f);
+
+ if (reg.extents.x2 > reg.extents.x1 && reg.extents.y2 > reg.extents.y1)
+ {
+ XWindowAttributes attrib = priv->window->attrib ();
+
+ reg.extents.x1 += attrib.x + attrib.border_width;
+ reg.extents.y1 += attrib.y + attrib.border_width;
+ reg.extents.x2 += attrib.x + attrib.border_width;
+ reg.extents.y2 += attrib.y + attrib.border_width;
+
+ priv->cScreen->damageRegion (&reg);
+ }
+}
+
+void
+CompositeWindow::damageOutputExtents ()
+{
+ if (priv->cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
+ return;
+
+ if (priv->window->shaded () ||
+ (priv->window->attrib ().map_state == IsViewable && priv->damaged))
+ {
+ BoxRec box;
+
+ XWindowAttributes attrib = priv->window->attrib ();
+ CompWindowExtents output = priv->window->output ();
+
+ /* top */
+ box.x1 = -output.left - attrib.border_width;
+ box.y1 = -output.top - attrib.border_width;
+ box.x2 = priv->window->width () + output.right - attrib.border_width;
+ box.y2 = -attrib.border_width;
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ addDamageRect (&box);
+
+ /* bottom */
+ box.y1 = priv->window->height () - attrib.border_width;
+ box.y2 = box.y1 + output.bottom - attrib.border_width;
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ addDamageRect (&box);
+
+ /* left */
+ box.x1 = -output.left - attrib.border_width;
+ box.y1 = -attrib.border_width;
+ box.x2 = -attrib.border_width;
+ box.y2 = priv->window->height () - attrib.border_width;
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ addDamageRect (&box);
+
+ /* right */
+ box.x1 = priv->window->width () - attrib.border_width;
+ box.x2 = box.x1 + output.right - attrib.border_width;
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ addDamageRect (&box);
+ }
+}
+
+void
+CompositeWindow::addDamageRect (BoxPtr rect)
+{
+ REGION region;
+
+ if (priv->cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
+ return;
+
+ region.extents = *rect;
+
+ if (!damageRect (false, &region.extents))
+ {
+ XWindowAttributes attrib = priv->window->attrib ();
+ region.extents.x1 += attrib.x + attrib.border_width;
+ region.extents.y1 += attrib.y + attrib.border_width;
+ region.extents.x2 += attrib.x + attrib.border_width;
+ region.extents.y2 += attrib.y + attrib.border_width;
+
+ region.rects = &region.extents;
+ region.numRects = region.size = 1;
+
+ priv->cScreen->damageRegion (&region);
+ }
+}
+
+void
+CompositeWindow::addDamage ()
+{
+ if (priv->cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
+ return;
+
+ if (priv->window->shaded () ||
+ (priv->window->attrib ().map_state == IsViewable && priv->damaged))
+ {
+ BoxRec box;
+
+ box.x1 = -priv->window->output ().left -
+ priv->window->attrib ().border_width;
+ box.y1 = -priv->window->output ().top -
+ priv->window->attrib ().border_width;
+ box.x2 = priv->window->width () +
+ priv->window->output ().right;
+ box.y2 = priv->window->height () + priv->window->output ().bottom;
+
+ addDamageRect (&box);
+ }
+}
+
+bool
+CompositeWindow::damaged ()
+{
+ return priv->damaged;
+}
+
+void
+CompositeWindow::processDamage (XDamageNotifyEvent *de)
+{
+ if (priv->window->syncWait ())
+ {
+ if (priv->nDamage == priv->sizeDamage)
+ {
+ priv->damageRects = (XRectangle *) realloc (priv->damageRects,
+ (priv->sizeDamage + 1) *
+ sizeof (XRectangle));
+ priv->sizeDamage += 1;
+ }
+
+ priv->damageRects[priv->nDamage].x = de->area.x;
+ priv->damageRects[priv->nDamage].y = de->area.y;
+ priv->damageRects[priv->nDamage].width = de->area.width;
+ priv->damageRects[priv->nDamage].height = de->area.height;
+ priv->nDamage++;
+ }
+ else
+ {
+ priv->handleDamageRect (this, de->area.x, de->area.y,
+ de->area.width, de->area.height);
+ }
+}
+
+void
+PrivateCompositeWindow::handleDamageRect (CompositeWindow *w,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ REGION region;
+ bool initial = false;
+
+ if (!w->priv->redirected)
+ return;
+
+ if (!w->priv->damaged)
+ {
+ w->priv->damaged = initial = true;
+ }
+
+ region.extents.x1 = x;
+ region.extents.y1 = y;
+ region.extents.x2 = region.extents.x1 + width;
+ region.extents.y2 = region.extents.y1 + height;
+
+ if (!w->damageRect (initial, &region.extents))
+ {
+ region.extents.x1 += w->priv->window->attrib ().x +
+ w->priv->window->attrib ().border_width;
+ region.extents.y1 += w->priv->window->attrib ().y +
+ w->priv->window->attrib ().border_width;
+ region.extents.x2 += w->priv->window->attrib ().x +
+ w->priv->window->attrib ().border_width;
+ region.extents.y2 += w->priv->window->attrib ().y +
+ w->priv->window->attrib ().border_width;
+
+ region.rects = &region.extents;
+ region.numRects = region.size = 1;
+
+ w->priv->cScreen->damageRegion (&region);
+ }
+
+ if (initial)
+ w->damageOutputExtents ();
+}
+
+void
+CompositeWindow::updateOpacity ()
+{
+ unsigned short opacity;
+
+ if (priv->window->type () & CompWindowTypeDesktopMask)
+ return;
+
+ opacity = priv->screen->display ()->getWindowProp32 (priv->window->id (),
+ priv->screen->display ()->atoms ().winOpacity, OPAQUE);
+
+ if (opacity != priv->opacity)
+ {
+ priv->opacity = opacity;
+ addDamage ();
+ }
+}
+
+void
+CompositeWindow::updateBrightness ()
+{
+ unsigned short brightness;
+
+ brightness = priv->screen->display ()->getWindowProp32 (priv->window->id (),
+ priv->screen->display ()->atoms ().winBrightness, BRIGHT);
+
+ if (brightness != priv->brightness)
+ {
+ priv->brightness = brightness;
+ addDamage ();
+ }
+}
+
+void
+CompositeWindow::updateSaturation ()
+{
+ unsigned short saturation;
+
+ saturation = priv->screen->display ()->getWindowProp32 (priv->window->id (),
+ priv->screen->display ()->atoms ().winSaturation, COLOR);
+
+ if (saturation != priv->saturation)
+ {
+ priv->saturation = saturation;
+ addDamage ();
+ }
+}
+
+unsigned short
+CompositeWindow::opacity ()
+{
+ return priv->opacity;
+}
+
+unsigned short
+CompositeWindow::brightness ()
+{
+ return priv->brightness;
+}
+
+unsigned short
+CompositeWindow::saturation ()
+{
+ return priv->saturation;
+}
+
+bool
+CompositeWindow::damageRect (bool initial,
+ BoxPtr rect)
+{
+ WRAPABLE_HND_FUNC_RETURN(bool, damageRect, initial, rect)
+ return false;
+}
+
+void
+PrivateCompositeWindow::windowNotify (CompWindowNotify n)
+{
+ switch (n)
+ {
+ case CompWindowNotifyMap:
+ bindFailed = false;
+ damaged = false;
+ break;
+ case CompWindowNotifyUnmap:
+ cWindow->addDamage ();
+ cWindow->release ();
+
+ if (!redirected && cScreen->compositingActive ())
+ cWindow->redirect ();
+ break;
+ case CompWindowNotifyRestack:
+ case CompWindowNotifyHide:
+ case CompWindowNotifyShow:
+ case CompWindowNotifyAliveChanged:
+ cWindow->addDamage ();
+ break;
+ case CompWindowNotifySyncAlarm:
+ {
+ XRectangle *rects;
+
+ rects = damageRects;
+ while (nDamage--)
+ {
+ PrivateCompositeWindow::handleDamageRect (cWindow,
+ rects[nDamage].x,
+ rects[nDamage].y,
+ rects[nDamage].width,
+ rects[nDamage].height);
+ }
+ break;
+ }
+ default:
+ break;
+
+ }
+
+ window->windowNotify (n);
+}
+
+void
+PrivateCompositeWindow::resizeNotify (int dx, int dy, int dwidth, int dheight)
+{
+ window->resizeNotify (dx, dy, dwidth, dheight);
+
+ Pixmap pixmap = None;
+
+ if (window->shaded () ||
+ (window->attrib ().map_state == IsViewable && damaged))
+ {
+ REGION region;
+
+ XWindowAttributes attrib = window->attrib ();
+ region.extents.x1 = attrib.x - window->output ().left - dx;
+ region.extents.y1 = attrib.y - window->output ().top - dy;
+ region.extents.x2 = attrib.x + window->width () +
+ window->output ().right - dx - dwidth;
+ region.extents.y2 = attrib.y + window->height () +
+ window->output ().bottom - dy - dheight;
+
+ region.rects = &region.extents;
+ region.numRects = region.size = 1;
+
+ cScreen->damageRegion (&region);
+ }
+
+ if (window->mapNum () && redirected)
+ {
+ unsigned int actualWidth, actualHeight, ui;
+ Window root;
+ Status result;
+ int i;
+
+ pixmap = XCompositeNameWindowPixmap (screen->display ()->dpy (),
+ window->id ());
+ result = XGetGeometry (screen->display ()->dpy (), pixmap, &root,
+ &i, &i, &actualWidth, &actualHeight,
+ &ui, &ui);
+
+ if (!result || (int) actualWidth != window->width () ||
+ (int) actualHeight != window->height ())
+ {
+ XFreePixmap (screen->display ()->dpy (), pixmap);
+ return;
+ }
+ }
+
+ cWindow->addDamage ();
+
+ cWindow->release ();
+ this->pixmap = pixmap;
+}
+
+void
+PrivateCompositeWindow::moveNotify (int dx, int dy, bool now)
+{
+ if (window->shaded () ||
+ (window->attrib ().map_state == IsViewable && damaged))
+ {
+ REGION region;
+
+ XWindowAttributes attrib = window->attrib ();
+ region.extents.x1 = attrib.x - window->output ().left - dx;
+ region.extents.y1 = attrib.y - window->output ().top - dy;
+ region.extents.x2 = attrib.x + window->width () +
+ window->output ().right - dx;
+ region.extents.y2 = attrib.y + window->height () +
+ window->output ().bottom - dy;
+
+
+
+ region.rects = &region.extents;
+ region.numRects = region.size = 1;
+
+ cScreen->damageRegion (&region);
+ }
+ cWindow->addDamage ();
+
+ window->moveNotify (dx, dy, now);
+}
+
+CompositeWindowInterface::CompositeWindowInterface ()
+{
+ WRAPABLE_INIT_FUNC(damageRect);
+}
+
+bool
+CompositeWindowInterface::damageRect (bool initial, BoxPtr rect)
+ WRAPABLE_DEF_FUNC_RETURN(damageRect, initial, rect)
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/move.cpp b/plugins/move.cpp
index 128ce82..ffa794c 100644
--- a/plugins/move.cpp
+++ b/plugins/move.cpp
@@ -32,6 +32,9 @@
#include <compiz-core.h>
#include <compprivatehandler.h>
+#include <composite/composite.h>
+#include <opengl/opengl.h>
+
static CompMetadata *moveMetadata;
class MovePluginVTable : public CompPlugin::VTable
@@ -129,14 +132,16 @@ class MoveDisplay :
GLushort moveOpacity;
};
-
-
class MoveScreen : public PrivateHandler<MoveScreen,CompScreen> {
public:
MoveScreen (CompScreen *screen) :
PrivateHandler<MoveScreen,CompScreen> (screen),
- screen (screen) {};
+ screen (screen) {
+ if (CompositeScreen::get (screen))
+ hasCompositing =
+ CompositeScreen::get (screen)->compositingActive ();
+ };
CompScreen *screen;
CompScreen::grabHandle grab;
@@ -147,26 +152,34 @@ class MoveScreen : public PrivateHandler<MoveScreen,CompScreen> {
int snapOffY;
int snapBackY;
+
+ bool hasCompositing;
};
class MoveWindow :
- public WindowInterface,
+ public GLWindowInterface,
public PrivateHandler<MoveWindow,CompWindow>
{
public:
MoveWindow (CompWindow *window) :
PrivateHandler<MoveWindow,CompWindow> (window),
- window (window)
+ window (window),
+ gWindow (GLWindow::get (window)),
+ cWindow (CompositeWindow::get (window))
{
- window->add (this);
- WindowInterface::setHandler (window);
+ if (gWindow)
+ {
+ gWindow->add (this);
+ GLWindowInterface::setHandler (gWindow);
+ }
};
- bool
- paint (const CompWindowPaintAttrib *, const CompTransform *, Region,
- unsigned int);
+ bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, Region,
+ unsigned int);
- CompWindow *window;
+ CompWindow *window;
+ GLWindow *gWindow;
+ CompositeWindow *cWindow;
};
#define MOVE_DISPLAY(d) \
@@ -277,7 +290,12 @@ moveInitiate (CompDisplay *d,
}
if (md->moveOpacity != OPAQUE)
- w->addDamage ();
+ {
+ MOVE_WINDOW (w);
+
+ if (mw->cWindow)
+ mw->cWindow->addDamage ();
+ }
}
}
@@ -317,7 +335,12 @@ moveTerminate (CompDisplay *d,
}
if (md->moveOpacity != OPAQUE)
- md->w->addDamage ();
+ {
+ MOVE_WINDOW (md->w);
+
+ if (mw->cWindow)
+ mw->cWindow->addDamage ();
+ }
md->w = 0;
md->releaseButton = 0;
@@ -606,7 +629,8 @@ moveHandleMotionEvent (CompScreen *s,
wY + dy - w->attrib ().y,
TRUE, FALSE);
- if (md->opt[MOVE_DISPLAY_OPTION_LAZY_POSITIONING].value ().b ())
+ if (md->opt[MOVE_DISPLAY_OPTION_LAZY_POSITIONING].value ().b () &&
+ MoveScreen::get (w->screen())->hasCompositing)
{
/* FIXME: This form of lazy positioning is broken and should
be replaced asap. Current code exists just to avoid a
@@ -788,13 +812,13 @@ MoveDisplay::handleEvent (XEvent *event)
}
bool
-MoveWindow::paint (const CompWindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
+MoveWindow::glPaint (const GLWindowPaintAttrib &attrib,
+ const GLMatrix &transform,
+ Region region,
+ unsigned int mask)
{
- CompWindowPaintAttrib sAttrib;
- bool status;
+ GLWindowPaintAttrib sAttrib = attrib;
+ bool status;
MOVE_SCREEN (window->screen ());
@@ -805,14 +829,11 @@ MoveWindow::paint (const CompWindowPaintAttrib *attrib,
if (md->w == window && md->moveOpacity != OPAQUE)
{
/* modify opacity of windows that are not active */
- sAttrib = *attrib;
- attrib = &sAttrib;
-
sAttrib.opacity = (sAttrib.opacity * md->moveOpacity) >> 16;
}
}
- status = window->paint (attrib, transform, region, mask);
+ status = gWindow->glPaint (sAttrib, transform, region, mask);
return status;
}
diff --git a/plugins/opengl/Makefile.am b/plugins/opengl/Makefile.am
new file mode 100644
index 0000000..f4b27f7
--- /dev/null
+++ b/plugins/opengl/Makefile.am
@@ -0,0 +1,36 @@
+libopengl_la_LDFLAGS = -avoid-version -no-undefined
+libopengl_la_LIBADD = $(top_builddir)/plugins/composite/libcomposite.la
+libopengl_la_SOURCES = \
+ opengl.cpp \
+ display.cpp \
+ screen.cpp \
+ window.cpp \
+ paint.cpp \
+ matrix.cpp \
+ vector.cpp \
+ texture.cpp \
+ fragment.cpp
+
+INCLUDES = \
+ @COMPIZ_CFLAGS@ \
+ @LIBPNG_CFLAGS@ \
+ @LIBRSVG_CFLAGS@ \
+ @ANNOTATE_CFLAGS@ \
+ @GCONF_CFLAGS@ \
+ @KCONFIG_CFLAGS@ \
+ @DBUS_CFLAGS@ \
+ @GLIB_CFLAGS@ \
+ @FUSE_CFLAGS@ \
+ -DFUSE_USE_VERSION=26 \
+ -DALL_LINGUAS="\"@ALL_LINGUAS@\"" \
+ -DLOCALEDIR="\"@datadir@/locale\"" \
+ -DPLUGINDIR=\"$(plugindir)\" \
+ -DIMAGEDIR=\"$(imagedir)\" \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -DMETADATADIR=\"$(metadatadir)\"
+
+moduledir = $(plugindir)
+
+module_LTLIBRARIES = \
+ libopengl.la
diff --git a/plugins/opengl/display.cpp b/plugins/opengl/display.cpp
new file mode 100644
index 0000000..e8ec03c
--- /dev/null
+++ b/plugins/opengl/display.cpp
@@ -0,0 +1,77 @@
+#include "privates.h"
+
+GLushort defaultColor[4] = { 0xffff, 0xffff, 0xffff, 0xffff };
+
+GLDisplay::GLDisplay (CompDisplay *d) :
+ OpenGLPrivateHandler<GLDisplay, CompDisplay, COMPIZ_OPENGL_ABI> (d),
+ priv (new PrivateGLDisplay (d, this))
+{
+ if (!glMetadata->initDisplayOptions (d, glDisplayOptionInfo,
+ GL_DISPLAY_OPTION_NUM, priv->opt))
+ {
+ setFailed ();
+ return;
+ }
+}
+
+GLDisplay::~GLDisplay ()
+{
+ delete priv;
+}
+
+PrivateGLDisplay::PrivateGLDisplay (CompDisplay *d,
+ GLDisplay *gd) :
+ display (d),
+ gDisplay (gd),
+ textureFilter (GL_LINEAR)
+{
+}
+
+PrivateGLDisplay::~PrivateGLDisplay ()
+{
+}
+
+GLenum
+GLDisplay::textureFilter ()
+{
+ return priv->textureFilter;
+}
+
+void
+PrivateGLDisplay::handleEvent (XEvent *event)
+{
+ CompScreen *s;
+ CompWindow *w;
+
+ display->handleEvent (event);
+
+ switch (event->type) {
+ case PropertyNotify:
+ if (event->xproperty.atom == display->atoms ().xBackground[0] ||
+ event->xproperty.atom == display->atoms ().xBackground[1])
+ {
+ s = display->findScreen (event->xproperty.window);
+ if (s)
+ GLScreen::get (s)->updateBackground ();
+ }
+ else if (event->xproperty.atom == display->atoms ().winOpacity ||
+ event->xproperty.atom == display->atoms ().winBrightness ||
+ event->xproperty.atom == display->atoms ().winSaturation)
+ {
+ w = display->findWindow (event->xproperty.window);
+ if (w)
+ GLWindow::get (w)->updatePaintAttribs ();
+ }
+ break;
+ break;
+ default:
+ break;
+ }
+}
+
+void
+GLDisplay::clearTargetOutput (unsigned int mask)
+{
+ if (targetScreen)
+ targetScreen->clearOutput (targetOutput, mask);
+}
diff --git a/src/fragment.cpp b/plugins/opengl/fragment.cpp
index f5ccb9a..e1f9349 100644
--- a/src/fragment.cpp
+++ b/plugins/opengl/fragment.cpp
@@ -29,10 +29,11 @@
#define foreach BOOST_FOREACH
#include <compiz-core.h>
-#include <comptexture.h>
-#include <compfragment.h>
+#include <opengl/texture.h>
+#include <opengl/fragment.h>
#include <compscreen.h>
#include "privatefragment.h"
+#include "privates.h"
#include <string.h>
#include <stdlib.h>
@@ -44,11 +45,11 @@
#define COMP_FUNCTION_ARB_MASK (1 << 0)
#define COMP_FUNCTION_MASK (COMP_FUNCTION_ARB_MASK)
-namespace CompFragment {
+namespace GLFragment {
class Program {
public:
- Program (CompScreen *s) :
+ Program (GLScreen *s) :
s (s),
signature (0),
blending (false),
@@ -62,7 +63,7 @@ namespace CompFragment {
};
public:
- CompScreen *s;
+ GLScreen *s;
std::list<FunctionId> signature;
@@ -189,7 +190,7 @@ namespace CompFragment {
static InitialLoadFunction initialLoadFunction;
static Function *
- findFragmentFunction (CompScreen *s,
+ findFragmentFunction (GLScreen *s,
FunctionId id)
{
foreach (Function *f, s->fragmentStorage ()->functions)
@@ -199,7 +200,7 @@ namespace CompFragment {
}
static Function *
- findFragmentFunctionWithName (CompScreen *s,
+ findFragmentFunctionWithName (GLScreen *s,
CompString name)
{
foreach (Function *f, s->fragmentStorage ()->functions)
@@ -209,9 +210,9 @@ namespace CompFragment {
}
static Program *
- findFragmentProgram (CompScreen *s,
- FunctionId *signature,
- unsigned int nSignature)
+ findFragmentProgram (GLScreen *s,
+ FunctionId *signature,
+ unsigned int nSignature)
{
unsigned int i;
@@ -510,7 +511,7 @@ namespace CompFragment {
}
static Program *
- buildFragmentProgram (CompScreen *s,
+ buildFragmentProgram (GLScreen *s,
PrivateAttrib *attrib)
{
Program *program;
@@ -594,7 +595,7 @@ namespace CompFragment {
}
static GLuint
- getFragmentProgram (CompScreen *s,
+ getFragmentProgram (GLScreen *s,
PrivateAttrib *attrib,
GLenum *type,
bool *blending)
@@ -822,7 +823,7 @@ namespace CompFragment {
}
FunctionId
- FunctionData::createFragmentFunction (CompScreen *s, const char *name)
+ FunctionData::createFragmentFunction (GLScreen *s, const char *name)
{
Function *function = new Function ();
CompString validName = name;
@@ -846,12 +847,12 @@ namespace CompFragment {
return function->id;
}
- Attrib::Attrib (const CompWindowPaintAttrib *paint) :
+ Attrib::Attrib (const GLWindowPaintAttrib &paint) :
priv (new PrivateAttrib ())
{
- priv->opacity = paint->opacity;
- priv->brightness = paint->brightness;
- priv->saturation = paint->saturation;
+ priv->opacity = paint.opacity;
+ priv->brightness = paint.brightness;
+ priv->saturation = paint.saturation;
priv->nTexture = 0;
priv->nFunction = 0;
priv->nParam = 0;
@@ -908,7 +909,7 @@ namespace CompFragment {
}
bool
- Attrib::enable (CompScreen *s, bool *blending)
+ Attrib::enable (GLScreen *s, bool *blending)
{
GLuint name;
GLenum type;
@@ -931,7 +932,7 @@ namespace CompFragment {
}
void
- Attrib::disable (CompScreen *s)
+ Attrib::disable (GLScreen *s)
{
glDisable (GL_FRAGMENT_PROGRAM_ARB);
}
@@ -979,7 +980,7 @@ namespace CompFragment {
return priv->nFunction > 0;
}
- void destroyFragmentFunction (CompScreen *s, FunctionId id)
+ void destroyFragmentFunction (GLScreen *s, FunctionId id)
{
Function *function;
Program *program;
@@ -1022,8 +1023,8 @@ namespace CompFragment {
}
FunctionId
- getSaturateFragmentFunction (CompScreen *s,
- CompTexture *texture,
+ getSaturateFragmentFunction (GLScreen *s,
+ GLTexture *texture,
int param)
{
int target;
diff --git a/plugins/opengl/icon.cpp b/plugins/opengl/icon.cpp
new file mode 100644
index 0000000..f15a278
--- /dev/null
+++ b/plugins/opengl/icon.cpp
@@ -0,0 +1,49 @@
+#include <compicon.h>
+
+CompIcon::CompIcon (CompScreen *screen, unsigned int width,
+ unsigned int height) :
+ mTexture (screen),
+ mWidth (width),
+ mHeight (height),
+ mData (new unsigned char[width * height * 4]),
+ mUpdateTex (true)
+{
+}
+
+CompIcon::~CompIcon ()
+{
+ free (mData);
+}
+
+CompTexture &
+CompIcon::texture ()
+{
+ if (mUpdateTex)
+ {
+ mUpdateTex = false;
+ mTexture.reset ();
+ if (!mTexture.imageBufferToTexture (&mTexture,
+ reinterpret_cast<const char *> (mData), mWidth, mHeight))
+ mTexture.reset ();
+ }
+ return mTexture;
+}
+
+unsigned int
+CompIcon::width ()
+{
+ return mWidth;
+}
+
+unsigned int
+CompIcon::height ()
+{
+ return mHeight;
+}
+
+unsigned char*
+CompIcon::data ()
+{
+ mUpdateTex = true;
+ return mData;
+}
diff --git a/src/matrix.cpp b/plugins/opengl/matrix.cpp
index 4718b69..02efb3c 100644
--- a/src/matrix.cpp
+++ b/plugins/opengl/matrix.cpp
@@ -25,7 +25,7 @@
#include <string.h>
#include <math.h>
#include <compiz-core.h>
-#include <compmatrix.h>
+#include <opengl/matrix.h>
/**
* Identity matrix.
@@ -72,47 +72,47 @@ matmul4 (float *product,
}
}
-CompMatrix::CompMatrix ()
+GLMatrix::GLMatrix ()
{
memcpy (m, identity, sizeof (m));
}
void
-CompMatrix::reset ()
+GLMatrix::reset ()
{
memcpy (m, identity, sizeof (m));
}
const float *
-CompMatrix::getMatrix () const
+GLMatrix::getMatrix () const
{
return m;
}
-CompMatrix&
-CompMatrix::operator*= (const CompMatrix& rhs)
+GLMatrix&
+GLMatrix::operator*= (const GLMatrix& rhs)
{
*this = *this * rhs;
return *this;
}
-CompMatrix
-operator* (const CompMatrix& lhs,
- const CompMatrix& rhs)
+GLMatrix
+operator* (const GLMatrix& lhs,
+ const GLMatrix& rhs)
{
- CompMatrix result;
+ GLMatrix result;
matmul4 (result.m, lhs.m, rhs.m);
return result;
}
-CompVector
-operator* (const CompMatrix& lhs,
- const CompVector& rhs)
+GLVector
+operator* (const GLMatrix& lhs,
+ const GLVector& rhs)
{
- CompVector result;
+ GLVector result;
const float *a = lhs.m;
int i;
@@ -138,7 +138,7 @@ operator* (const CompMatrix& lhs,
* Optimizations contributed by Rudolf Opalla (rudi@khm.de).
*/
void
-CompMatrix::rotate (const float angle,
+GLMatrix::rotate (const float angle,
const float xRot,
const float yRot,
const float zRot)
@@ -325,13 +325,13 @@ CompMatrix::rotate (const float angle,
}
void
-CompMatrix::rotate (const float angle,
- const CompVector& vector)
+GLMatrix::rotate (const float angle,
+ const GLVector& vector)
{
rotate (angle,
- vector[CompVector::x],
- vector[CompVector::y],
- vector[CompVector::z]);
+ vector[GLVector::x],
+ vector[GLVector::y],
+ vector[GLVector::z]);
}
/**
@@ -345,7 +345,7 @@ CompMatrix::rotate (const float angle,
* Multiplies in-place the elements of \p matrix by the scale factors.
*/
void
-CompMatrix::scale (const float x,
+GLMatrix::scale (const float x,
const float y,
const float z)
{
@@ -356,11 +356,11 @@ CompMatrix::scale (const float x,
}
void
-CompMatrix::scale (const CompVector& vector)
+GLMatrix::scale (const GLVector& vector)
{
- scale (vector[CompVector::x],
- vector[CompVector::y],
- vector[CompVector::z]);
+ scale (vector[GLVector::x],
+ vector[GLVector::y],
+ vector[GLVector::z]);
}
/**
@@ -374,7 +374,7 @@ CompMatrix::scale (const CompVector& vector)
* Adds the translation coordinates to the elements of \p matrix in-place.
*/
void
-CompMatrix::translate (const float x,
+GLMatrix::translate (const float x,
const float y,
const float z)
{
@@ -385,15 +385,15 @@ CompMatrix::translate (const float x,
}
void
-CompMatrix::translate (const CompVector& vector)
+GLMatrix::translate (const GLVector& vector)
{
- translate (vector[CompVector::x],
- vector[CompVector::y],
- vector[CompVector::z]);
+ translate (vector[GLVector::x],
+ vector[GLVector::y],
+ vector[GLVector::z]);
}
void
-CompMatrix::toScreenSpace (CompOutput *output,
+GLMatrix::toScreenSpace (CompOutput *output,
float z)
{
translate (-0.5f, -0.5f, z);
diff --git a/plugins/opengl/opengl.cpp b/plugins/opengl/opengl.cpp
new file mode 100644
index 0000000..48eaa4b
--- /dev/null
+++ b/plugins/opengl/opengl.cpp
@@ -0,0 +1,264 @@
+#include <compiz-core.h>
+#include <compprivatehandler.h>
+#include "privates.h"
+
+const CompMetadata::OptionInfo glDisplayOptionInfo[GL_DISPLAY_OPTION_NUM] = {
+ { "texture_filter", "int", RESTOSTRING (0, 2), 0, 0 },
+};
+
+const CompMetadata::OptionInfo glScreenOptionInfo[GL_SCREEN_OPTION_NUM] = {
+ { "lighting", "bool", 0, 0, 0 },
+ { "sync_to_vblank", "bool", 0, 0, 0 },
+ { "texture_compression", "bool", 0, 0, 0 },
+};
+
+CompOption::Vector &
+GLDisplay::getOptions ()
+{
+ return priv->opt;
+}
+
+CompOption::Vector &
+GLScreen::getOptions ()
+{
+ return priv->opt;
+}
+
+bool
+GLDisplay::setOption (const char *name,
+ CompOption::Value &value)
+{
+ CompOption *o;
+ unsigned int index;
+
+ o = CompOption::findOption (priv->opt, name, &index);
+ if (!o)
+ return false;
+
+ switch (index) {
+ case GL_DISPLAY_OPTION_TEXTURE_FILTER:
+ if (o->set (value))
+ {
+ foreach (CompScreen *s, priv->display->screens ())
+ CompositeScreen::get (s)->damageScreen ();
+
+ if (!o->value ().i ())
+ priv->textureFilter = GL_NEAREST;
+ else
+ priv->textureFilter = GL_LINEAR;
+
+ return true;
+ }
+ break;
+ default:
+ if (CompOption::setDisplayOption (priv->display, *o, value))
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+bool
+GLScreen::setOption (const char *name,
+ CompOption::Value &value)
+{
+ CompOption *o;
+ unsigned int index;
+
+ o = CompOption::findOption (priv->opt, name, &index);
+ if (!o)
+ return false;
+
+ return CompOption::setScreenOption (priv->screen, *o, value);
+}
+
+CompMetadata *glMetadata;
+
+class OpenglPluginVTable : public CompPlugin::VTable
+{
+ public:
+
+ const char *
+ name () { return "opengl"; };
+
+ CompMetadata *
+ getMetadata ();
+
+ virtual bool
+ init ();
+
+ virtual void
+ fini ();
+
+ virtual bool
+ initObject (CompObject *object);
+
+ virtual void
+ finiObject (CompObject *object);
+
+ CompOption::Vector &
+ getObjectOptions (CompObject *object);
+
+ bool
+ setObjectOption (CompObject *object,
+ const char *name,
+ CompOption::Value &value);
+};
+
+bool
+OpenglPluginVTable::initObject (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ {
+ GLDisplay *d = new GLDisplay (GET_CORE_DISPLAY (o));
+ if (!d)
+ return false;
+ if (d->loadFailed ())
+ {
+ delete d;
+ return false;
+ }
+ return true;
+ }
+ break;
+ case COMP_OBJECT_TYPE_SCREEN:
+ {
+ GLScreen *s = new GLScreen (GET_CORE_SCREEN (o));
+ if (!s)
+ return false;
+ if (s->loadFailed ())
+ {
+ delete s;
+ return false;
+ }
+ return true;
+ }
+ break;
+ case COMP_OBJECT_TYPE_WINDOW:
+ {
+ GLWindow *w = new GLWindow (GET_CORE_WINDOW (o));
+ if (!w)
+ return false;
+ if (w->loadFailed ())
+ {
+ delete w;
+ return false;
+ }
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+void
+OpenglPluginVTable::finiObject (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ {
+ GLDisplay *d = GLDisplay::get (GET_CORE_DISPLAY (o));
+ if (d)
+ delete d;
+ }
+ break;
+ case COMP_OBJECT_TYPE_SCREEN:
+ {
+ GLScreen *s = GLScreen::get (GET_CORE_SCREEN (o));
+ if (s)
+ delete s;
+ }
+ break;
+ case COMP_OBJECT_TYPE_WINDOW:
+ {
+ GLWindow *w = GLWindow::get (GET_CORE_WINDOW (o));
+ if (w)
+ delete w;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+CompOption::Vector &
+OpenglPluginVTable::getObjectOptions (CompObject *o)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ return GLDisplay::get (GET_CORE_DISPLAY (o))->getOptions ();
+ case COMP_OBJECT_TYPE_SCREEN:
+ return GLScreen::get (GET_CORE_SCREEN (o))->getOptions ();
+ default:
+ break;
+ }
+ return noOptions;
+}
+
+bool
+OpenglPluginVTable::setObjectOption (CompObject *o,
+ const char *name,
+ CompOption::Value &value)
+{
+ switch (o->objectType ())
+ {
+ case COMP_OBJECT_TYPE_DISPLAY:
+ return GLDisplay::get (GET_CORE_DISPLAY (o))->
+ setOption (name, value);
+ case COMP_OBJECT_TYPE_SCREEN:
+ return GLScreen::get (GET_CORE_SCREEN (o))->setOption (name, value);
+ default:
+ break;
+ }
+ return false;
+}
+
+bool
+OpenglPluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI))
+ return false;
+
+ CompPrivate p;
+ p.uval = COMPIZ_OPENGL_ABI;
+ core->storeValue ("opengl_ABI", p);
+
+ glMetadata = new CompMetadata
+ (name (), glDisplayOptionInfo, GL_DISPLAY_OPTION_NUM,
+ glScreenOptionInfo, GL_SCREEN_OPTION_NUM);
+
+ if (!glMetadata)
+ return false;
+
+ glMetadata->addFromFile (name ());
+
+ return true;
+}
+
+void
+OpenglPluginVTable::fini ()
+{
+ delete glMetadata;
+}
+
+CompMetadata *
+OpenglPluginVTable::getMetadata ()
+{
+ return glMetadata;
+}
+
+OpenglPluginVTable openglVTable;
+
+CompPlugin::VTable *
+getCompPluginInfo20080805 (void)
+{
+