summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/compcore.h158
-rw-r--r--include/compdisplay.h427
-rw-r--r--include/compiz-core.h1771
-rw-r--r--include/compiz.h35
-rw-r--r--include/compobject.h13
-rw-r--r--include/compplugin.h (renamed from include/compiz-plugin.h)58
-rw-r--r--include/compscreen.h554
-rw-r--r--include/compwindow.h563
-rw-r--r--metadata/core.xml.in31
-rw-r--r--plugins/Makefile.am19
-rw-r--r--plugins/move.cpp588
-rw-r--r--src/Makefile.am2
-rw-r--r--src/core.cpp599
-rw-r--r--src/cursor.cpp36
-rw-r--r--src/display.cpp3903
-rw-r--r--src/event.cpp1465
-rw-r--r--src/fragment.cpp40
-rw-r--r--src/main.cpp66
-rw-r--r--src/match.cpp43
-rw-r--r--src/metadata.cpp20
-rw-r--r--src/option.cpp4
-rw-r--r--src/paint.cpp521
-rw-r--r--src/plugin.cpp178
-rw-r--r--src/privatecore.h42
-rw-r--r--src/privatedisplay.h138
-rw-r--r--src/privatescreen.h251
-rw-r--r--src/privatewindow.h269
-rw-r--r--src/screen.cpp4023
-rw-r--r--src/session.cpp22
-rw-r--r--src/texture.cpp127
-rw-r--r--src/window.cpp5012
31 files changed, 11303 insertions, 9675 deletions
diff --git a/include/compcore.h b/include/compcore.h
new file mode 100644
index 0000000..123d7f4
--- /dev/null
+++ b/include/compcore.h
@@ -0,0 +1,158 @@
+#ifndef _COMPCORE_H
+#define _COMPCORE_H
+
+#include <list>
+#include "wrapable.h"
+
+class PrivateCore;
+class CompCore;
+class CompDisplay;
+
+#define NOTIFY_CREATE_MASK (1 << 0)
+#define NOTIFY_DELETE_MASK (1 << 1)
+#define NOTIFY_MOVE_MASK (1 << 2)
+#define NOTIFY_MODIFY_MASK (1 << 3)
+
+typedef void (*FileWatchCallBackProc) (const char *name,
+ void *closure);
+
+typedef int CompFileWatchHandle;
+
+typedef struct _CompFileWatch {
+ char *path;
+ int mask;
+ FileWatchCallBackProc callBack;
+ void *closure;
+ CompFileWatchHandle handle;
+} CompFileWatch;
+
+typedef struct _CompTimeout {
+ int minTime;
+ int maxTime;
+ int minLeft;
+ int maxLeft;
+ CallBackProc callBack;
+ void *closure;
+ CompTimeoutHandle handle;
+} CompTimeout;
+
+typedef struct _CompWatchFd {
+ int fd;
+ CallBackProc callBack;
+ void *closure;
+ CompWatchFdHandle handle;
+} CompWatchFd;
+
+int
+allocCoreObjectPrivateIndex (CompObject *parent);
+
+void
+freeCoreObjectPrivateIndex (CompObject *parent,
+ int index);
+
+CompBool
+forEachCoreObject (CompObject *parent,
+ ObjectCallBackProc proc,
+ void *closure);
+
+char *
+nameCoreObject (CompObject *object);
+
+CompObject *
+findCoreObject (CompObject *parent,
+ const char *name);
+
+int
+allocateCorePrivateIndex (void);
+
+void
+freeCorePrivateIndex (int index);
+
+
+class CoreInterface : public WrapableInterface<CompCore> {
+ public:
+ CoreInterface ();
+
+ WRAPABLE_DEF(void, fileWatchAdded, CompFileWatch *)
+ WRAPABLE_DEF(void, fileWatchRemoved, CompFileWatch *)
+
+ WRAPABLE_DEF(bool, initPluginForObject, CompPlugin *, CompObject *)
+ WRAPABLE_DEF(void, finiPluginForObject, CompPlugin *, CompObject *)
+
+ WRAPABLE_DEF(bool, setOptionForPlugin, CompObject *, const char *, const char *, CompOptionValue *)
+
+ WRAPABLE_DEF(void, objectAdd, CompObject *, CompObject *)
+ WRAPABLE_DEF(void, objectRemove, CompObject *, CompObject *)
+
+ WRAPABLE_DEF(void, sessionEvent, CompSessionEvent, CompOption *, unsigned int)
+};
+
+class CompCore : public WrapableHandler<CoreInterface>, public CompObject {
+
+ // functions
+ public:
+ CompCore ();
+ ~CompCore ();
+
+ bool
+ init ();
+
+ bool
+ addDisplay (const char *name);
+
+ void
+ removeDisplay (CompDisplay *);
+
+ void
+ eventLoop ();
+
+ CompDisplay *
+ displays();
+
+ CompFileWatchHandle
+ addFileWatch (const char *path,
+ int mask,
+ FileWatchCallBackProc callBack,
+ void *closure);
+
+ void
+ removeFileWatch (CompFileWatchHandle handle);
+
+ CompTimeoutHandle
+ addTimeout (int minTime,
+ int maxTime,
+ CallBackProc callBack,
+ void *closure = NULL);
+
+ CompWatchFdHandle
+ addWatchFd (int fd,
+ short int events,
+ CallBackProc callBack,
+ void *closure);
+
+ void
+ removeWatchFd (CompWatchFdHandle handle);
+
+ void *
+ removeTimeout (CompTimeoutHandle handle);
+
+ // Wrapable interface
+
+ WRAPABLE_HND(void, fileWatchAdded, CompFileWatch *)
+ WRAPABLE_HND(void, fileWatchRemoved, CompFileWatch *)
+
+ WRAPABLE_HND(bool, initPluginForObject, CompPlugin *, CompObject *)
+ WRAPABLE_HND(void, finiPluginForObject, CompPlugin *, CompObject *)
+
+ WRAPABLE_HND(bool, setOptionForPlugin, CompObject *, const char *, const char *, CompOptionValue *)
+
+ WRAPABLE_HND(void, objectAdd, CompObject *, CompObject *)
+ WRAPABLE_HND(void, objectRemove, CompObject *, CompObject *)
+
+ WRAPABLE_HND(void, sessionEvent, CompSessionEvent, CompOption *, unsigned int)
+
+ private:
+ PrivateCore *priv;
+};
+
+#endif
diff --git a/include/compdisplay.h b/include/compdisplay.h
new file mode 100644
index 0000000..12e5aba
--- /dev/null
+++ b/include/compdisplay.h
@@ -0,0 +1,427 @@
+#ifndef _COMPDISPLAY_H
+#define _COMPDISPLAY_H
+
+#include <list>
+#include "wrapable.h"
+
+class CompDisplay;
+class CompScreen;
+class PrivateDisplay;
+
+
+class DisplayInterface : public WrapableInterface<CompDisplay> {
+ public:
+ DisplayInterface ();
+
+ WRAPABLE_DEF(void, handleEvent, XEvent *event);
+ WRAPABLE_DEF(void, handleCompizEvent, const char *,
+ const char *, CompOption *, int nOption);
+
+ WRAPABLE_DEF(bool, fileToImage, const char *, const char *,
+ int *, int *, int *, void **data);
+ WRAPABLE_DEF(bool, imageToFile, const char *, const char *,
+ const char *, int, int, int, void *);
+
+
+ WRAPABLE_DEF(void, matchInitExp, CompMatchExp *, const char *);
+ WRAPABLE_DEF(void, matchExpHandlerChanged)
+ WRAPABLE_DEF(void, matchPropertyChanged, CompWindow *)
+
+ WRAPABLE_DEF(void, logMessage, const char *, CompLogLevel, const char*)
+};
+
+class CompDisplay : public WrapableHandler<DisplayInterface>, public CompObject {
+
+ public:
+ CompDisplay *next;
+ char *screenPrivateIndices;
+ int screenPrivateLen;
+
+ class Atoms {
+ public:
+ Atom supported;
+ Atom supportingWmCheck;
+
+ Atom utf8String;
+
+ Atom wmName;
+
+ Atom winType;
+ Atom winTypeDesktop;
+ Atom winTypeDock;
+ Atom winTypeToolbar;
+ Atom winTypeMenu;
+ Atom winTypeUtil;
+ Atom winTypeSplash;
+ Atom winTypeDialog;
+ Atom winTypeNormal;
+ Atom winTypeDropdownMenu;
+ Atom winTypePopupMenu;
+ Atom winTypeTooltip;
+ Atom winTypeNotification;
+ Atom winTypeCombo;
+ Atom winTypeDnd;
+
+ Atom winOpacity;
+ Atom winBrightness;
+ Atom winSaturation;
+ Atom winActive;
+ Atom winDesktop;
+
+ Atom workarea;
+
+ Atom desktopViewport;
+ Atom desktopGeometry;
+ Atom currentDesktop;
+ Atom numberOfDesktops;
+
+ Atom winState;
+ Atom winStateModal;
+ Atom winStateSticky;
+ Atom winStateMaximizedVert;
+ Atom winStateMaximizedHorz;
+ Atom winStateShaded;
+ Atom winStateSkipTaskbar;
+ Atom winStateSkipPager;
+ Atom winStateHidden;
+ Atom winStateFullscreen;
+ Atom winStateAbove;
+ Atom winStateBelow;
+ Atom winStateDemandsAttention;
+ Atom winStateDisplayModal;
+
+ Atom winActionMove;
+ Atom winActionResize;
+ Atom winActionStick;
+ Atom winActionMinimize;
+ Atom winActionMaximizeHorz;
+ Atom winActionMaximizeVert;
+ Atom winActionFullscreen;
+ Atom winActionClose;
+ Atom winActionShade;
+ Atom winActionChangeDesktop;
+ Atom winActionAbove;
+ Atom winActionBelow;
+
+ Atom wmAllowedActions;
+
+ Atom wmStrut;
+ Atom wmStrutPartial;
+
+ Atom wmUserTime;
+
+ Atom wmIcon;
+ Atom wmIconGeometry;
+
+ Atom clientList;
+ Atom clientListStacking;
+
+ Atom frameExtents;
+ Atom frameWindow;
+
+ Atom wmState;
+ Atom wmChangeState;
+ Atom wmProtocols;
+ Atom wmClientLeader;
+
+ Atom wmDeleteWindow;
+ Atom wmTakeFocus;
+ Atom wmPing;
+ Atom wmSyncRequest;
+
+ Atom wmSyncRequestCounter;
+
+ Atom closeWindow;
+ Atom wmMoveResize;
+ Atom moveResizeWindow;
+ Atom restackWindow;
+
+ Atom showingDesktop;
+
+ Atom xBackground[2];
+
+ Atom toolkitAction;
+ Atom toolkitActionMainMenu;
+ Atom toolkitActionRunDialog;
+ Atom toolkitActionWindowMenu;
+ Atom toolkitActionForceQuitDialog;
+
+ Atom mwmHints;
+
+ Atom xdndAware;
+ Atom xdndEnter;
+ Atom xdndLeave;
+ Atom xdndPosition;
+ Atom xdndStatus;
+ Atom xdndDrop;
+
+ Atom manager;
+ Atom targets;
+ Atom multiple;
+ Atom timestamp;
+ Atom version;
+ Atom atomPair;
+
+ Atom startupId;
+ };
+
+ public:
+ // functions
+ CompDisplay ();
+ ~CompDisplay ();
+
+ bool
+ init (const char *name);
+
+ bool
+ addScreen (int screenNum);
+
+ void
+ removeScreen (CompScreen *);
+
+ Atoms
+ atoms();
+
+ Display *
+ dpy();
+
+ CompScreen *
+ screens();
+
+ GLenum
+ textureFilter ();
+
+ CompOption *
+ getOption (const char *);
+
+ bool
+ setOption (const char *name,
+ CompOptionValue *value);
+
+ XineramaScreenInfo *
+ screenInfo ();
+
+ int
+ nScreenInfo ();
+
+ bool
+ XRandr ();
+
+ bool
+ XShape ();
+
+ SnDisplay *
+ snDisplay ();
+
+ Window
+ below ();
+
+ Window
+ activeWindow ();
+
+ Window
+ autoRaiseWindow ();
+
+ XModifierKeymap *
+ modMap ();
+
+ unsigned int
+ ignoredModMask ();
+
+ const char *
+ displayString ();
+
+ unsigned int
+ lastPing ();
+
+ CompWatchFdHandle
+ getWatchFdHandle ();
+
+ void
+ setWatchFdHandle (CompWatchFdHandle);
+
+ void
+ processEvents ();
+
+ void
+ updateModifierMappings ();
+
+ unsigned int
+ virtualToRealModMask (unsigned int modMask);
+
+ unsigned int
+ keycodeToModifiers (int keycode);
+
+ CompScreen *
+ findScreen (Window root);
+
+ void
+ forEachWindow (ForEachWindowProc proc,
+ void *closure);
+
+ CompWindow *
+ findWindow (Window id);
+
+ CompWindow *
+ findTopLevelWindow (Window id);
+
+
+ void
+ clearTargetOutput (unsigned int mask);
+
+ bool
+ readImageFromFile (const char *name,
+ int *width,
+ int *height,
+ void **data);
+
+ bool
+ writeImageToFile (const char *path,
+ const char *name,
+ const char *format,
+ int width,
+ int height,
+ void *data);
+
+ CompCursor *
+ findCursor ();
+
+ void
+ updateScreenInfo ();
+
+ Window
+ getActiveWindow (Window root);
+
+ int
+ getWmState (Window id);
+
+ void
+ setWmState (int state, Window id);
+
+ unsigned int
+ windowStateMask (Atom state);
+
+
+ static unsigned int
+ windowStateFromString (const char *str);
+
+ unsigned int
+ getWindowState (Window id);
+
+ void
+ setWindowState (unsigned int state, Window id);
+
+ unsigned int
+ getWindowType (Window id);
+
+ void
+ getMwmHints (Window id,
+ unsigned int *func,
+ unsigned int *decor);
+
+
+ unsigned int
+ getProtocols (Window id);
+
+
+ unsigned int
+ getWindowProp (Window id,
+ Atom property,
+ unsigned int defaultValue);
+
+
+ void
+ setWindowProp (Window id,
+ Atom property,
+ unsigned int value);
+
+
+ bool
+ readWindowProp32 (Window id,
+ Atom property,
+ unsigned short *returnValue);
+
+
+ unsigned short
+ getWindowProp32 (Window id,
+ Atom property,
+ unsigned short defaultValue);
+
+
+ void
+ setWindowProp32 (Window id,
+ Atom property,
+ unsigned short value);
+
+ void
+ addScreenActions (CompScreen *s);
+
+ // wrapable interface
+ WRAPABLE_HND(void, handleEvent, XEvent *event)
+ WRAPABLE_HND(void, handleCompizEvent, const char *,
+ const char *, CompOption *, int nOption)
+
+ WRAPABLE_HND(bool, fileToImage, const char *, const char *,
+ int *, int *, int *, void **data)
+ WRAPABLE_HND(bool, imageToFile, const char *, const char *,
+ const char *, int, int, int, void *)
+
+
+ WRAPABLE_HND(void, matchInitExp, CompMatchExp *, const char *);
+ WRAPABLE_HND(void, matchExpHandlerChanged)
+ WRAPABLE_HND(void, matchPropertyChanged, CompWindow *)
+
+ WRAPABLE_HND(void, logMessage, const char *, CompLogLevel, const char*)
+
+ public:
+ Region mTmpRegion;
+ Region mOutputRegion;
+
+ private:
+
+ PrivateDisplay *priv;
+
+ public:
+
+ static bool
+ runCommandDispatch (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ runCommandScreenshot (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ runCommandWindowScreenshot (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ runCommandTerminal (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static CompOption *
+ getDisplayOptions (CompObject *object,
+ int *count);
+
+ static bool
+ pingTimeout (void *closure);
+};
+
+extern Bool inHandleEvent;
+
+extern CompScreen *targetScreen;
+extern CompOutput *targetOutput;
+
+#endif
diff --git a/include/compiz-core.h b/include/compiz-core.h
index 5d67aae..4b6ca55 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -26,7 +26,7 @@
#ifndef _COMPIZ_CORE_H
#define _COMPIZ_CORE_H
-#include <compiz-plugin.h>
+#include <compplugin.h>
#define CORE_ABIVERSION 20080618
@@ -48,6 +48,15 @@
#include <GL/gl.h>
#include <GL/glx.h>
+
+#define TIMEVALDIFF(tv1, tv2) \
+ ((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
+ ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
+ ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
+ ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
+ (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000
+
+
COMPIZ_BEGIN_DECLS
#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR > 2
@@ -81,6 +90,8 @@ typedef struct _CompMatch CompMatch;
typedef struct _CompOutput CompOutput;
typedef struct _CompWalker CompWalker;
+class CompDisplay;
+
/* virtual modifiers */
#define CompModAlt 0
@@ -228,7 +239,7 @@ extern int lastPointerY;
extern int pointerX;
extern int pointerY;
-extern CompCore core;
+extern CompCore *core;
extern CompMetadata coreMetadata;
#define RESTRICT_VALUE(value, min, max) \
@@ -276,11 +287,6 @@ typedef unsigned int CompObjectType;
#define COMP_OBJECT_TYPE_SCREEN 2
#define COMP_OBJECT_TYPE_WINDOW 3
-struct _CompObject {
- CompObjectType type;
- CompPrivate *privates;
- CompObject *parent;
-};
typedef CompBool (*ObjectCallBackProc) (CompObject *object,
void *closure);
@@ -358,10 +364,7 @@ typedef enum {
CompSessionPrevClientId
} CompSessionClientIdType;
-typedef void (*SessionEventProc) (CompCore *c,
- CompSessionEvent event,
- CompOption *arguments,
- unsigned int nArguments);
+
void
initSession (char *smPrevClientId);
@@ -369,11 +372,6 @@ initSession (char *smPrevClientId);
void
closeSession (void);
-void
-sessionEvent (CompCore *c,
- CompSessionEvent event,
- CompOption *arguments,
- unsigned int nArguments);
char *
getSessionClientId (CompSessionClientIdType type);
@@ -427,7 +425,7 @@ typedef struct _CompButtonBinding {
typedef struct _CompAction CompAction;
-typedef Bool (*CompActionCallBackProc) (CompDisplay *d,
+typedef bool (*CompActionCallBackProc) (CompDisplay *d,
CompAction *action,
CompActionState state,
CompOption *option,
@@ -598,143 +596,6 @@ isActionOption (CompOption *option);
/* core.c */
-typedef CompBool (*InitPluginForObjectProc) (CompPlugin *plugin,
- CompObject *object);
-typedef void (*FiniPluginForObjectProc) (CompPlugin *plugin,
- CompObject *object);
-
-typedef CompBool (*SetOptionForPluginProc) (CompObject *object,
- const char *plugin,
- const char *name,
- CompOptionValue *value);
-
-typedef void (*ObjectAddProc) (CompObject *parent,
- CompObject *object);
-typedef void (*ObjectRemoveProc) (CompObject *parent,
- CompObject *object);
-
-#define NOTIFY_CREATE_MASK (1 << 0)
-#define NOTIFY_DELETE_MASK (1 << 1)
-#define NOTIFY_MOVE_MASK (1 << 2)
-#define NOTIFY_MODIFY_MASK (1 << 3)
-
-typedef void (*FileWatchCallBackProc) (const char *name,
- void *closure);
-
-typedef int CompFileWatchHandle;
-
-typedef struct _CompFileWatch {
- struct _CompFileWatch *next;
- char *path;
- int mask;
- FileWatchCallBackProc callBack;
- void *closure;
- CompFileWatchHandle handle;
-} CompFileWatch;
-
-typedef void (*FileWatchAddedProc) (CompCore *core,
- CompFileWatch *fileWatch);
-
-typedef void (*FileWatchRemovedProc) (CompCore *core,
- CompFileWatch *fileWatch);
-
-typedef struct _CompTimeout {
- struct _CompTimeout *next;
- int minTime;
- int maxTime;
- int minLeft;
- int maxLeft;
- CallBackProc callBack;
- void *closure;
- CompTimeoutHandle handle;
-} CompTimeout;
-
-typedef struct _CompWatchFd {
- struct _CompWatchFd *next;
- int fd;
- CallBackProc callBack;
- void *closure;
- CompWatchFdHandle handle;
-} CompWatchFd;
-
-struct _CompCore {
- CompObject base;
-
- CompDisplay *displays;
-
- Region tmpRegion;
- Region outputRegion;
-
- CompFileWatch *fileWatch;
- CompFileWatchHandle lastFileWatchHandle;
-
- CompTimeout *timeouts;
- struct timeval lastTimeout;
- CompTimeoutHandle lastTimeoutHandle;
-
- CompWatchFd *watchFds;
- CompWatchFdHandle lastWatchFdHandle;
- struct pollfd *watchPollFds;
- int nWatchFds;
-
- InitPluginForObjectProc initPluginForObject;
- FiniPluginForObjectProc finiPluginForObject;
-
- SetOptionForPluginProc setOptionForPlugin;
-
- ObjectAddProc objectAdd;
- ObjectRemoveProc objectRemove;
-
- FileWatchAddedProc fileWatchAdded;
- FileWatchRemovedProc fileWatchRemoved;
-
- SessionEventProc sessionEvent;
-};
-
-int
-allocCoreObjectPrivateIndex (CompObject *parent);
-
-void
-freeCoreObjectPrivateIndex (CompObject *parent,
- int index);
-
-CompBool
-forEachCoreObject (CompObject *parent,
- ObjectCallBackProc proc,
- void *closure);
-
-char *
-nameCoreObject (CompObject *object);
-
-CompObject *
-findCoreObject (CompObject *parent,
- const char *name);
-
-CompBool
-initCore (void);
-
-void
-finiCore (void);
-
-int
-allocateCorePrivateIndex (void);
-
-void
-freeCorePrivateIndex (int index);
-
-void
-addDisplayToCore (CompDisplay *d);
-
-CompFileWatchHandle
-addFileWatch (const char *path,
- int mask,
- FileWatchCallBackProc callBack,
- void *closure);
-
-void
-removeFileWatch (CompFileWatchHandle handle);
-
-
/* display.c */
#define COMP_DISPLAY_OPTION_ABI 0
@@ -782,60 +643,32 @@ removeFileWatch (CompFileWatchHandle handle);
#define COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_KEY 42
#define COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_HORZ_KEY 43
#define COMP_DISPLAY_OPTION_MAXIMIZE_WINDOW_VERT_KEY 44
-#define COMP_DISPLAY_OPTION_OPACITY_INCREASE_BUTTON 45
-#define COMP_DISPLAY_OPTION_OPACITY_DECREASE_BUTTON 46
-#define COMP_DISPLAY_OPTION_SCREENSHOT 47
-#define COMP_DISPLAY_OPTION_RUN_SCREENSHOT_KEY 48
-#define COMP_DISPLAY_OPTION_WINDOW_SCREENSHOT 49
-#define COMP_DISPLAY_OPTION_RUN_WINDOW_SCREENSHOT_KEY 50
-#define COMP_DISPLAY_OPTION_WINDOW_MENU_BUTTON 51
-#define COMP_DISPLAY_OPTION_WINDOW_MENU_KEY 52
-#define COMP_DISPLAY_OPTION_SHOW_DESKTOP_KEY 53
-#define COMP_DISPLAY_OPTION_SHOW_DESKTOP_EDGE 54
-#define COMP_DISPLAY_OPTION_RAISE_ON_CLICK 55
-#define COMP_DISPLAY_OPTION_AUDIBLE_BELL 56
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_KEY 57
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_BUTTON 58
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_HORZ_KEY 59
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT_KEY 60
-#define COMP_DISPLAY_OPTION_HIDE_SKIP_TASKBAR_WINDOWS 61
-#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED_KEY 62
-#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 63
-#define COMP_DISPLAY_OPTION_TERMINAL 64
-#define COMP_DISPLAY_OPTION_RUN_TERMINAL_KEY 65
-#define COMP_DISPLAY_OPTION_PING_DELAY 66
-#define COMP_DISPLAY_OPTION_EDGE_DELAY 67
-#define COMP_DISPLAY_OPTION_NUM 68
-
-typedef void (*HandleEventProc) (CompDisplay *display,
- XEvent *event);
-
-typedef void (*HandleCompizEventProc) (CompDisplay *display,
- const char *pluginName,
- const char *eventName,
- CompOption *option,
- int nOption);
+#define COMP_DISPLAY_OPTION_SCREENSHOT 45
+#define COMP_DISPLAY_OPTION_RUN_SCREENSHOT_KEY 46
+#define COMP_DISPLAY_OPTION_WINDOW_SCREENSHOT 47
+#define COMP_DISPLAY_OPTION_RUN_WINDOW_SCREENSHOT_KEY 48
+#define COMP_DISPLAY_OPTION_WINDOW_MENU_BUTTON 49
+#define COMP_DISPLAY_OPTION_WINDOW_MENU_KEY 50
+#define COMP_DISPLAY_OPTION_SHOW_DESKTOP_KEY 51
+#define COMP_DISPLAY_OPTION_SHOW_DESKTOP_EDGE 52
+#define COMP_DISPLAY_OPTION_RAISE_ON_CLICK 53
+#define COMP_DISPLAY_OPTION_AUDIBLE_BELL 54
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_KEY 55
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_BUTTON 56
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_HORZ_KEY 57
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_MAXIMIZED_VERT_KEY 58
+#define COMP_DISPLAY_OPTION_HIDE_SKIP_TASKBAR_WINDOWS 59
+#define COMP_DISPLAY_OPTION_TOGGLE_WINDOW_SHADED_KEY 60
+#define COMP_DISPLAY_OPTION_IGNORE_HINTS_WHEN_MAXIMIZED 61
+#define COMP_DISPLAY_OPTION_TERMINAL 62
+#define COMP_DISPLAY_OPTION_RUN_TERMINAL_KEY 63
+#define COMP_DISPLAY_OPTION_PING_DELAY 64
+#define COMP_DISPLAY_OPTION_EDGE_DELAY 65
+#define COMP_DISPLAY_OPTION_NUM 66
typedef void (*ForEachWindowProc) (CompWindow *window,
void *closure);
-typedef Bool (*FileToImageProc) (CompDisplay *display,
- const char *path,
- const char *name,
- int *width,
- int *height,
- int *stride,
- void **data);
-
-typedef Bool (*ImageToFileProc) (CompDisplay *display,
- const char *path,
- const char *name,
- const char *format,
- int width,
- int height,
- int stride,
- void *data);
-
#define MATCH_OP_AND_MASK (1 << 0)
#define MATCH_OP_NOT_MASK (1 << 1)
@@ -883,221 +716,8 @@ union _CompMatchOp {
CompMatchExpOp exp;
};
-typedef void (*MatchInitExpProc) (CompDisplay *display,
- CompMatchExp *exp,
- const char *value);
-
-typedef void (*MatchExpHandlerChangedProc) (CompDisplay *display);
-
-typedef void (*MatchPropertyChangedProc) (CompDisplay *display,
- CompWindow *window);
-
-typedef void (*LogMessageProc) (CompDisplay *d,
- const char *componentName,
- CompLogLevel level,
- const char *message);
-
-struct _CompDisplay {
- CompObject base;
-
- CompDisplay *next;
-
- xcb_connection_t *connection;
-
- Display *display;
- CompScreen *screens;
-
- CompWatchFdHandle watchFdHandle;
-
- char *screenPrivateIndices;
- int screenPrivateLen;
-
- int compositeEvent, compositeError, compositeOpcode;
- int damageEvent, damageError;
- int syncEvent, syncError;
- int fixesEvent, fixesError, fixesVersion;
-
- Bool randrExtension;
- int randrEvent, randrError;
-
- Bool shapeExtension;
- int shapeEvent, shapeError;
-
- Bool xkbExtension;
- int xkbEvent, xkbError;
-
- Bool xineramaExtension;
- int xineramaEvent, xineramaError;
-
- XineramaScreenInfo *screenInfo;
- int nScreenInfo;
-
- SnDisplay *snDisplay;
-
- Atom supportedAtom;
- Atom supportingWmCheckAtom;
-
- Atom utf8StringAtom;
-
- Atom wmNameAtom;
-
- Atom winTypeAtom;
- Atom winTypeDesktopAtom;
- Atom winTypeDockAtom;
- Atom winTypeToolbarAtom;
- Atom winTypeMenuAtom;
- Atom winTypeUtilAtom;
- Atom winTypeSplashAtom;
- Atom winTypeDialogAtom;
- Atom winTypeNormalAtom;
- Atom winTypeDropdownMenuAtom;
- Atom winTypePopupMenuAtom;
- Atom winTypeTooltipAtom;
- Atom winTypeNotificationAtom;
- Atom winTypeComboAtom;
- Atom winTypeDndAtom;
-
- Atom winOpacityAtom;
- Atom winBrightnessAtom;
- Atom winSaturationAtom;
- Atom winActiveAtom;
- Atom winDesktopAtom;
-
- Atom workareaAtom;
-
- Atom desktopViewportAtom;
- Atom desktopGeometryAtom;
- Atom currentDesktopAtom;
- Atom numberOfDesktopsAtom;
-
- Atom winStateAtom;
- Atom winStateModalAtom;
- Atom winStateStickyAtom;
- Atom winStateMaximizedVertAtom;
- Atom winStateMaximizedHorzAtom;
- Atom winStateShadedAtom;
- Atom winStateSkipTaskbarAtom;
- Atom winStateSkipPagerAtom;
- Atom winStateHiddenAtom;
- Atom winStateFullscreenAtom;
- Atom winStateAboveAtom;
- Atom winStateBelowAtom;
- Atom winStateDemandsAttentionAtom;
- Atom winStateDisplayModalAtom;
-
- Atom winActionMoveAtom;
- Atom winActionResizeAtom;
- Atom winActionStickAtom;
- Atom winActionMinimizeAtom;
- Atom winActionMaximizeHorzAtom;
- Atom winActionMaximizeVertAtom;
- Atom winActionFullscreenAtom;
- Atom winActionCloseAtom;
- Atom winActionShadeAtom;
- Atom winActionChangeDesktopAtom;
- Atom winActionAboveAtom;
- Atom winActionBelowAtom;
-
- Atom wmAllowedActionsAtom;
-
- Atom wmStrutAtom;
- Atom wmStrutPartialAtom;
-
- Atom wmUserTimeAtom;
-
- Atom wmIconAtom;
- Atom wmIconGeometryAtom;
-
- Atom clientListAtom;
- Atom clientListStackingAtom;
-
- Atom frameExtentsAtom;
- Atom frameWindowAtom;
-
- Atom wmStateAtom;
- Atom wmChangeStateAtom;
- Atom wmProtocolsAtom;
- Atom wmClientLeaderAtom;
-
- Atom wmDeleteWindowAtom;
- Atom wmTakeFocusAtom;
- Atom wmPingAtom;
- Atom wmSyncRequestAtom;
-
- Atom wmSyncRequestCounterAtom;
- Atom closeWindowAtom;
- Atom wmMoveResizeAtom;
- Atom moveResizeWindowAtom;
- Atom restackWindowAtom;
- Atom showingDesktopAtom;
-
- Atom xBackgroundAtom[2];
-
- Atom toolkitActionAtom;
- Atom toolkitActionMainMenuAtom;
- Atom toolkitActionRunDialogAtom;
- Atom toolkitActionWindowMenuAtom;
- Atom toolkitActionForceQuitDialogAtom;
-
- Atom mwmHintsAtom;
-
- Atom xdndAwareAtom;
- Atom xdndEnterAtom;
- Atom xdndLeaveAtom;
- Atom xdndPositionAtom;
- Atom xdndStatusAtom;
- Atom xdndDropAtom;
-
- Atom managerAtom;
- Atom targetsAtom;
- Atom multipleAtom;
- Atom timestampAtom;
- Atom versionAtom;
- Atom atomPairAtom;
-
- Atom startupIdAtom;
-
- unsigned int lastPing;
- CompTimeoutHandle pingHandle;
-
- GLenum textureFilter;
-
- Window activeWindow;
-
- Window below;
- char displayString[256];
-
- XModifierKeymap *modMap;
- unsigned int modMask[CompModNum];
- unsigned int ignoredModMask;
-
- KeyCode escapeKeyCode;
- KeyCode returnKeyCode;
-
- CompOption opt[COMP_DISPLAY_OPTION_NUM];
-
- CompTimeoutHandle autoRaiseHandle;
- Window autoRaiseWindow;
-
- CompTimeoutHandle edgeDelayHandle;
-
- CompOptionValue plugin;
- Bool dirtyPluginList;
-
- HandleEventProc handleEvent;
- HandleCompizEventProc handleCompizEvent;
-
- FileToImageProc fileToImage;
- ImageToFileProc imageToFile;
-
- MatchInitExpProc matchInitExp;
- MatchExpHandlerChangedProc matchExpHandlerChanged;
- MatchPropertyChangedProc matchPropertyChanged;
-
- LogMessageProc logMessage;
-};
#define GET_CORE_DISPLAY(object) ((CompDisplay *) (object))
#define CORE_DISPLAY(object) CompDisplay *d = GET_CORE_DISPLAY (object)
@@ -1131,14 +751,8 @@ allocateDisplayPrivateIndex (void);
void
freeDisplayPrivateIndex (int index);
-CompOption *
-getDisplayOptions (CompPlugin *plugin,
- CompDisplay *display,
- int *count);
-
-Bool
-setDisplayOption (CompPlugin *plugin,
- CompDisplay *display,
+bool
+setDisplayOption (CompObject *object,
const char *name,
CompOptionValue *value);
@@ -1149,12 +763,6 @@ compLogMessage (CompDisplay *d,
const char *format,
...);
-void
-logMessage (CompDisplay *d,
- const char *componentName,
- CompLogLevel level,
- const char *message);
-
const char *
logLevelToString (CompLogLevel level);
@@ -1162,58 +770,6 @@ int
compCheckForError (Display *dpy);
void
-addScreenToDisplay (CompDisplay *display,
- CompScreen *s);
-
-Bool
-addDisplay (const char *name);
-
-void
-removeDisplay (CompDisplay *d);
-
-Time
-getCurrentTimeFromDisplay (CompDisplay *d);
-
-void
-forEachWindowOnDisplay (CompDisplay *display,
- ForEachWindowProc proc,
- void *closure);
-
-CompScreen *
-findScreenAtDisplay (CompDisplay *d,
- Window root);
-
-CompWindow *
-findWindowAtDisplay (CompDisplay *display,
- Window id);
-
-CompWindow *
-findTopLevelWindowAtDisplay (CompDisplay *d,
- Window id);
-
-unsigned int
-virtualToRealModMask (CompDisplay *d,
- unsigned int modMask);
-
-void
-updateModifierMappings (CompDisplay *d);
-
-unsigned int
-keycodeToModifiers (CompDisplay *d,
- int keycode);
-
-void
-eventLoop (void);
-
-void
-handleSelectionRequest (CompDisplay *display,
- XEvent *event);
-
-void
-handleSelectionClear (CompDisplay *display,
- XEvent *event);
-
-void
warpPointer (CompScreen *screen,
int dx,
int dy);
@@ -1223,44 +779,6 @@ setDisplayAction (CompDisplay *display,
CompOption *o,
CompOptionValue *value);
-Bool
-readImageFromFile (CompDisplay *display,
- const char *name,
- int *width,
- int *height,
- void **data);
-
-Bool
-writeImageToFile (CompDisplay *display,
- const char *path,
- const char *name,
- const char *format,
- int width,
- int height,
- void *data);
-
-Bool
-fileToImage (CompDisplay *display,
- const char *path,
- const char *name,
- int *width,
- int *height,
- int *stride,
- void **data);
-
-Bool
-imageToFile (CompDisplay *display,
- const char *path,
- const char *name,
- const char *format,
- int width,
- int height,
- int stride,
- void *data);
-
-CompCursor *
-findCursorAtDisplay (CompDisplay *display);
-
/* event.c */
@@ -1275,16 +793,6 @@ typedef struct _CompDelayedEdgeSettings
unsigned int nOption;
} CompDelayedEdgeSettings;
-void
-handleEvent (CompDisplay *display,
- XEvent *event);
-
-void
-handleCompizEvent (CompDisplay *display,
- const char *pluginName,
- const char *eventName,
- CompOption *option,
- int nOption);
void
handleSyncAlarm (CompWindow *w);
@@ -1299,10 +807,6 @@ eventTerminates (CompDisplay *display,
XEvent *event,
CompOption *option);
-void
-clearTargetOutput (CompDisplay *display,
- unsigned int mask);
-
/* paint.c */
#define MULTIPLY_USHORT(us1, us2) \
@@ -1366,12 +870,6 @@ typedef struct _CompMatrix {
#define COMP_TEX_COORD_YX(m, vx, vy) \
((m)->yx * (vx) + (m)->yy * (vy) + (m)->y0)
-
-typedef void (*PreparePaintScreenProc) (CompScreen *screen,
- int msSinceLastPaint);
-
-typedef void (*DonePaintScreenProc) (CompScreen *screen);
-
#define PAINT_SCREEN_REGION_MASK (1 << 0)
#define PAINT_SCREEN_FULL_MASK (1 << 1)
#define PAINT_SCREEN_TRANSFORMED_MASK (1 << 2)
@@ -1380,37 +878,7 @@ typedef void (*DonePaintScreenProc) (CompScreen *screen);
#define PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK (1 << 5)
#define PAINT_SCREEN_NO_BACKGROUND_MASK (1 << 6)
-typedef void (*PaintScreenProc) (CompScreen *screen,
- CompOutput *outputs,
- int numOutput,
- unsigned int mask);
-
-typedef Bool (*PaintOutputProc) (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
-
-typedef void (*PaintTransformedOutputProc) (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
-
-/* XXX: ApplyScreenTransformProc will be removed */
-typedef void (*ApplyScreenTransformProc) (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- CompOutput *output,
- CompTransform *transform);
-
-typedef void (*EnableOutputClippingProc) (CompScreen *screen,
- const CompTransform *transform,
- Region region,
- CompOutput *output);
-
-typedef void (*DisableOutputClippingProc) (CompScreen *screen);
+
typedef void (*WalkerFiniProc) (CompScreen *screen,
CompWalker *walker);
@@ -1479,48 +947,6 @@ struct _CompWalker {
#define PAINT_WINDOW_BLEND_MASK (1 << 19)
-typedef Bool (*PaintWindowProc) (CompWindow *window,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask);
-
-typedef Bool (*DrawWindowProc) (CompWindow *window,
- const CompTransform *transform,
- const FragmentAttrib *fragment,
- Region region,
- unsigned int mask);
-
-typedef void (*AddWindowGeometryProc) (CompWindow *window,
- CompMatrix *matrix,
- int nMatrix,
- Region region,
- Region clip);
-
-typedef void (*DrawWindowTextureProc) (CompWindow *w,
- CompTexture *texture,
- const FragmentAttrib *fragment,
- unsigned int mask);
-
-typedef void (*DrawWindowGeometryProc) (CompWindow *window);
-
-typedef void (*PaintCursorProc) (CompCursor *cursor,
- const CompTransform *transform,
- Region region,
- unsigned int mask);
-
-void
-preparePaintScreen (CompScreen *screen,
- int msSinceLastPaint);
-
-void
-donePaintScreen (CompScreen *screen);
-
-void
-transformToScreenSpace (CompScreen *screen,
- CompOutput *output,
- float z,
- CompTransform *transform);
/* XXX: prepareXCoords will be removed */
void
@@ -1528,43 +954,6 @@ prepareXCoords (CompScreen *screen,
CompOutput *output,
float z);
-void
-paintTransformedOutput (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
-
-/* XXX: applyScreenTransform will be removed */
-void
-applyScreenTransform (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- CompOutput *output,
- CompTransform *transform);
-
-void
-enableOutputClipping (CompScreen *screen,
- const CompTransform *transform,
- Region region,
- CompOutput *output);
-
-void
-disableOutputClipping (CompScreen *screen);
-
-void
-paintScreen (CompScreen *screen,
- CompOutput *outputs,
- int numOutput,
- unsigned int mask);
-
-Bool
-paintOutput (CompScreen *screen,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask);
Bool
moreWindowVertices (CompWindow *w,
@@ -1581,32 +970,6 @@ addWindowGeometry (CompWindow *w,
Region region,
Region clip);
-void
-drawWindowTexture (CompWindow *w,
- CompTexture *texture,
- const FragmentAttrib *fragment,
- unsigned int mask);
-
-Bool
-drawWindow (CompWindow *w,
- const CompTransform *transform,
- const FragmentAttrib *fragment,
- Region region,
- unsigned int mask);
-
-Bool
-paintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask);
-
-void
-paintCursor (CompCursor *cursor,
- const CompTransform *transform,
- Region region,
- unsigned int mask);
-
/* texture.c */
#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
@@ -1674,22 +1037,8 @@ Bool
iconToTexture (CompScreen *screen,
CompIcon *icon);
-Bool
-bindPixmapToTexture (CompScreen *screen,
- CompTexture *texture,
- Pixmap pixmap,
- int width,
- int height,
- int depth);
-void
-releasePixmapFromTexture (CompScreen *screen,
- CompTexture *texture);
-void
-enableTexture (CompScreen *screen,
- CompTexture *texture,
- CompTextureFilter filter);
void
enableTextureClampToBorder (CompScreen *screen,
@@ -1701,10 +1050,6 @@ enableTextureClampToEdge (CompScreen *screen,
CompTexture *texture,
CompTextureFilter filter);
-void
-disableTexture (CompScreen *screen,
- CompTexture *texture);
-
/* screen.c */
@@ -1723,11 +1068,9 @@ disableTexture (CompScreen *screen,
#define COMP_SCREEN_OPTION_OVERLAPPING_OUTPUTS 12
#define COMP_SCREEN_OPTION_FOCUS_PREVENTION_LEVEL 13
#define COMP_SCREEN_OPTION_FOCUS_PREVENTION_MATCH 14
-#define COMP_SCREEN_OPTION_OPACITY_MATCHES 15
-#define COMP_SCREEN_OPTION_OPACITY_VALUES 16
-#define COMP_SCREEN_OPTION_TEXTURE_COMPRESSION 17
-#define COMP_SCREEN_OPTION_FORCE_INDEPENDENT 18
-#define COMP_SCREEN_OPTION_NUM 19
+#define COMP_SCREEN_OPTION_TEXTURE_COMPRESSION 15
+#define COMP_SCREEN_OPTION_FORCE_INDEPENDENT 16
+#define COMP_SCREEN_OPTION_NUM 17
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
@@ -1844,10 +1187,7 @@ typedef void (*GLGenerateMipmapProc) (GLenum target);
#define MAX_DEPTH 32
-typedef void (*EnterShowDesktopModeProc) (CompScreen *screen);
-typedef void (*LeaveShowDesktopModeProc) (CompScreen *screen,
- CompWindow *window);
typedef Bool (*DamageWindowRectProc) (CompWindow *w,
Bool initial,
@@ -1856,10 +1196,6 @@ typedef Bool (*DamageWindowRectProc) (CompWindow *w,
typedef Bool (*DamageWindowRegionProc) (CompWindow *w,
Region region);
-typedef Bool (*DamageCursorRectProc) (CompCursor *c,
- Bool initial,
- BoxPtr rect);
-
typedef void (*GetOutputExtentsForWindowProc) (CompWindow *w,
CompWindowExtents *output);
@@ -1898,21 +1234,9 @@ typedef void (*WindowMoveNotifyProc) (CompWindow *window,
#define CompWindowGrabMoveMask (1 << 2)
#define CompWindowGrabResizeMask (1 << 3)
-typedef void (*WindowGrabNotifyProc) (CompWindow *window,
- int x,
- int y,
- unsigned int state,
- unsigned int mask);
-typedef void (*WindowUngrabNotifyProc) (CompWindow *window);
-typedef void (*WindowStateChangeNotifyProc) (CompWindow *window,
- unsigned int lastState);
-typedef void (*OutputChangeNotifyProc) (CompScreen *screen);
-
-typedef void (*InitWindowWalkerProc) (CompScreen *screen,
- CompWalker *walker);
#define COMP_SCREEN_DAMAGE_PENDING_MASK (1 << 0)
#define COMP_SCREEN_DAMAGE_REGION_MASK (1 << 1)
@@ -2025,214 +1349,6 @@ typedef struct _CompActiveWindowHistory {
int activeNum;
} CompActiveWindowHistory;
-struct _CompScreen {
- CompObject base;
-
- CompScreen *next;
- CompDisplay *display;
- CompWindow *windows;
- CompWindow *reverseWindows;
-
- char *windowPrivateIndices;
- int windowPrivateLen;
-
- Colormap colormap;
- int screenNum;
- int width;
- int height;
- int x;
- int y;
- int hsize; /* Number of horizontal viewports */
- int vsize; /* Number of vertical viewports */
- unsigned int nDesktop;
- unsigned int currentDesktop;
- REGION region;
- Region damage;
- unsigned long damageMask;
- Window root;
- Window overlay;
- Window output;
- XWindowAttributes attrib;
- Window grabWindow;
- CompFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1];
- int textureRectangle;
- int textureNonPowerOfTwo;
- int textureEnvCombine;
- int textureEnvCrossbar;
- int textureBorderClamp;
- int textureCompression;
- GLint maxTextureSize;
- int fbo;
- int fragmentProgram;
- int maxTextureUnits;
- Cursor invisibleCursor;
- XRectangle *exposeRects;
- int sizeExpose;
- int nExpose;
- CompTexture backgroundTexture;
- Bool backgroundLoaded;
- unsigned int pendingDestroys;
- int desktopWindowCount;
- unsigned int mapNum;
- unsigned int activeNum;
-
- CompOutput *outputDev;
- int nOutputDev;
- int currentOutputDev;
- CompOutput fullscreenOutput;
- Bool hasOverlappingOutputs;
-
- int windowOffsetX;
- int windowOffsetY;
-
- XRectangle lastViewport;
-
- CompActiveWindowHistory history[ACTIVE_WINDOW_HISTORY_NUM];
- int currentHistory;
-
- int overlayWindowCount;
-
- CompScreenEdge screenEdge[SCREEN_EDGE_NUM];
-
- SnMonitorContext *snContext;
- CompStartupSequence *startupSequences;
- unsigned int startupSequenceTimeoutHandle;
-
- int filter[3];
-
- CompGroup *groups;
-
- CompIcon *defaultIcon;
-
- Bool canDoSaturated;
- Bool canDoSlightlySaturated;
-
- Window wmSnSelectionWindow;
- Atom wmSnAtom;
- Time wmSnTimestamp;
-
- Cursor normalCursor;
- Cursor busyCursor;
-
- CompWindow **clientList;
- int nClientList;
-
- CompButtonGrab *buttonGrab;
- int nButtonGrab;
- CompKeyGrab *keyGrab;
- int nKeyGrab;
-
- CompGrab *grabs;
- int grabSize;
- int maxGrab;
-
- int rasterX;
- int rasterY;
- struct timeval lastRedraw;
- int nextRedraw;
- int redrawTime;
- int optimalRedrawTime;
- int frameStatus;
- int timeMult;
- Bool idle;
- int timeLeft;
- Bool pendingCommands;
-
- int lastFunctionId;
-
- CompFunction *fragmentFunctions;
- CompProgram *fragmentPrograms;
-
- int saturateFunction[2][64];
-
- GLfloat projection[16];
-
- Bool clearBuffers;
-
- Bool lighting;
- Bool slowAnimations;
-
- XRectangle workArea;
-
- unsigned int showingDesktopMask;
-
- unsigned long *desktopHintData;
- int desktopHintSize;
-
- CompCursor *cursors;
- CompCursorImage *cursorImages;
-
- GLXGetProcAddressProc getProcAddress;
- 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;
-
- GLXContext ctx;
-
- CompOption opt[COMP_SCREEN_OPTION_NUM];
-
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintScreenProc paintScreen;
- PaintOutputProc paintOutput;
- PaintTransformedOutputProc paintTransformedOutput;
- EnableOutputClippingProc enableOutputClipping;
- DisableOutputClippingProc disableOutputClipping;
- ApplyScreenTransformProc applyScreenTransform;
- PaintWindowProc paintWindow;
- DrawWindowProc drawWindow;
- AddWindowGeometryProc addWindowGeometry;
- DrawWindowTextureProc drawWindowTexture;
- DamageWindowRectProc damageWindowRect;
- GetOutputExtentsForWindowProc getOutputExtentsForWindow;
- GetAllowedActionsForWindowProc getAllowedActionsForWindow;
- FocusWindowProc focusWindow;
- ActivateWindowProc activateWindow;
- PlaceWindowProc placeWindow;
- ValidateWindowResizeRequestProc validateWindowResizeRequest;
-
- PaintCursorProc paintCursor;
- DamageCursorRectProc damageCursorRect;
-
- WindowResizeNotifyProc windowResizeNotify;
- WindowMoveNotifyProc windowMoveNotify;
- WindowGrabNotifyProc windowGrabNotify;
- WindowUngrabNotifyProc windowUngrabNotify;
-
- EnterShowDesktopModeProc enterShowDesktopMode;
- LeaveShowDesktopModeProc leaveShowDesktopMode;
-
- WindowStateChangeNotifyProc windowStateChangeNotify;
-
- OutputChangeNotifyProc outputChangeNotify;
-
- InitWindowWalkerProc initWindowWalker;
-};
#define GET_CORE_SCREEN(object) ((CompScreen *) (object))
#define CORE_SCREEN(object) CompScreen *s = GET_CORE_SCREEN (object)
@@ -2267,282 +1383,15 @@ void
freeScreenPrivateIndex (CompDisplay *display,
int index);
-CompOption *
-getScreenOptions (CompPlugin *plugin,
- CompScreen *screen,
- int *count);
-
-Bool
-setScreenOption (CompPlugin *plugin,
- CompScreen *screen,
+bool
+setScreenOption (CompObject *object,
const char *name,
CompOptionValue *value);
-void
-configureScreen (CompScreen *s,
- XConfigureEvent *ce);
-
-void
-setCurrentOutput (CompScreen *s,
- int outputNum);
-
-void
-updateScreenBackground (CompScreen *screen,
- CompTexture *texture);
-
-void
-detectRefreshRateOfScreen (CompScreen *s);
-
-void
-showOutputWindow (CompScreen *s);
-
-void
-hideOutputWindow (CompScreen *s);
-
-void
-updateOutputWindow (CompScreen *s);
-
-Bool
-addScreen (CompDisplay *display,
- int screenNum,
- Window wmSnSelectionWindow,
- Atom wmSnAtom,
- Time wmSnTimestamp);
-
-void
-removeScreen (CompScreen *s);
-
-void
-damageScreenRegion (CompScreen *screen,
- Region region);
-
-void
-damageScreen (CompScreen *screen);
-
-void
-damagePendingOnScreen (CompScreen *s);
-
-void
-insertWindowIntoScreen (CompScreen *s,
- CompWindow *w,
- Window aboveId);
-
-void
-unhookWindowFromScreen (CompScreen *s,
- CompWindow *w);
-
-void
-forEachWindowOnScreen (CompScreen *screen,
- ForEachWindowProc proc,
- void *closure);
-
-CompWindow *
-findWindowAtScreen (CompScreen *s,
- Window id);
-
-CompWindow *
-findTopLevelWindowAtScreen (CompScreen *s,
- Window id);
-
-void
-focusDefaultWindow (CompScreen *s);
-
-int
-pushScreenGrab (CompScreen *s,
- Cursor cursor,
- const char *name);
-
-void
-updateScreenGrab (CompScreen *s,
- int index,
- Cursor cursor);
-
-void
-removeScreenGrab (CompScreen *s,
- int index,
- XPoint *restorePointer);
-
-Bool
-otherScreenGrabExist (CompScreen *s, ...);
-
-Bool
-addScreenAction (CompScreen *s,
- CompAction *action);
-
-void
-removeScreenAction (CompScreen *s,
- CompAction *action);
-
-void
-updatePassiveGrabs (CompScreen *s);
-
-void
-updateWorkareaForScreen (CompScreen *s);
-
-void
-updateClientListForScreen (CompScreen *s);
-
-Window
-getActiveWindow (CompDisplay *display,
- Window root);
-
-void
-toolkitAction (CompScreen *s,
- Atom toolkitAction,
- Time eventTime,
- Window window,
- long data0,
- long data1,
- long data2);
-
-void
-runCommand (CompScreen *s,
- const char *command);
-
-void
-moveScreenViewport (CompScreen *s,
- int tx,
- int ty,
- Bool sync);
-
-void
-moveWindowToViewportPosition (CompWindow *w,
- int x,
- int y,
- Bool sync);
-
-CompGroup *
-addGroupToScreen (CompScreen *s,
- Window id);
-void
-removeGroupFromScreen (CompScreen *s,
- CompGroup *group);
-
-CompGroup *
-findGroupAtScreen (CompScreen *s,
- Window id);
-
-void
-applyStartupProperties (CompScreen *screen,
- CompWindow *window);
-
-void
-sendWindowActivationRequest (CompScreen *s,
- Window id);
-
-void
-screenTexEnvMode (CompScreen *s,
- GLenum mode);
-
-void
-screenLighting (CompScreen *s,
- Bool lighting);
-
-void
-enableScreenEdge (CompScreen *s,
- int edge);
-
-void
-disableScreenEdge (CompScreen *s,
- int edge);
-
-Window
-getTopWindow (CompScreen *s);
-
-void
-makeScreenCurrent (CompScreen *s);
-
-void
-finishScreenDrawing (CompScreen *s);
-
-int
-outputDeviceForPoint (CompScreen *s,
- int x,
- int y);
-
-void
-getCurrentOutputExtents (CompScreen *s,
- int *x1,
- int *y1,
- int *x2,
- int *y2);
-
-void
-getWorkareaForOutput (CompScreen *s,
- int output,
- XRectangle *area);
-
-void
-setNumberOfDesktops (CompScreen *s,
- unsigned int nDesktop);
-
-void
-setCurrentDesktop (CompScreen *s,
- unsigned int desktop);
-
-void
-setDefaultViewport (CompScreen *s);
-
-void
-outputChangeNotify (CompScreen *s);
-
-void
-clearScreenOutput (CompScreen *s,
- CompOutput *output,
- unsigned int mask);
-
-void
-viewportForGeometry (CompScreen *s,
- int x,
- int y,
- int width,
- int height,
- int borderWidth,
- int *viewportX,
- int *viewportY);
-
-int
-outputDeviceForGeometry (CompScreen *s,
- int x,
- int y,
- int width,
- int height,
- int borderWidth);
-
-Bool
-updateDefaultIcon (CompScreen *screen);
-
-CompCursor *
-findCursorAtScreen (CompScreen *screen);
-
-CompCursorImage *
-findCursorImageAtScreen (CompScreen *screen,
- unsigned long serial);
-
-void
-setCurrentActiveWindowHistory (CompScreen *s,
- int x,
- int y);
-
-void
-addToCurrentActiveWindowHistory (CompScreen *s,
- Window id);
-
-void
-setWindowPaintOffset (CompScreen *s,
- int x,
- int y);
/* window.c */
-#define WINDOW_INVISIBLE(w) \
- ((w)->attrib.map_state != IsViewable || \
- (!(w)->damaged) || \
- (w)->attrib.x + (w)->width + (w)->output.right <= 0 || \
- (w)->attrib.y + (w)->height + (w)->output.bottom <= 0 || \
- (w)->attrib.x - (w)->output.left >= (w)->screen->width || \
- (w)->attrib.y - (w)->output.top >= (w)->screen->height)
typedef enum {
CompStackingUpdateModeNone = 0,
@@ -2566,140 +1415,6 @@ typedef struct _CompStruts {
XRectangle bottom;
} CompStruts;
-struct _CompWindow {
- CompObject base;
-
- CompScreen *screen;
- CompWindow *next;
- CompWindow *prev;
-
- int refcnt;
- Window id;
- Window frame;
- unsigned int mapNum;
- unsigned int activeNum;
- XWindowAttributes attrib;
- int serverX;
- int serverY;
- int serverWidth;
- int serverHeight;
- int serverBorderWidth;
- Window transientFor;
- Window clientLeader;
- XSizeHints sizeHints;
- Pixmap pixmap;
- CompTexture *texture;
- CompMatrix matrix;
- Damage damage;
- Bool inputHint;
- Bool alpha;
- GLint width;
- GLint height;
- Region region;
- Region clip;
- unsigned int wmType;
- unsigned int type;
- unsigned int state;
- unsigned int actions;
- unsigned int protocols;
- unsigned int mwmDecor;
- unsigned int mwmFunc;
- Bool invisible;
- Bool destroyed;
- Bool damaged;
- Bool redirected;
- Bool managed;
- Bool bindFailed;
- Bool overlayWindow;
- int destroyRefCnt;
- int unmapRefCnt;
-
- unsigned int initialViewportX;
- unsigned int initialViewportY;
-
- Time initialTimestamp;
- Bool initialTimestampSet;
-
- Bool placed;
- Bool minimized;
- Bool inShowDesktopMode;
- Bool shaded;
- Bool hidden;
- Bool grabbed;
-
- unsigned int desktop;
-
- int pendingUnmaps;
- int pendingMaps;
-
- char *startupId;
- char *resName;
- char *resClass;
-
- CompGroup *group;
-
- unsigned int lastPong;
- Bool alive;
-
- GLushort opacity;
- GLushort brightness;
- GLushort saturation;
-
- Bool opacityPropSet;
- int opacityFactor;
-
- WindowPaintAttrib paint;
- WindowPaintAttrib lastPaint;
-
- unsigned int lastMask;
-
- CompWindowExtents input;
- CompWindowExtents output;
-
- CompStruts *struts;
-
- CompIcon **icon;
- int nIcon;
-
- XRectangle iconGeometry;
- Bool iconGeometrySet;
-
- XWindowChanges saveWc;
- int saveMask;
-
- XSyncCounter syncCounter;
- XSyncValue syncValue;
- XSyncAlarm syncAlarm;
- unsigned long syncAlarmConnection;
- unsigned int syncWaitHandle;
-
- Bool syncWait;
- int syncX;
- int syncY;
- int syncWidth;
- int syncHeight;
- int syncBorderWidth;
-
- Bool closeRequests;
- Time lastCloseRequestTime;
-
- XRectangle *damageRects;
- int sizeDamage;
- int nDamage;
-
- GLfloat *vertices;
- int vertexSize;
- int vertexStride;
- GLushort *indices;
- int indexSize;
- int vCount;
- int texUnits;
- int texCoordSize;
- int indexCount;
-
- /* must be set by addWindowGeometry */
- DrawWindowGeometryProc drawWindowGeometry;
-};
#define GET_CORE_WINDOW(object) ((CompWindow *) (object))
#define CORE_WINDOW(object) CompWindow *w = GET_CORE_WINDOW (object)
@@ -2734,385 +1449,6 @@ void
freeWindowPrivateIndex (CompScreen *screen,
int index);
-unsigned int
-windowStateMask (CompDisplay *display,
- Atom state);
-
-unsigned int
-windowStateFromString (const char *str);
-
-unsigned int
-getWindowState (CompDisplay *display,
- Window id);
-
-void
-setWindowState (CompDisplay *display,
- unsigned int state,
- Window id);
-
-void
-changeWindowState (CompWindow *w,
- unsigned int newState);
-
-void
-recalcWindowActions (CompWindow *w);
-
-unsigned int
-constrainWindowState (unsigned int state,
- unsigned int actions);
-
-unsigned int
-windowTypeFromString (const char *str);
-
-unsigned int
-getWindowType (CompDisplay *display,
- Window id);
-
-void
-recalcWindowType (CompWindow *w);
-
-void
-getMwmHints (CompDisplay *display,
- Window id,
- unsigned int *func,
- unsigned int *decor);
-
-unsigned int
-getProtocols (CompDisplay *display,
- Window id);
-
-unsigned int
-getWindowProp (CompDisplay *display,
- Window id,
- Atom property,
- unsigned int defaultValue);
-
-void
-setWindowProp (CompDisplay *display,
- Window id,
- Atom property,
- unsigned int value);
-
-Bool
-readWindowProp32 (CompDisplay *display,
- Window id,
- Atom property,
- unsigned short *returnValue);
-
-unsigned short
-getWindowProp32 (CompDisplay *display,
- Window id,
- Atom property,
- unsigned short defaultValue);
-
-void
-setWindowProp32 (CompDisplay *display,
- Window id,
- Atom property,
- unsigned short value);
-
-void
-updateWindowOpacity (CompWindow *window);
-
-void
-updateNormalHints (CompWindow *window);
-
-void
-updateWmHints (CompWindow *w);
-
-void
-updateWindowClassHints (CompWindow *window);
-
-void
-updateTransientHint (CompWindow *w);
-
-void
-updateIconGeometry (CompWindow *w);
-
-Window
-getClientLeader (CompWindow *w);
-
-char *
-getStartupId (CompWindow *w);
-
-int
-getWmState (CompDisplay *display,
- Window id);
-
-void
-setWmState (CompDisplay *display,
- int state,
- Window id);
-
-void
-setWindowFrameExtents (CompWindow *w,
- CompWindowExtents *input);
-
-void
-updateWindowOutputExtents (CompWindow *w);
-
-void
-updateWindowRegion (CompWindow *w);
-
-Bool
-updateWindowStruts (CompWindow *w);
-
-void
-addWindow (CompScreen *screen,
- Window id,
- Window aboveId);
-
-void
-removeWindow (CompWindow *w);
-
-void
-destroyWindow (CompWindow *w);
-
-void
-sendConfigureNotify (CompWindow *w);
-
-void
-mapWindow (CompWindow *w);
-
-void
-unmapWindow (CompWindow *w);
-
-Bool
-bindWindow (CompWindow *w);
-
-void
-releaseWindow (CompWindow *w);
-
-void
-moveWindow (CompWindow *w,
- int dx,
- int dy,
- Bool damage,
- Bool immediate);
-
-void
-configureXWindow (CompWindow *w,
- unsigned int valueMask,
- XWindowChanges *xwc);
-
-unsigned int
-adjustConfigureRequestForGravity (CompWindow *w,
- XWindowChanges *xwc,
- unsigned int xwcm,
- int gravity);
-
-void
-moveResizeWindow (CompWindow *w,
- XWindowChanges *xwc,
- unsigned int xwcm,
- int gravity);
-
-void
-syncWindowPosition (CompWindow *w);
-
-void
-sendSyncRequest (CompWindow *w);
-
-Bool
-resizeWindow (CompWindow *w,
- int x,
- int y,
- int width,
- int height,
- int borderWidth);
-
-void
-configureWindow (CompWindow *w,
- XConfigureEvent *ce);
-
-void
-circulateWindow (CompWindow *w,
- XCirculateEvent *ce);
-
-void
-addWindowDamageRect (CompWindow *w,
- BoxPtr rect);
-
-void
-getOutputExtentsForWindow (CompWindow *w,
- CompWindowExtents *output);
-
-void
-getAllowedActionsForWindow (CompWindow *w,
- unsigned int *setActions,
- unsigned int *clearActions);
-
-void
-addWindowDamage (CompWindow *w);
-
-void
-damageWindowOutputExtents (CompWindow *w);
-
-Bool
-damageWindowRect (CompWindow *w,
- Bool initial,
- BoxPtr rect);
-
-void
-damageTransformedWindowRect (CompWindow *w,
- float xScale,
- float yScale,
- float xTranslate,
- float yTranslate,
- BoxPtr rect);
-
-Bool
-focusWindow (CompWindow *w);
-
-Bool
-placeWindow (CompWindow *w,
- int x,
- int y,
- int *newX,
- int *newY);
-
-void
-validateWindowResizeRequest (CompWindow *w,
- unsigned int *mask,
- XWindowChanges *xwc);
-
-void
-windowResizeNotify (CompWindow *w,
- int dx,
- int dy,
- int dwidth,
- int dheight);
-
-void
-windowMoveNotify (CompWindow *w,
- int dx,
- int dy,
- Bool immediate);
-
-void
-windowGrabNotify (CompWindow *w,
- int x,
- int y,
- unsigned int state,
- unsigned int mask);
-
-void
-windowUngrabNotify (CompWindow *w);
-
-void
-windowStateChangeNotify (CompWindow *w,
- unsigned int lastState);
-
-void
-moveInputFocusToWindow (CompWindow *w);
-
-void
-updateWindowSize (CompWindow *w);
-
-void
-raiseWindow (CompWindow *w);
-
-void
-lowerWindow (CompWindow *w);
-
-void
-restackWindowAbove (CompWindow *w,
- CompWindow *sibling);
-
-void
-restackWindowBelow (CompWindow *w,
- CompWindow *sibling);
-
-void
-updateWindowAttributes (CompWindow *w,
- CompStackingUpdateMode stackingMode);
-
-void
-activateWindow (CompWindow *w);
-
-void
-closeWindow (CompWindow *w,
- Time serverTime);
-
-Bool
-constrainNewWindowSize (CompWindow *w,
- int width,
- int height,
- int *newWidth,
- int *newHeight);
-
-void
-hideWindow (CompWindow *w);
-
-void
-showWindow (CompWindow *w);
-
-void
-minimizeWindow (CompWindow *w);
-
-void
-unminimizeWindow (CompWindow *w);
-
-void
-maximizeWindow (CompWindow *w,
- int state);
-
-Bool
-getWindowUserTime (CompWindow *w,
- Time *time);
-
-void
-setWindowUserTime (CompWindow *w,
- Time time);
-
-Bool
-allowWindowFocus (CompWindow *w,
- unsigned int noFocusMask,
- Time timestamp);
-
-void
-unredirectWindow (CompWindow *w);
-
-void
-redirectWindow (CompWindow *w);
-
-void
-defaultViewportForWindow (CompWindow *w,
- int *vx,
- int *vy);
-
-CompIcon *
-getWindowIcon (CompWindow *w,
- int width,
- int height);
-
-void
-freeWindowIcons (CompWindow *w);
-
-int
-outputDeviceForWindow (CompWindow *w);
-
-Bool
-onCurrentDesktop (CompWindow *w);
-
-void
-setDesktopForWindow (CompWindow *w,
- unsigned int desktop);
-
-int
-compareWindowActiveness (CompWindow *w1,
- CompWindow *w2);
-
-Bool
-windowOnAllViewports (CompWindow *w);
-
-void
-getWindowMovementForOffset (CompWindow *w,
- int offX,
- int offY,
- int *retX,
- int *retY);
-
/* plugin.c */
#define HOME_PLUGINDIR ".compiz/plugins"
@@ -3266,7 +1602,7 @@ void
initFragmentAttrib (FragmentAttrib *attrib,
const WindowPaintAttrib *paint);
-Bool
+bool
enableFragmentAttrib (CompScreen *s,
FragmentAttrib *attrib,
Bool *blending);
@@ -3315,9 +1651,6 @@ matrixGetIdentity (CompTransform *m);
/* cursor.c */
-void
-addCursor (CompScreen *s);
-
Bool
damageCursorRect (CompCursor *c,
Bool initial,
@@ -3400,9 +1733,9 @@ matchPropertyChanged (CompDisplay *display,
#define RESTOSTRING(min, max) MINTOSTRING (min) MAXTOSTRING (max)
typedef struct _CompMetadataOptionInfo {
- char *name;
- char *type;
- char *data;
+ const char *name;
+ const char *type;
+ const char *data;
CompActionCallBackProc initiate;
CompActionCallBackProc terminate;
} CompMetadataOptionInfo;
@@ -3511,4 +1844,10 @@ compReadXmlChunkFromMetadataOptionInfo (const CompMetadataOptionInfo *info,
COMPIZ_END_DECLS
+#include <compobject.h>
+#include <compcore.h>
+#include <compdisplay.h>
+#include <compscreen.h>
+#include <compwindow.h>
+
#endif
diff --git a/include/compiz.h b/include/compiz.h
index cc73797..ca50395 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -38,16 +38,18 @@ typedef int CompWatchFdHandle;
typedef union _CompOptionValue CompOptionValue;
-typedef struct _CompObject CompObject;
-typedef struct _CompCore CompCore;
-typedef struct _CompDisplay CompDisplay;
typedef struct _CompMetadata CompMetadata;
typedef struct _CompOption CompOption;
typedef struct _CompPlugin CompPlugin;
-typedef struct _CompScreen CompScreen;
-typedef struct _CompWindow CompWindow;
-typedef CompBool (*CallBackProc) (void *closure);
+
+class CompCore;
+class CompDisplay;
+class CompScreen;
+class CompWindow;
+class CompObject;
+
+typedef bool (*CallBackProc) (void *closure);
typedef enum {
CompOptionTypeBool,
@@ -119,27 +121,6 @@ CompBool
compSetOption (CompOption *option,
CompOptionValue *value);
-CompTimeoutHandle
-compAddTimeout (int minTime,
- int maxTime,
- CallBackProc callBack,
- void *closure);
-
-void *
-compRemoveTimeout (CompTimeoutHandle handle);
-
-CompWatchFdHandle
-compAddWatchFd (int fd,
- short int events,
- CallBackProc callBack,
- void *closure);
-
-void
-compRemoveWatchFd (CompWatchFdHandle handle);
-
-short int
-compWatchFdEvents (CompWatchFdHandle handle);
-
CompBool
compInitMetadata (CompMetadata *metadata);
diff --git a/include/compobject.h b/include/compobject.h
new file mode 100644
index 0000000..a95ced7
--- /dev/null
+++ b/include/compobject.h
@@ -0,0 +1,13 @@
+#ifndef _COMPOBJECT_H
+#define _COMPOBJECT_H
+
+class CompObject {
+ public :
+
+ CompObjectType type;
+ CompPrivate *privates;
+ CompObject *parent;
+};
+
+
+#endif
diff --git a/include/compiz-plugin.h b/include/compplugin.h
index b8a30f6..f6d69de 100644
--- a/include/compiz-plugin.h
+++ b/include/compplugin.h
@@ -28,43 +28,51 @@
#include <compiz.h>
-COMPIZ_BEGIN_DECLS
-
-typedef CompBool (*InitPluginProc) (CompPlugin *plugin);
-typedef void (*FiniPluginProc) (CompPlugin *plugin);
-typedef CompMetadata *(*GetMetadataProc) (CompPlugin *plugin);
+typedef bool (*InitPluginObjectProc) (CompObject *object);
+typedef void (*FiniPluginObjectProc) (CompObject *object);
-typedef CompBool (*InitPluginObjectProc) (CompPlugin *plugin,
- CompObject *object);
-typedef void (*FiniPluginObjectProc) (CompPlugin *plugin,
- CompObject *object);
-
-typedef CompOption *(*GetPluginObjectOptionsProc) (CompPlugin *plugin,
- CompObject *object,
+typedef CompOption *(*GetPluginObjectOptionsProc) (CompObject *object,
int *count);
-typedef CompBool (*SetPluginObjectOptionProc) (CompPlugin *plugin,
- CompObject *object,
+typedef bool (*SetPluginObjectOptionProc) (CompObject *object,
const char *name,
CompOptionValue *value);
-typedef struct _CompPluginVTable {
- const char *name;
+class CompPluginVTable {
+
+ public:
+ virtual ~CompPluginVTable ();
+
+ virtual const char * name () = 0;
- GetMetadataProc getMetadata;
+ virtual CompMetadata *
+ getMetadata ();
- InitPluginProc init;
- FiniPluginProc fini;
+ virtual bool
+ init () = 0;
- InitPluginObjectProc initObject;
- FiniPluginObjectProc finiObject;
+ virtual void
+ fini () = 0;
- GetPluginObjectOptionsProc getObjectOptions;
- SetPluginObjectOptionProc setObjectOption;
-} CompPluginVTable;
+ virtual bool
+ initObject (CompObject *object);
+
+ virtual void
+ finiObject (CompObject *object);
+
+ virtual CompOption *
+ getObjectOptions (CompObject *object, int *count);
+
+ virtual bool
+ setObjectOption (CompObject *object,
+ const char *name,
+ CompOptionValue *value);
+};
+
+COMPIZ_BEGIN_DECLS
CompPluginVTable *
-getCompPluginInfo20070830 (void);
+getCompPluginInfo20080805 (void);
COMPIZ_END_DECLS
diff --git a/include/compscreen.h b/include/compscreen.h
new file mode 100644
index 0000000..67007d4
--- /dev/null
+++ b/include/compscreen.h
@@ -0,0 +1,554 @@
+#ifndef _COMPSCREEN_H
+#define _COMPSCREEN_H
+
+
+class CompScreen;
+class PrivateScreen;
+
+class ScreenInterface : public WrapableInterface<CompScreen> {
+ public:
+ ScreenInterface ();
+
+ WRAPABLE_DEF(void, preparePaint, int);
+ WRAPABLE_DEF(void, donePaint);
+ WRAPABLE_DEF(void, paint, CompOutput *outputs, int, unsigned int);
+
+ WRAPABLE_DEF(bool, paintOutput, const ScreenPaintAttrib *,
+ const CompTransform *, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_DEF(void, paintTransformedOutput, const ScreenPaintAttrib *,
+ const CompTransform *, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_DEF(void, applyTransform, const ScreenPaintAttrib *,
+ 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(void, initWindowWalker, CompWalker *walker);
+
+ WRAPABLE_DEF(void, paintCursor, CompCursor *, const CompTransform *,
+ Region, unsigned int);
+ WRAPABLE_DEF(bool, damageCursorRect, CompCursor *, bool, BoxPtr);
+};
+
+
+class CompScreen : public WrapableHandler<ScreenInterface>, public CompObject {
+
+ public:
+ CompScreen *next;
+ char *windowPrivateIndices;
+ int windowPrivateLen;
+
+
+ public:
+ CompScreen ();
+ ~CompScreen ();
+
+ bool
+ init (CompDisplay *, int);
+
+ bool
+ init (CompDisplay *, int, Window, Atom, Time);
+
+ CompDisplay *
+ display ();
+
+ Window
+ root ();
+
+ int
+ screenNum ();
+
+ CompWindow *
+ windows ();
+
+ CompWindow *
+ reverseWindows ();
+
+ CompOption *
+ getOption (const char *name);
+
+ unsigned int
+ showingDesktopMask ();
+
+ bool
+ handlePaintTimeout ();
+
+ bool
+ setOption (const char *name,
+ CompOptionValue *value);
+
+ void
+ setCurrentOutput (int outputNum);
+
+ void
+ configure (XConfigureEvent *ce);
+
+ int
+ maxGrab ();
+
+ void
+ warpPointer (int dx, int dy);
+
+ Time
+ getCurrentTime ();
+
+ Atom
+ selectionAtom ();
+
+ Window
+ selectionWindow ();
+
+ Time
+ selectionTimestamp ();
+
+ CompCursor *
+ cursors ();
+
+ void
+ updateWorkareaForScreen ();
+
+ void
+ setDefaultViewport ();
+
+ void
+ damageScreen ();
+
+ FuncPtr
+ getProcAddress (const char *name);
+
+ void
+ showOutputWindow ();
+
+ void
+ hideOutputWindow ();
+
+ void
+ updateOutputWindow ();
+
+ void
+ damageRegion (Region);
+
+ void
+ damagePending ();
+
+ void
+ forEachWindow (ForEachWindowProc, void *);
+
+ void
+ focusDefaultWindow ();
+
+ CompWindow *
+ findWindow (Window id);
+
+ CompWindow *
+ findTopLevelWindow (Window id);
+
+ void
+ insertWindow (CompWindow *w, Window aboveId);
+
+ void
+ unhookWindow (CompWindow *w);
+
+ int
+ pushGrab (Cursor cursor, const char *name);
+
+ void
+ updateGrab (int index, Cursor cursor);
+
+ void
+ removeGrab (int index, XPoint *restorePointer);
+
+ bool
+ otherGrabExist (const char *, ...);
+
+ bool
+ addAction (CompAction *action);
+
+ void
+ removeAction (CompAction *action);
+
+ void
+ updatePassiveGrabs ();
+
+ void
+ updateWorkarea ();
+
+ void
+ updateClientList ();
+
+ void
+ toolkitAction (Atom toolkitAction,
+ Time eventTime,
+ Window window,
+ long data0,
+ long data1,
+ long data2);
+
+ void
+ runCommand (const char *command);
+
+ void
+ moveViewport (int tx, int ty, bool sync);
+
+ CompGroup *
+ addGroup (Window id);
+
+ void
+ removeGroup (CompGroup *group);
+
+ CompGroup *
+ findGroup (Window id);
+
+ void
+ applyStartupProperties (CompWindow *window);
+
+ void
+ sendWindowActivationRequest (Window id);
+
+ void
+ setTexEnvMode (GLenum mode);
+
+ void
+ setLighting (bool lighting);
+
+ void
+ enableEdge (int edge);
+
+ void
+ disableEdge (int edge);
+
+ Window
+ getTopWindow ();
+
+ void
+ makeCurrent ();
+
+ void
+ finishDrawing ();
+
+ int
+ outputDeviceForPoint (int x, int y);
+
+ void
+ getCurrentOutputExtents (int *x1, int *y1, int *x2, int *y2);
+
+ void
+ setNumberOfDesktops (unsigned int nDesktop);
+
+ void
+ setCurrentDesktop (unsigned int desktop);
+
+ void
+ getWorkareaForOutput (int output, XRectangle *area);
+
+ void
+ clearOutput (CompOutput *output, unsigned int mask);
+
+ void
+ viewportForGeometry (int x,
+ int y,
+ int width,
+ int height,
+ int borderWidth,
+ int *viewportX,
+ int *viewportY);
+
+ int
+ outputDeviceForGeometry (int x,
+ int y,
+ int width,
+ int height,
+ int borderWidth);
+
+ bool
+ updateDefaultIcon ();
+
+ CompCursor *
+ findCursor ();
+
+ CompCursorImage *
+ findCursorImage (unsigned long serial);
+
+ void
+ setCurrentActiveWindowHistory (int x, int y);
+
+ void
+ addToCurrentActiveWindowHistory (Window id);
+
+ void
+ setWindowPaintOffset (int x, int y);
+
+ int
+ getTimeToNextRedraw (struct timeval *tv);
+
+ void
+ waitForVideoSync ();
+
+ int
+ maxTextureSize ();
+
+ unsigned int
+ damageMask ();
+
+ int
+ x ();
+
+ int
+ y ();
+
+ int
+ vsize ();
+
+ int
+ hsize ();
+
+ int
+ width ();
+
+ int
+ height ();
+
+ unsigned int &
+ pendingDestroys ();
+
+ unsigned int &
+ mapNum ();
+
+ int &
+ desktopWindowCount ();
+
+ int &
+ overlayWindowCount ();
+
+ CompOutput *
+ outputDev ();
+
+ int
+ nOutputDev ();
+
+ XRectangle
+ workArea ();
+
+ unsigned int
+ currentDesktop ();
+
+ unsigned int
+ nDesktop ();
+
+ CompActiveWindowHistory *
+ currentHistory ();
+
+ CompScreenEdge &
+ screenEdge (int);
+
+ Window
+ overlay ();
+
+ unsigned int &
+ activeNum ();
+
+ void
+ handleExposeEvent (XExposeEvent *event);
+
+ void
+ detectRefreshRate ();
+
+ void
+ updateBackground ();
+
+ bool
+ textureNonPowerOfTwo ();
+
+ bool
+ textureCompression ();
+
+ bool
+ bindPixmapToTexture (CompTexture *texture,
+ Pixmap pixmap,
+ int width,
+ int height,
+ int depth);
+
+ bool
+ canDoSaturated ();
+
+ bool
+ canDoSlightlySaturated ();
+
+ bool
+ lighting ();
+
+ int
+ filter (int);
+
+ CompFunction *&
+ fragmentFunctions ();
+
+ CompProgram *&
+ fragmentPrograms ();
+
+ int &
+ lastFunctionId ();
+
+ int &
+ getSaturateFunction (int, int);
+
+ bool
+ fragmentProgram ();
+
+ void
+ releasePixmapFromTexture (CompTexture *texture);
+
+ void
+ enableTexture (CompTexture *texture,
+ CompTextureFilter filter);
+
+ void
+ disableTexture (CompTexture *texture);
+
+ void
+ addCursor ();
+
+ CompCursorImage *&
+ cursorImages ();
+
+ WRAPABLE_HND(void, preparePaint, int);
+ WRAPABLE_HND(void, donePaint);
+ WRAPABLE_HND(void, paint, CompOutput *outputs, int, unsigned int);
+
+ WRAPABLE_HND(bool, paintOutput, const ScreenPaintAttrib *,
+ const CompTransform *, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_HND(void, paintTransformedOutput, const ScreenPaintAttrib *,
+ const CompTransform *, Region, CompOutput *,
+ unsigned int);
+ WRAPABLE_HND(void, applyTransform, const ScreenPaintAttrib *,
+ 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(void, initWindowWalker, CompWalker *walker);
+
+ WRAPABLE_HND(void, paintCursor, CompCursor *, const CompTransform *,
+ Region, unsigned int);
+ WRAPABLE_HND(bool, damageCursorRect, CompCursor *, bool, BoxPtr);
+
+ 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;
+
+ public :
+ static bool
+ mainMenu (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ runDialog (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ showDesktop (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ toggleSlowAnimations (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ windowMenu (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static CompOption *
+ getScreenOptions ( CompObject *object,
+ int *count);
+
+ static bool
+ startupSequenceTimeout (void *data);
+
+ static void
+ compScreenSnEvent (SnMonitorEvent *event,
+ void *userData);
+};
+
+bool
+paintTimeout (void *closure);
+
+int
+getTimeToNextRedraw (CompScreen *s,
+ struct timeval *tv,
+ struct timeval *lastTv,
+ Bool idle);
+
+void
+waitForVideoSync (CompScreen *s);
+
+Bool
+initScreen (CompScreen *s,
+ CompDisplay *display,
+ int screenNum,
+ Window wmSnSelectionWindow,
+ Atom wmSnAtom,
+ Time wmSnTimestamp);
+
+void
+finiScreen (CompScreen *s);
+
+#endif
diff --git a/include/compwindow.h b/include/compwindow.h
new file mode 100644
index 0000000..d4d4f32
--- /dev/null
+++ b/include/compwindow.h
@@ -0,0 +1,563 @@
+#ifndef _COMPWINDOW_H
+#define _COMPWINDOW_H
+
+class CompWindow;
+class PrivateWindow;
+
+class WindowInterface : public WrapableInterface<CompWindow> {
+ public:
+ WindowInterface ();
+
+ WRAPABLE_DEF(bool, paint, const WindowPaintAttrib *,
+ const CompTransform *, Region, unsigned int);
+ WRAPABLE_DEF(bool, draw, const CompTransform *,
+ const FragmentAttrib *, Region, unsigned int);
+ WRAPABLE_DEF(void, addGeometry, CompMatrix *matrix,
+ int, Region, Region);
+ WRAPABLE_DEF(void, drawTexture, CompTexture *texture,
+ const FragmentAttrib *, 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 *);
+
+ WRAPABLE_DEF(bool, focus);
+ WRAPABLE_DEF(void, activate);
+ WRAPABLE_DEF(bool, place, int, int, int*, int*);
+ WRAPABLE_DEF(void, validateResizeRequest,
+ unsigned int *, XWindowChanges *);
+
+ WRAPABLE_DEF(void, resizeNotify, int, int, int, int);
+ WRAPABLE_DEF(void, moveNotify, int, int, bool);
+ WRAPABLE_DEF(void, grabNotify, int, int,
+ unsigned int, unsigned int);
+ WRAPABLE_DEF(void, ungrabNotify);
+ WRAPABLE_DEF(void, stateChangeNotify, unsigned int);
+
+};
+
+class CompWindow : public WrapableHandler<WindowInterface>, public CompObject {
+
+ public:
+ CompWindow *next;
+ CompWindow *prev;
+
+ public:
+
+ CompWindow (CompScreen *screen,
+ Window id,
+ Window aboveId);
+ ~CompWindow ();
+
+ CompScreen *
+ screen ();
+
+ Window
+ id ();
+
+ Window
+ frame ();
+
+ unsigned int &
+ wmType ();
+
+ unsigned int
+ type ();
+
+ unsigned int &
+ state ();
+
+ unsigned int
+ actions ();
+
+ unsigned int &
+ protocols ();
+
+ XWindowAttributes
+ attrib ();
+
+ void
+ close (Time serverTime);
+
+ bool
+ handlePingTimeout (int lastPing);
+
+ void
+ handlePing (int lastPing);
+
+ bool
+ overlayWindow ();
+
+ Region
+ region ();
+
+ bool
+ inShowDesktopMode ();
+
+ void
+ setShowDesktopMode (bool);
+
+ bool &
+ managed ();
+
+ bool
+ grabbed ();
+
+ unsigned int &
+ activeNum ();
+
+ void
+ setActiveNum (int);
+
+ int
+ mapNum ();
+
+ CompStruts *
+ struts ();
+
+ int &
+ saveMask ();
+
+ XWindowChanges &
+ saveWc ();
+
+ void
+ moveToViewportPosition (int x, int y, bool sync);
+
+ char *
+ startupId ();
+
+ void
+ applyStartupProperties (CompStartupSequence *s);
+
+ unsigned int
+ desktop ();
+
+ Window &
+ clientLeader ();
+
+ void
+ updateNormalHints ();
+
+ void
+ updateWmHints ();
+
+ void
+ updateClassHints ();
+
+ void
+ updateTransientHint ();
+
+ void
+ updateIconGeometry ();
+
+ Window
+ getClientLeader ();
+
+ char *
+ getStartupId ();
+
+ void
+ changeState (unsigned int newState);
+
+ void
+ recalcActions ();
+
+ void
+ recalcType ();
+
+ void
+ setWindowFrameExtents (CompWindowExtents *input);
+
+ 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 ();
+
+ bool
+ updateStruts ();
+
+ void
+ destroy ();
+
+ void
+ sendConfigureNotify ();
+
+ void
+ map ();
+
+ void
+ unmap ();
+
+ bool
+ resize (int x, int y, int width, int height, int borderWidth);
+
+ bool
+ handleSyncAlarm ();
+
+ void
+ sendSyncRequest ();
+
+ void
+ configure (XConfigureEvent *ce);
+
+ void
+ circulate (XCirculateEvent *ce);
+
+ void
+ move (int dx, int dy, Bool damage, Bool immediate);
+
+ void
+ syncPosition ();
+
+ void
+ moveInputFocusTo ();
+
+ void
+ moveInputFocusToOtherWindow ();
+
+ void
+ configureXWindow (unsigned int valueMask,
+ XWindowChanges *xwc);
+
+
+ unsigned int
+ adjustConfigureRequestForGravity (XWindowChanges *xwc,
+ unsigned int xwcm,
+ int gravity);
+
+ void
+ moveResize (XWindowChanges *xwc,
+ unsigned int xwcm,
+ int gravity);
+
+ void
+ updateSize ();
+
+ void
+ raise ();
+
+ void
+ lower ();
+
+ void
+ restackAbove (CompWindow *sibling);
+
+ void
+ restackBelow (CompWindow *sibling);
+
+ void
+ updateAttributes (CompStackingUpdateMode stackingMode);
+
+ void
+ hide ();
+
+ void
+ show ();
+
+ void
+ minimize ();
+
+ void
+ unminimize ();
+
+ void
+ maximize (int state);
+
+ bool
+ getUserTime (Time *time);
+
+ void
+ setUserTime (Time time);
+
+ bool
+ allowWindowFocus (unsigned int noFocusMask,
+ Time timestamp);
+
+ void
+ unredirect ();
+
+ void
+ redirect ();
+
+ void
+ defaultViewport (int *vx, int *vy);
+
+ CompIcon *
+ getIcon (int width, int height);
+
+ void
+ freeIcons ();
+
+ int
+ outputDevice ();
+
+ bool
+ onCurrentDesktop ();
+
+ void
+ setDesktop (unsigned int desktop);
+
+ bool
+ onAllViewports ();
+
+ void
+ getMovementForOffset (int offX,
+ int offY,
+ int *retX,
+ int *retY);
+
+ Window
+ transientFor ();
+
+ int &
+ pendingUnmaps ();
+
+ bool &
+ minimized ();
+
+ bool &
+ placed ();
+
+ bool
+ shaded ();
+
+ int
+ height ();
+
+ int
+ width ();
+
+ int &
+ serverX ();
+
+ int &
+ serverY ();
+
+ int
+ serverWidth ();
+
+ int
+ serverHeight ();
+
+ int
+ serverBorderWidth ();
+
+ CompWindowExtents
+ input ();
+
+ XSizeHints
+ sizeHints ();
+
+ void
+ updateOpacity ();
+
+ void
+ updateBrightness ();
+
+ void
+ updateSaturation ();
+
+ void
+ updateMwmHints ();
+
+ void
+ updateStartupId ();
+
+ void
+ processMap ();
+
+ void
+ processDamage (XDamageNotifyEvent *de);
+
+ XSyncAlarm
+ syncAlarm ();
+
+ bool
+ destroyed ();
+
+ bool
+ damaged ();
+
+ bool
+ invisible ();
+
+ bool
+ redirected ();
+
+ Region
+ clip ();
+
+ WindowPaintAttrib &
+ paintAttrib ();
+
+ bool
+ moreVertices (int newSize);
+
+ bool
+ moreIndices (int newSize);
+
+ static unsigned int
+ constrainWindowState (unsigned int state,
+ unsigned int actions);
+
+ static unsigned int
+ windowTypeFromString (const char *str);
+
+ static int
+ compareWindowActiveness (CompWindow *w1,
+ CompWindow *w2);
+
+ WRAPABLE_HND(bool, paint, const WindowPaintAttrib *,
+ const CompTransform *, Region, unsigned int);
+ WRAPABLE_HND(bool, draw, const CompTransform *,
+ const FragmentAttrib *, Region, unsigned int);
+ WRAPABLE_HND(void, addGeometry, CompMatrix *matrix,
+ int, Region, Region);
+ WRAPABLE_HND(void, drawTexture, CompTexture *texture,
+ const FragmentAttrib *, 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 *);
+
+ WRAPABLE_HND(bool, focus);
+ WRAPABLE_HND(void, activate);
+ WRAPABLE_HND(bool, place, int, int, int*, int*);
+ WRAPABLE_HND(void, validateResizeRequest,
+ unsigned int *, XWindowChanges *);
+
+ WRAPABLE_HND(void, resizeNotify, int, int, int, int);
+ WRAPABLE_HND(void, moveNotify, int, int, bool);
+ WRAPABLE_HND(void, grabNotify, int, int,
+ unsigned int, unsigned int);
+ WRAPABLE_HND(void, ungrabNotify);
+ WRAPABLE_HND(void, stateChangeNotify, unsigned int);
+
+ friend class PrivateWindow;
+
+ private:
+ PrivateWindow *priv;
+
+
+ public:
+
+ // static action functions
+ static bool
+ closeWin (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ unmaximize (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ minimize (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ maximize (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ maximizeHorizontally (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ maximizeVertically (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ raiseInitiate (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ lowerInitiate (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ toggleMaximized (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+
+ static bool
+ toggleMaximizedHorizontally (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ toggleMaximizedVertically (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+ static bool
+ shade (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption);
+
+
+};
+
+#endif
diff --git a/metadata/core.xml.in b/metadata/core.xml.in
index b32d97b..9475bc0 100644
--- a/metadata/core.xml.in
+++ b/metadata/core.xml.in
@@ -231,17 +231,7 @@
<_short>Maximize Window Vertically</_short>
<_long>Maximize active window vertically</_long>
</option>
- <option name="opacity_increase_button" type="button">
- <_short>Increase Opacity</_short>
- <_long>Increase window opacity</_long>
- <default>&lt;Alt&gt;Button4</default>
- </option>
- <option name="opacity_decrease_button" type="button">
- <_short>Decrease Opacity</_short>
- <_long>Decrease window opacity</_long>
- <default>&lt;Alt&gt;Button5</default>
- </option>
- <option name="command_screenshot" type="string">
+ <option name="command_screenshot" type="string">
<_short>Screenshot command line</_short>
<_long>Screenshot command line</_long>
<default>gnome-screenshot</default>
@@ -371,13 +361,6 @@
<min>1</min>
<max>32</max>
</option>
- <option name="opacity_step" type="int">
- <_short>Opacity Step</_short>
- <_long>Opacity change step</_long>
- <default>10</default>
- <min>1</min>
- <max>50</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>
@@ -465,18 +448,6 @@
<_long>Focus prevention windows</_long>
<default>any</default>
</option>
- <option name="opacity_matches" type="list">
- <_short>Opacity windows</_short>
- <_long>Windows that should be translucent by default</_long>
- <type>match</type>
- </option>
- <option name="opacity_values" type="list">
- <_short>Opacity window values</_short>
- <_long>Opacity values for windows that should be translucent by default</_long>
- <type>int</type>
- <min>0</min>
- <max>100</max>
- </option>
<option name="texture_compression" type="bool">
<_short>Texture Compression</_short>
<_long>If available use compression for textures converted from images</_long>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index ce90a87..94055f7 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -145,14 +145,17 @@ INCLUDES = \
moduledir = $(plugindir)
module_LTLIBRARIES = \
- $(libglib_module) \
- $(libgconf_module) \
- $(libkconfig_module) \
- libdecoration.la \
- libzoom.la \
- libmove.la \
- libresize.la
-#
+ libmove.la
+
+
+#module_LTLIBRARIES = \
+# $(libglib_module) \
+# $(libgconf_module) \
+# $(libkconfig_module) \
+# libdecoration.la \
+# libzoom.la \
+# libmove.la \
+# libresize.la \
# libwobbly.la \
# libfade.la \
# libminimize.la \
diff --git a/plugins/move.cpp b/plugins/move.cpp
index 37af8d0..6772bc3 100644
--- a/plugins/move.cpp
+++ b/plugins/move.cpp
@@ -33,6 +33,39 @@
static CompMetadata moveMetadata;
+class MovePluginVTable : public CompPluginVTable
+{
+ public:
+
+ const char *
+ name () { return "move"; };
+
+ CompMetadata *
+ getMetadata ();
+
+ virtual bool
+ init ();
+
+ virtual void
+ fini ();
+
+ virtual bool
+ initObject (CompObject *object);
+
+ virtual void
+ finiObject (CompObject *object);
+
+ CompOption *
+ getObjectOptions (CompObject *object, int *count);
+
+ bool
+ setObjectOption (CompObject *object,
+ const char *name,
+ CompOptionValue *value);
+};
+
+
+
struct _MoveKeys {
char *name;
int dx;
@@ -61,54 +94,95 @@ static int displayPrivateIndex;
#define MOVE_DISPLAY_OPTION_LAZY_POSITIONING 5
#define MOVE_DISPLAY_OPTION_NUM 6
-typedef struct _MoveDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
+class MoveDisplay : public DisplayInterface {
- CompOption opt[MOVE_DISPLAY_OPTION_NUM];
+ public:
+ MoveDisplay (CompDisplay *display) : display (display)
+ {
+ display->add (this);
+ DisplayInterface::setHandler (display);
+ };
- CompWindow *w;
- int savedX;
- int savedY;
- int x;
- int y;
- Region region;
- int status;
- KeyCode key[NUM_KEYS];
+ void
+ handleEvent (XEvent *);
+
+
+ CompDisplay *display;
+ int screenPrivateIndex;
+
+
+ CompOption opt[MOVE_DISPLAY_OPTION_NUM];
- int releaseButton;
+ CompWindow *w;
+ int savedX;
+ int savedY;
+ int x;
+ int y;
+ Region region;
+ int status;
+ KeyCode key[NUM_KEYS];
+
+ int releaseButton;
+
+ GLushort moveOpacity;
+};
+
+
+
+class MoveScreen {
+ public:
+
+ MoveScreen (CompScreen *screen) : screen (screen) {};
+
+ int windowPrivateIndex;
+
+ CompScreen *screen;
+ int grabIndex;
- GLushort moveOpacity;
-} MoveDisplay;
+ Cursor moveCursor;
-typedef struct _MoveScreen {
- PaintWindowProc paintWindow;
+ unsigned int origState;
- int grabIndex;
+ int snapOffY;
+ int snapBackY;
+};
- Cursor moveCursor;
+class MoveWindow : public WindowInterface {
+ public:
+ MoveWindow (CompWindow *window) : window (window)
+ {
+ window->add (this);
+ WindowInterface::setHandler (window);
+ };
- unsigned int origState;
+ bool
+ paint (const WindowPaintAttrib *, const CompTransform *, Region,
+ unsigned int);
- int snapOffY;
- int snapBackY;
-} MoveScreen;
+ CompWindow *window;
+};
#define GET_MOVE_DISPLAY(d) \
- ((MoveDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
+ ((MoveDisplay *) (d)->privates[displayPrivateIndex].ptr)
#define MOVE_DISPLAY(d) \
MoveDisplay *md = GET_MOVE_DISPLAY (d)
#define GET_MOVE_SCREEN(s, md) \
- ((MoveScreen *) (s)->base.privates[(md)->screenPrivateIndex].ptr)
+ ((MoveScreen *) (s)->privates[(md)->screenPrivateIndex].ptr)
#define MOVE_SCREEN(s) \
- MoveScreen *ms = GET_MOVE_SCREEN (s, GET_MOVE_DISPLAY (s->display))
+ MoveScreen *ms = GET_MOVE_SCREEN (s, GET_MOVE_DISPLAY (s->display ()))
+
+#define GET_MOVE_WINDOW(w, ms) \
+ ((MoveWindow *) (w)->privates[(ms)->windowPrivateIndex].ptr)
+
+#define MOVE_WINDOW(w) \
+ MoveWindow *mw = GET_MOVE_WINDOW (w, GET_MOVE_SCREEN (w->screen (), GET_MOVE_DISPLAY (w->screen ()->display())))
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-static Bool
+static bool
moveInitiate (CompDisplay *d,
CompAction *action,
CompActionState state,
@@ -122,36 +196,38 @@ moveInitiate (CompDisplay *d,
xid = getIntOptionNamed (option, nOption, "window", 0);
- w = findWindowAtDisplay (d, xid);
- if (w && (w->actions & CompWindowActionMoveMask))
+ w = d->findWindow (xid);
+ if (w && (w->actions () & CompWindowActionMoveMask))
{
XRectangle workArea;
unsigned int mods;
int x, y, button;
- MOVE_SCREEN (w->screen);
+ CompScreen *s = w->screen ();
+
+ MOVE_SCREEN (w->screen ());
mods = getIntOptionNamed (option, nOption, "modifiers", 0);
x = getIntOptionNamed (option, nOption, "x",
- w->attrib.x + (w->width / 2));
+ w->attrib ().x + (w->width () / 2));
y = getIntOptionNamed (option, nOption, "y",
- w->attrib.y + (w->height / 2));
+ w->attrib ().y + (w->height () / 2));
button = getIntOptionNamed (option, nOption, "button", -1);
- if (otherScreenGrabExist (w->screen, "move", 0))
+ if (s->otherGrabExist ("move", 0))
return FALSE;
if (md->w)
return FALSE;
- if (w->type & (CompWindowTypeDesktopMask |
+ if (w->type () & (CompWindowTypeDesktopMask |
CompWindowTypeDockMask |
CompWindowTypeFullscreenMask))
return FALSE;
- if (w->attrib.override_redirect)
+ if (w->attrib ().override_redirect)
return FALSE;
if (state & CompActionStateInitButton)
@@ -165,8 +241,8 @@ moveInitiate (CompDisplay *d,
md->status = RectangleOut;
- md->savedX = w->serverX;
- md->savedY = w->serverY;
+ md->savedX = w->serverX ();
+ md->savedY = w->serverY ();
md->x = 0;
md->y = 0;
@@ -174,17 +250,16 @@ moveInitiate (CompDisplay *d,
lastPointerX = x;
lastPointerY = y;
- ms->origState = w->state;
+ ms->origState = w->state ();
- getWorkareaForOutput (w->screen,
- outputDeviceForWindow (w),
- &workArea);
+ s->getWorkareaForOutput (w->outputDevice (),
+ &workArea);
- ms->snapBackY = w->serverY - workArea.y;
+ ms->snapBackY = w->serverY () - workArea.y;
ms->snapOffY = y - workArea.y;
if (!ms->grabIndex)
- ms->grabIndex = pushScreenGrab (w->screen, ms->moveCursor, "move");
+ ms->grabIndex = s->pushGrab (ms->moveCursor, "move");
if (ms->grabIndex)
{
@@ -192,29 +267,28 @@ moveInitiate (CompDisplay *d,
md->releaseButton = button;
- (w->screen->windowGrabNotify) (w, x, y, mods,
- CompWindowGrabMoveMask |
- CompWindowGrabButtonMask);
+ w->grabNotify (x, y, mods,CompWindowGrabMoveMask |
+ CompWindowGrabButtonMask);
if (state & CompActionStateInitKey)
{
int xRoot, yRoot;
- xRoot = w->attrib.x + (w->width / 2);
- yRoot = w->attrib.y + (w->height / 2);
+ xRoot = w->attrib ().x + (w->width () / 2);
+ yRoot = w->attrib ().y + (w->height () / 2);
- warpPointer (w->screen, xRoot - pointerX, yRoot - pointerY);
+ s->warpPointer (xRoot - pointerX, yRoot - pointerY);
}
if (md->moveOpacity != OPAQUE)
- addWindowDamage (w);
+ w->addDamage ();
}
}
return FALSE;
}
-static Bool
+static bool
moveTerminate (CompDisplay *d,
CompAction *action,
CompActionState state,
@@ -225,31 +299,30 @@ moveTerminate (CompDisplay *d,
if (md->w)
{
- MOVE_SCREEN (md->w->screen);
+ MOVE_SCREEN (md->w->screen ());
if (state & CompActionStateCancel)
- moveWindow (md->w,
- md->savedX - md->w->attrib.x,
- md->savedY - md->w->attrib.y,
+ md->w->move (md->savedX - md->w->attrib ().x,
+ md->savedY - md->w->attrib ().y,
TRUE, FALSE);
- syncWindowPosition (md->w);
+ md->w->syncPosition ();
/* update window attributes as window constraints may have
changed - needed e.g. if a maximized window was moved
to another output device */
- updateWindowAttributes (md->w, CompStackingUpdateModeNone);
+ md->w->updateAttributes (CompStackingUpdateModeNone);
- (md->w->screen->windowUngrabNotify) (md->w);
+ md->w->ungrabNotify ();
if (ms->grabIndex)
{
- removeScreenGrab (md->w->screen, ms->grabIndex, NULL);
+ md->w->screen ()->removeGrab (ms->grabIndex, NULL);
ms->grabIndex = 0;
}
if (md->moveOpacity != OPAQUE)
- addWindowDamage (md->w);
+ md->w->addDamage ();
md->w = 0;
md->releaseButton = 0;
@@ -282,33 +355,33 @@ moveGetYConstrainRegion (CompScreen *s)
r.extents.x1 = MINSHORT;
r.extents.y1 = 0;
r.extents.x2 = 0;
- r.extents.y2 = s->height;
+ r.extents.y2 = s->height ();
XUnionRegion (&r, region, region);
- r.extents.x1 = s->width;
+ r.extents.x1 = s->width ();
r.extents.x2 = MAXSHORT;
XUnionRegion (&r, region, region);
- for (i = 0; i < s->nOutputDev; i++)
+ for (i = 0; i < s->nOutputDev (); i++)
{
- XUnionRegion (&s->outputDev[i].region, region, region);
+ XUnionRegion (&s->outputDev ()[i].region, region, region);
- getWorkareaForOutput (s, i, &workArea);
- extents = s->outputDev[i].region.extents;
+ s->getWorkareaForOutput (i, &workArea);
+ extents = s->outputDev ()[i].region.extents;
- for (w = s->windows; w; w = w->next)
+ for (w = s->windows (); w; w = w->next)
{
- if (!w->mapNum)
+ if (!w->mapNum ())
continue;
- if (w->struts)
+ if (w->struts ())
{
- r.extents.x1 = w->struts->top.x;
- r.extents.y1 = w->struts->top.y;
- r.extents.x2 = r.extents.x1 + w->struts->top.width;
- r.extents.y2 = r.extents.y1 + w->struts->top.height;
+ r.extents.x1 = w->struts ()->top.x;
+ r.extents.y1 = w->struts ()->top.y;
+ r.extents.x2 = r.extents.x1 + w->struts ()->top.width;
+ r.extents.y2 = r.extents.y1 + w->struts ()->top.height;
if (r.extents.x1 < extents.x1)
r.extents.x1 = extents.x1;
@@ -325,10 +398,10 @@ moveGetYConstrainRegion (CompScreen *s)
XSubtractRegion (region, &r, region);
}
- r.extents.x1 = w->struts->bottom.x;
- r.extents.y1 = w->struts->bottom.y;
- r.extents.x2 = r.extents.x1 + w->struts->bottom.width;
- r.extents.y2 = r.extents.y1 + w->struts->bottom.height;
+ r.extents.x1 = w->struts ()->bottom.x;
+ r.extents.y1 = w->struts ()->bottom.y;
+ r.extents.x2 = r.extents.x1 + w->struts ()->bottom.width;
+ r.extents.y2 = r.extents.y1 + w->struts ()->bottom.height;
if (r.extents.x1 < extents.x1)
r.extents.x1 = extents.x1;
@@ -360,24 +433,24 @@ moveHandleMotionEvent (CompScreen *s,
if (ms->grabIndex)
{
- CompWindow *w;
int dx, dy;
int wX, wY;
int wWidth, wHeight;
+ CompWindow *w;
- MOVE_DISPLAY (s->display);
+ MOVE_DISPLAY (s->display ());
w = md->w;
-
- wX = w->serverX;
- wY = w->serverY;
- wWidth = w->serverWidth + w->serverBorderWidth * 2;
- wHeight = w->serverHeight + w->serverBorderWidth * 2;
+
+ wX = w->serverX ();
+ wY = w->serverY ();
+ wWidth = w->serverWidth () + w->serverBorderWidth () * 2;
+ wHeight = w->serverHeight () + w->serverBorderWidth () * 2;
md->x += xRoot - lastPointerX;
md->y += yRoot - lastPointerY;
- if (w->type & CompWindowTypeFullscreenMask)
+ if (w->type () & CompWindowTypeFullscreenMask)
{
dx = dy = 0;
}
@@ -389,9 +462,7 @@ moveHandleMotionEvent (CompScreen *s,
dx = md->x;
dy = md->y;
- getWorkareaForOutput (s,
- outputDeviceForWindow (w),
- &workArea);
+ s->getWorkareaForOutput (w->outputDevice (), &workArea);
if (md->opt[MOVE_DISPLAY_OPTION_CONSTRAIN_Y].value.b)
{
@@ -406,10 +477,10 @@ moveHandleMotionEvent (CompScreen *s,
int x, y, width, height;
int status;
- x = wX + dx - w->input.left;
- y = wY + dy - w->input.top;
- width = wWidth + w->input.left + w->input.right;
- height = w->input.top ? w->input.top : 1;
+ x = wX + dx - w->input ().left;
+ y = wY + dy - w->input ().top;
+ width = wWidth + w->input ().left + w->input ().right;
+ height = w->input ().top ? w->input ().top : 1;
status = XRectInRegion (md->region, x, y, width, height);
@@ -427,7 +498,7 @@ moveHandleMotionEvent (CompScreen *s,
if (xStatus != RectangleIn)
dx += (dx < 0) ? 1 : -1;
- x = wX + dx - w->input.left;
+ x = wX + dx - w->input ().left;
}
while (dy && status != RectangleIn)
@@ -439,7 +510,7 @@ moveHandleMotionEvent (CompScreen *s,
if (status != RectangleIn)
dy += (dy < 0) ? 1 : -1;
- y = wY + dy - w->input.top;
+ y = wY + dy - w->input ().top;
}
}
else
@@ -451,25 +522,25 @@ moveHandleMotionEvent (CompScreen *s,
if (md->opt[MOVE_DISPLAY_OPTION_SNAPOFF_MAXIMIZED].value.b)
{
- if (w->state & CompWindowStateMaximizedVertMask)
+ if (w->state () & CompWindowStateMaximizedVertMask)
{
if (abs ((yRoot - workArea.y) - ms->snapOffY) >= SNAP_OFF)
{
- if (!otherScreenGrabExist (s, "move", 0))
+ if (!s->otherGrabExist ("move", 0))
{
- int width = w->serverWidth;
+ int width = w->serverWidth ();
- w->saveMask |= CWX | CWY;
+ w->saveMask () |= CWX | CWY;
- if (w->saveMask & CWWidth)
- width = w->saveWc.width;
+ if (w->saveMask ()& CWWidth)
+ width = w->saveWc ().width;
- w->saveWc.x = xRoot - (width >> 1);
- w->saveWc.y = yRoot + (w->input.top >> 1);
+ w->saveWc ().x = xRoot - (width >> 1);
+ w->saveWc ().y = yRoot + (w->input ().top >> 1);
md->x = md->y = 0;
- maximizeWindow (w, 0);
+ w->maximize (0);
ms->snapOffY = ms->snapBackY;
@@ -481,21 +552,21 @@ moveHandleMotionEvent (CompScreen *s,
{
if (abs ((yRoot - workArea.y) - ms->snapBackY) < SNAP_BACK)
{
- if (!otherScreenGrabExist (s, "move", 0))
+ if (!s->otherGrabExist ("move", 0))
{
int wy;
/* update server position before maximizing
window again so that it is maximized on
correct output */
- syncWindowPosition (w);
+ w->syncPosition ();
- maximizeWindow (w, ms->origState);
+ w->maximize (ms->origState);
- wy = workArea.y + (w->input.top >> 1);
- wy += w->sizeHints.height_inc >> 1;
+ wy = workArea.y + (w->input ().top >> 1);
+ wy += w->sizeHints ().height_inc >> 1;
- warpPointer (s, 0, wy - pointerY);
+ s->warpPointer (0, wy - pointerY);
return;
}
@@ -503,10 +574,10 @@ moveHandleMotionEvent (CompScreen *s,
}
}
- if (w->state & CompWindowStateMaximizedVertMask)
+ if (w->state () & CompWindowStateMaximizedVertMask)
{
- min = workArea.y + w->input.top;
- max = workArea.y + workArea.height - w->input.bottom - wHeight;
+ min = workArea.y + w->input ().top;
+ max = workArea.y + workArea.height - w->input ().bottom - wHeight;
if (wY + dy < min)
dy = min - wY;
@@ -514,16 +585,16 @@ moveHandleMotionEvent (CompScreen *s,
dy = max - wY;
}
- if (w->state & CompWindowStateMaximizedHorzMask)
+ if (w->state () & CompWindowStateMaximizedHorzMask)
{
- if (wX > s->width || wX + w->width < 0)
+ if (wX > s->width () || wX + w->width () < 0)
return;
if (wX + wWidth < 0)
return;
- min = workArea.x + w->input.left;
- max = workArea.x + workArea.width - w->input.right - wWidth;
+ min = workArea.x + w->input ().left;
+ max = workArea.x + workArea.width - w->input ().right - wWidth;
if (wX + dx < min)
dx = min - wX;
@@ -534,9 +605,8 @@ moveHandleMotionEvent (CompScreen *s,
if (dx || dy)
{
- moveWindow (w,
- wX + dx - w->attrib.x,
- wY + dy - w->attrib.y,
+ w->move (wX + dx - w->attrib ().x,
+ wY + dy - w->attrib ().y,
TRUE, FALSE);
if (md->opt[MOVE_DISPLAY_OPTION_LAZY_POSITIONING].value.b)
@@ -544,12 +614,12 @@ moveHandleMotionEvent (CompScreen *s,
/* FIXME: This form of lazy positioning is broken and should
be replaced asap. Current code exists just to avoid a
major performance regression in the 0.5.2 release. */
- w->serverX = w->attrib.x;
- w->serverY = w->attrib.y;
+ w->serverX () = w->attrib ().x;
+ w->serverY () = w->attrib ().y;
}
else
{
- syncWindowPosition (w);
+ w->syncPosition ();
}
md->x -= dx;
@@ -558,39 +628,35 @@ moveHandleMotionEvent (CompScreen *s,
}
}
-static void
-moveHandleEvent (CompDisplay *d,
- XEvent *event)
+void
+MoveDisplay::handleEvent (XEvent *event)
{
CompScreen *s;
- MOVE_DISPLAY (d);
-
switch (event->type) {
case ButtonPress:
case ButtonRelease:
- s = findScreenAtDisplay (d, event->xbutton.root);
+ s = display->findScreen (event->xbutton.root);
if (s)
{
MOVE_SCREEN (s);
if (ms->grabIndex)
{
- if (md->releaseButton == -1 ||
- md->releaseButton == event->xbutton.button)
+ if (releaseButton == -1 ||
+ releaseButton == event->xbutton.button)
{
CompAction *action;
- int opt = MOVE_DISPLAY_OPTION_INITIATE_BUTTON;
- action = &md->opt[opt].value.action;
- moveTerminate (d, action, CompActionStateTermButton,
+ action = &opt[MOVE_DISPLAY_OPTION_INITIATE_BUTTON].value.action;
+ moveTerminate (display, action, CompActionStateTermButton,
NULL, 0);
}
}
}
break;
case KeyPress:
- s = findScreenAtDisplay (d, event->xkey.root);
+ s = display->findScreen (event->xkey.root);
if (s)
{
MOVE_SCREEN (s);
@@ -601,9 +667,9 @@ moveHandleEvent (CompDisplay *d,
for (i = 0; i < NUM_KEYS; i++)
{
- if (event->xkey.keycode == md->key[i])
+ if (event->xkey.keycode == key[i])
{
- XWarpPointer (d->display, None, None, 0, 0, 0, 0,
+ XWarpPointer (display->dpy (), None, None, 0, 0, 0, 0,
mKeys[i].dx * KEY_MOVE_INC,
mKeys[i].dy * KEY_MOVE_INC);
break;
@@ -613,25 +679,25 @@ moveHandleEvent (CompDisplay *d,
}
break;
case MotionNotify:
- s = findScreenAtDisplay (d, event->xmotion.root);
+ s = display->findScreen (event->xmotion.root);
if (s)
moveHandleMotionEvent (s, pointerX, pointerY);
break;
case EnterNotify:
case LeaveNotify:
- s = findScreenAtDisplay (d, event->xcrossing.root);
+ s = display->findScreen (event->xcrossing.root);
if (s)
moveHandleMotionEvent (s, pointerX, pointerY);
break;
case ClientMessage:
- if (event->xclient.message_type == d->wmMoveResizeAtom)
+ if (event->xclient.message_type == display->atoms ().wmMoveResize)
{
CompWindow *w;
if (event->xclient.data.l[2] == WmMoveResizeMove ||
event->xclient.data.l[2] == WmMoveResizeMoveKeyboard)
{
- w = findWindowAtDisplay (d, event->xclient.window);
+ w = display->findWindow (event->xclient.window);
if (w)
{
CompOption o[5];
@@ -646,7 +712,7 @@ moveHandleEvent (CompDisplay *d,
{
option = MOVE_DISPLAY_OPTION_INITIATE_KEY;
- moveInitiate (d, &md->opt[option].value.action,
+ moveInitiate (display, &opt[option].value.action,
CompActionStateInitKey,
o, 1);
}
@@ -658,7 +724,7 @@ moveHandleEvent (CompDisplay *d,
option = MOVE_DISPLAY_OPTION_INITIATE_BUTTON;
- XQueryPointer (d->display, w->screen->root,
+ XQueryPointer (display->dpy (), w->screen ()->root (),
&root, &child, &xRoot, &yRoot,
&i, &i, &mods);
@@ -682,12 +748,12 @@ moveHandleEvent (CompDisplay *d,
o[4].value.i = event->xclient.data.l[3] ?
event->xclient.data.l[3] : -1;
- moveInitiate (d,
- &md->opt[option].value.action,
+ moveInitiate (display,
+ &opt[option].value.action,
CompActionStateInitButton,
o, 5);
- moveHandleMotionEvent (w->screen, xRoot, yRoot);
+ moveHandleMotionEvent (w->screen (), xRoot, yRoot);
}
}
}
@@ -695,61 +761,57 @@ moveHandleEvent (CompDisplay *d,
}
break;
case DestroyNotify:
- if (md->w && md->w->id == event->xdestroywindow.window)
+ if (w && w->id () == event->xdestroywindow.window)
{
int option;
option = MOVE_DISPLAY_OPTION_INITIATE_BUTTON;
- moveTerminate (d,
- &md->opt[option].value.action,
+ moveTerminate (display,
+ &opt[option].value.action,
0, NULL, 0);
option = MOVE_DISPLAY_OPTION_INITIATE_KEY;
- moveTerminate (d,
- &md->opt[option].value.action,
+ moveTerminate (display,
+ &opt[option].value.action,
0, NULL, 0);
}
break;
case UnmapNotify:
- if (md->w && md->w->id == event->xunmap.window)
+ if (w && w->id () == event->xunmap.window)
{
int option;
option = MOVE_DISPLAY_OPTION_INITIATE_BUTTON;
- moveTerminate (d,
- &md->opt[option].value.action,
+ moveTerminate (display,
+ &opt[option].value.action,
0, NULL, 0);
option = MOVE_DISPLAY_OPTION_INITIATE_KEY;
- moveTerminate (d,
- &md->opt[option].value.action,
+ moveTerminate (display,
+ &opt[option].value.action,
0, NULL, 0);
}
default:
break;
}
- UNWRAP (md, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (md, d, handleEvent, moveHandleEvent);
+ display->handleEvent (event);
}
-static Bool
-movePaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
+bool
+MoveWindow::paint (const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask)
{
WindowPaintAttrib sAttrib;
- CompScreen *s = w->screen;
- Bool status;
+ bool status;
- MOVE_SCREEN (s);
+ MOVE_SCREEN (window->screen ());
if (ms->grabIndex)
{
- MOVE_DISPLAY (s->display);
+ MOVE_DISPLAY (window->screen ()->display ());
- if (md->w == w && md->moveOpacity != OPAQUE)
+ if (md->w == window && md->moveOpacity != OPAQUE)
{
/* modify opacity of windows that are not active */
sAttrib = *attrib;
@@ -759,34 +821,32 @@ movePaintWindow (CompWindow *w,
}
}
- UNWRAP (ms, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, transform, region, mask);
- WRAP (ms, s, paintWindow, movePaintWindow);
+ status = window->paint (attrib, transform, region, mask);
return status;
}
static CompOption *
-moveGetDisplayOptions (CompPlugin *plugin,
- CompDisplay *display,
+moveGetDisplayOptions (CompObject *object,
int *count)
{
- MOVE_DISPLAY (display);
+ CORE_DISPLAY (object);
+ MOVE_DISPLAY (d);
*count = NUM_OPTIONS (md);
return md->opt;
}
-static Bool
-moveSetDisplayOption (CompPlugin *plugin,
- CompDisplay *display,
+static bool
+moveSetDisplayOption (CompObject *object,
const char *name,
CompOptionValue *value)
{
CompOption *o;
int index;
- MOVE_DISPLAY (display);
+ CORE_DISPLAY (object);
+ MOVE_DISPLAY (d);
o = compFindOption (md->opt, NUM_OPTIONS (md), name, &index);
if (!o)
@@ -801,7 +861,7 @@ moveSetDisplayOption (CompPlugin *plugin,
}
break;
default:
- return compSetDisplayOption (display, o, value);
+ return compSetDisplayOption (d, o, value);
}
return FALSE;
@@ -816,19 +876,20 @@ static const CompMetadataOptionInfo moveDisplayOptionInfo[] = {
{ "lazy_positioning", "bool", 0, 0, 0 }
};
-static Bool
-moveInitDisplay (CompPlugin *p,
- CompDisplay *d)
+static bool
+moveInitDisplay (CompObject *o)
{
MoveDisplay *md;
int i;
+ CORE_DISPLAY (o);
+
if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
+ return false;
- md = (MoveDisplay *) malloc (sizeof (MoveDisplay));
+ md = new MoveDisplay (d);
if (!md)
- return FALSE;
+ return false;
if (!compInitDisplayOptionsFromMetadata (d,
&moveMetadata,
@@ -836,16 +897,16 @@ moveInitDisplay (CompPlugin *p,
md->opt,
MOVE_DISPLAY_OPTION_NUM))
{
- free (md);
- return FALSE;
+ delete md;
+ return false;
}
md->screenPrivateIndex = allocateScreenPrivateIndex (d);
if (md->screenPrivateIndex < 0)
{
compFiniDisplayOptions (d, md->opt, MOVE_DISPLAY_OPTION_NUM);
- free (md);
- return FALSE;
+ delete md;
+ return false;
}
md->moveOpacity =
@@ -857,97 +918,124 @@ moveInitDisplay (CompPlugin *p,
md->releaseButton = 0;
for (i = 0; i < NUM_KEYS; i++)
- md->key[i] = XKeysymToKeycode (d->display,
+ md->key[i] = XKeysymToKeycode (d->dpy (),
XStringToKeysym (mKeys[i].name));
- WRAP (md, d, handleEvent, moveHandleEvent);
- d->base.privates[displayPrivateIndex].ptr = md;
+ d->privates[displayPrivateIndex].ptr = md;
- return TRUE;
+ return true;
}
static void
-moveFiniDisplay (CompPlugin *p,
- CompDisplay *d)
+moveFiniDisplay (CompObject *o)
{
+ CORE_DISPLAY (o);
MOVE_DISPLAY (d);
freeScreenPrivateIndex (d, md->screenPrivateIndex);
- UNWRAP (md, d, handleEvent);
-
compFiniDisplayOptions (d, md->opt, MOVE_DISPLAY_OPTION_NUM);
- free (md);
+ delete md;
}
-static Bool
-moveInitScreen (CompPlugin *p,
- CompScreen *s)
+static bool
+moveInitScreen (CompObject *o)
{
MoveScreen *ms;
- MOVE_DISPLAY (s->display);
+ CORE_SCREEN (o);
+ MOVE_DISPLAY (s->display ());
- ms = (MoveScreen *) malloc (sizeof (MoveScreen));
+ ms = new MoveScreen (s);
if (!ms)
- return FALSE;
+ return false;
- ms->grabIndex = 0;
+ ms->windowPrivateIndex = allocateWindowPrivateIndex (s);
+ if (ms->windowPrivateIndex < 0)
+ {
+ delete ms;
+ return false;
+ }
- ms->moveCursor = XCreateFontCursor (s->display->display, XC_fleur);
+ ms->grabIndex = 0;
- WRAP (ms, s, paintWindow, movePaintWindow);
+ ms->moveCursor = XCreateFontCursor (s->display ()->dpy (), XC_fleur);
- s->base.privates[md->screenPrivateIndex].ptr = ms;
+ s->privates[md->screenPrivateIndex].ptr = ms;
- return TRUE;
+ return true;
}
static void
-moveFiniScreen (CompPlugin *p,
- CompScreen *s)
+moveFiniScreen (CompObject *o)
{
+ CORE_SCREEN (o);
MOVE_SCREEN (s);
- UNWRAP (ms, s, paintWindow);
+ freeWindowPrivateIndex (s, ms->windowPrivateIndex);
if (ms->moveCursor)
- XFreeCursor (s->display->display, ms->moveCursor);
+ XFreeCursor (s->display ()->dpy (), ms->moveCursor);
- free (ms);
+ delete ms;
}
-static CompBool
-moveInitObject (CompPlugin *p,
- CompObject *o)
+static bool
+moveInitWindow (CompObject *o)
+{
+ MoveWindow *mw;
+
+ CORE_WINDOW (o);
+ MOVE_SCREEN (w->screen ());
+
+ mw = new MoveWindow (w);
+ if (!mw)
+ return false;
+
+ w->privates[ms->windowPrivateIndex].ptr = mw;
+
+ return true;
+}
+
+static void
+moveFiniWindow (CompObject *o)
+{
+ CORE_WINDOW (o);
+ MOVE_WINDOW (w);
+
+ delete mw;
+}
+
+bool
+MovePluginVTable::initObject (CompObject *o)
{
static InitPluginObjectProc dispTab[] = {
(InitPluginObjectProc) 0, /* InitCore */
(InitPluginObjectProc) moveInitDisplay,
- (InitPluginObjectProc) moveInitScreen
+ (InitPluginObjectProc) moveInitScreen,
+ (InitPluginObjectProc) moveInitWindow
};
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (o));
}
-static void
-moveFiniObject (CompPlugin *p,
- CompObject *o)
+void
+MovePluginVTable::finiObject (CompObject *o)
{
static FiniPluginObjectProc dispTab[] = {
(FiniPluginObjectProc) 0, /* FiniCore */
(FiniPluginObjectProc) moveFiniDisplay,
- (FiniPluginObjectProc) moveFiniScreen
+ (FiniPluginObjectProc) moveFiniScreen,
+ (FiniPluginObjectProc) moveFiniWindow
};
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
+ DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (o));
}
-static CompOption *
-moveGetObjectOptions (CompPlugin *plugin,
- CompObject *object,
+CompOption *
+MovePluginVTable::getObjectOptions (CompObject *object,
int *count)
{
static GetPluginObjectOptionsProc dispTab[] = {
@@ -956,12 +1044,11 @@ moveGetObjectOptions (CompPlugin *plugin,
};
RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab),
- (CompOption *) (*count = 0), (plugin, object, count));
+ (CompOption *) (*count = 0), (object, count));
}
-static CompBool
-moveSetObjectOption (CompPlugin *plugin,
- CompObject *object,
+bool
+MovePluginVTable::setObjectOption (CompObject *object,
const char *name,
CompOptionValue *value)
{
@@ -971,57 +1058,48 @@ moveSetObjectOption (CompPlugin *plugin,
};
RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), FALSE,
- (plugin, object, name, value));
+ (object, name, value));
}
-static Bool
-moveInit (CompPlugin *p)
+bool
+MovePluginVTable::init ()
{
if (!compInitPluginMetadataFromInfo (&moveMetadata,
- p->vTable->name,
+ name (),
moveDisplayOptionInfo,
MOVE_DISPLAY_OPTION_NUM,
0, 0))
- return FALSE;
+ return false;
displayPrivateIndex = allocateDisplayPrivateIndex ();
if (displayPrivateIndex < 0)
{
compFiniMetadata (&moveMetadata);
- return FALSE;
+ return false;
}
- compAddMetadataFromFile (&moveMetadata, p->vTable->name);
+ compAddMetadataFromFile (&moveMetadata, name ());
- return TRUE;
+ return true;
}
-static void
-moveFini (CompPlugin *p)
+void
+MovePluginVTable::fini ()
{
freeDisplayPrivateIndex (displayPrivateIndex);
compFiniMetadata (&moveMetadata);
}
-static CompMetadata *
-moveGetMetadata (CompPlugin *plugin)
+CompMetadata *
+MovePluginVTable::getMetadata ()
{
return &moveMetadata;
}
-CompPluginVTable moveVTable = {
- "move",
- moveGetMetadata,
- moveInit,
- moveFini,
- moveInitObject,
- moveFiniObject,
- moveGetObjectOptions,
- moveSetObjectOption
-};
+MovePluginVTable moveVTable;
CompPluginVTable *
-getCompPluginInfo20070830 (void)
+getCompPluginInfo20080805 (void)
{
return &moveVTable;
}
diff --git a/src/Makefile.am b/src/Makefile.am
index ee74639..a59866c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,11 +16,11 @@ compiz_SOURCES = \
privates.cpp \
object.cpp \
core.cpp \
- texture.cpp \
display.cpp \
screen.cpp \
window.cpp \
event.cpp \
+ texture.cpp \
paint.cpp \
option.cpp \
plugin.cpp \
diff --git a/src/core.cpp b/src/core.cpp
index 5e6f893..9e88618 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -24,10 +24,13 @@
*/
#include <string.h>
+#include <sys/poll.h>
+#include <assert.h>
#include <compiz-core.h>
+#include "privatecore.h"
-CompCore core;
+CompCore *core;
static char *corePrivateIndices = 0;
static int corePrivateLen = 0;
@@ -38,11 +41,11 @@ reallocCorePrivate (int size,
{
void *privates;
- privates = realloc (core.base.privates, size * sizeof (CompPrivate));
+ privates = realloc (core->privates, size * sizeof (CompPrivate));
if (!privates)
return FALSE;
- core.base.privates = (CompPrivate *) privates;
+ core->privates = (CompPrivate *) privates;
return TRUE;
}
@@ -96,209 +99,545 @@ freeCorePrivateIndex (int index)
compObjectFreePrivateIndex (NULL, COMP_OBJECT_TYPE_CORE, index);
}
-static CompBool
-initCorePluginForObject (CompPlugin *p,
- CompObject *o)
+
+#define TIMEVALDIFF(tv1, tv2) \
+ ((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
+ ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
+ ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
+ ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
+ (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000
+
+CompCore::CompCore ()
{
- return TRUE;
+ priv = new PrivateCore (this);
+ assert (priv);
+
+ compObjectInit (this, 0, COMP_OBJECT_TYPE_CORE);
}
-static void
-finiCorePluginForObject (CompPlugin *p,
- CompObject *o)
+bool
+CompCore::init ()
{
+ WRAPABLE_INIT_HND(fileW