summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2009-01-12 22:30:29 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2009-01-12 22:30:29 +0900
commitd830c06ceba017032cda5093b0cc7bbaeac9acfd (patch)
treeb9e94eee55aff844d270dbf2ad90608a57ead512
parent009c171da9bc6042650620050070216a1e3767e0 (diff)
downloadlazypointer-d830c06ceba017032cda5093b0cc7bbaeac9acfd.tar.gz
lazypointer-d830c06ceba017032cda5093b0cc7bbaeac9acfd.tar.bz2
Intial C++ port, doesn't work yet
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile38
-rw-r--r--lazypointer.c538
-rw-r--r--lazypointer.h107
-rw-r--r--lazypointer.xml.in4
-rw-r--r--plugin.info2
6 files changed, 118 insertions, 573 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 960a766..fb10d5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,3 @@
include (CompizFusion)
-compiz_fusion_plugin (lazypointer)
+compiz_fusion_plugin (lazypointer PLUGINDEPS composite opengl)
diff --git a/Makefile b/Makefile
index d9a07cf..74f997e 100644
--- a/Makefile
+++ b/Makefile
@@ -89,14 +89,14 @@ INSTALL = install
BCOP = `pkg-config --variable=bin bcop`
-CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD)
+CFLAGS = -g -Wall -Wpointer-arith -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD)
LDFLAGS = `pkg-config --libs $(PKG_DEP) compiz ` $(LDFLAGS_ADD)
DEFINES = -DIMAGEDIR=\"$(IMAGEDIR)\" -DDATADIR=\"$(DATADIR)\"
POFILEDIR = $(shell if [ -n "$(PODIR)" ]; then $(ECHO) $(PODIR); else $(ECHO) ./po;fi )
-COMPIZ_HEADERS = compiz.h compiz-core.h
+COMPIZ_HEADERS = compiz.h core/core.h
COMPIZ_INC = $(shell pkg-config --variable=includedir compiz)/compiz/
is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in | grep "useBcop=\"true\""; \
@@ -105,7 +105,6 @@ is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in
trans-target := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml;fi )
bcop-target := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-bcop-target-src := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.c; fi )
bcop-target-hdr := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.h; fi )
gen-schemas := $(shell if [ \( -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml \) -a -n "`pkg-config --variable=xsltdir compiz-gconf`" ]; then $(ECHO) true; fi )
@@ -119,17 +118,14 @@ endif
# find all the object files
-c-objs := $(patsubst %.c,%.lo,$(shell find -name '*.c' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
+c-objs := $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
c-objs += $(patsubst %.cxx,%.lo,$(shell find -name '*.cxx' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs := $(filter-out $(bcop-target-src:.c=.lo),$(c-objs))
h-files := $(shell find -name '*.h' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')
h-files += $(bcop-target-hdr)
h-files += $(foreach file,$(COMPIZ_HEADERS) $(CHK_HEADERS),$(shell $(ECHO) -n "$(COMPIZ_INC)$(file)"))
all-c-objs := $(addprefix $(BUILDDIR)/,$(c-objs))
-all-c-objs += $(bcop-target-src:.c=.lo)
# additional files
@@ -280,35 +276,13 @@ $(BUILDDIR)/compiz-%.pc: compiz-%.pc.in
# Compiling
#
-$(BUILDDIR)/%.lo: %.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: $(BUILDDIR)/%.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
$(BUILDDIR)/%.lo: %.cpp $(h-files)
@if [ '$(color)' != 'no' ]; then \
$(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
else \
$(ECHO) "compiling $< -> $@"; \
fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
+ @$(LIBTOOL) --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
@if [ '$(color)' != 'no' ]; then \
$(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
fi
@@ -319,7 +293,7 @@ $(BUILDDIR)/%.lo: %.cxx $(h-files)
else \
$(ECHO) "compiling $< -> $@"; \
fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
+ @$(LIBTOOL) --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
@if [ '$(color)' != 'no' ]; then \
$(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
fi
@@ -336,7 +310,7 @@ $(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs)
else \
$(ECHO) "linking : $@"; \
fi
- @$(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs)
+ @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs) -R `pkg-config --variable=libdir compiz`/compiz
@if [ '$(color)' != 'no' ]; then \
$(ECHO) -e "\r\033[0mlinking : \033[34m$@\033[0m"; \
fi
diff --git a/lazypointer.c b/lazypointer.c
deleted file mode 100644
index a356ac2..0000000
--- a/lazypointer.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/**
- *
- * Compiz lazypointer
- *
- * lazypointer.c
- *
- * Copyright (c) 2008 Sam Spilsbury <smspillaz@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Warps your pointer based on window events and actions so that
- * you don't have to.
- *
- * TODO: Maybe some animation would look sexy
- **/
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <compiz-core.h>
-
-#include "lazypointer_options.h"
-
-#define PI 3.1415926
-
-static int displayPrivateIndex;
-
-typedef struct _LpDisplay
-{
- int screenPrivateIndex;
-} LpDisplay;
-
-typedef struct _LpScreen
-{
- FocusWindowProc focusWindow;
- ActivateWindowProc activateWindow;
- PlaceWindowProc placeWindow;
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- int destX, destY;
- int initialX, initialY;
- Bool needsWarp;
-} LpScreen;
-
-
-#define GET_LP_DISPLAY(d) \
- ((LpDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define LP_DISPLAY(d) \
- LpDisplay *ld = GET_LP_DISPLAY (d)
-
-#define GET_LP_SCREEN(s, ld) \
- ((LpScreen *) (s)->base.privates[(ld)->screenPrivateIndex].ptr)
-
-#define LP_SCREEN(s) \
- LpScreen *ls = GET_LP_SCREEN (s, GET_LP_DISPLAY (s->display))
-
-static void
-lpPreparePaintScreen (CompScreen *s,
- int ms)
-{
- float speed = lazypointerGetSpeed (s->display);
- float steps = ((float) ms / ((20.1 - speed) * 100));
- LP_SCREEN (s);
-
- if (steps < 0.0005)
- steps = 0.0005;
-
- if (ls->needsWarp)
- {
-
- if (ls->destX >= s->width)
- ls->destX = s->width - 1;
- if (ls->destX <= 0)
- ls->destX = 1;
- if (ls->destY >= s->height)
- ls->destY = s->height -1;
- if (ls->destY <= 0)
- ls->destY = 1;
-
- int dx = ceilf(steps * (ls->destX - pointerX) * speed);
- int dy = ceilf(steps * (ls->destY - pointerY) * speed);
-
- if (dx > 10)
- dx = 10;
- if (dy > 10)
- dy = 10;
-
- if (dx < -10)
- dx = -10;
- if (dy < -10)
- dy = -10;
-
- if (dx == 0 && dy == 0)
- ls->needsWarp = FALSE;
-
- warpPointer (s, dx, dy);
- }
-
- UNWRAP (ls, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, ms);
- WRAP (ls, s, preparePaintScreen, lpPreparePaintScreen);
-}
-
-static void
-lpDonePaintScreen (CompScreen *s)
-{
- LP_SCREEN (s);
-
- if (pointerX != ls->destX || pointerY != ls->destY)
- damageScreen (s); /* Shouldn't do that */
-
- UNWRAP (ls, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (ls, s, donePaintScreen, lpDonePaintScreen);
-}
-
-static Bool
-lpPlaceWindow (CompWindow *w,
- int x,
- int y,
- int *newX,
- int *newY)
-{
- LP_SCREEN (w->screen);
-
- int cX = (*newX - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
- int cY = (*newY - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
- Window root, child;
- int rx, ry, winx, winy;
- unsigned int mask;
- Bool ret;
- Bool status;
-
- ret = XQueryPointer(w->screen->display->display, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-
- if (ret && lazypointerGetCentreOnPlace (w->screen->display))
- {
- ls->initialX = rx;
- ls->initialY = ry;
-
- ls->destX = cX;
- ls->destY = cY;
- ls->needsWarp = TRUE;
- damageScreen (w->screen);
- }
-
- UNWRAP (ls, w->screen, placeWindow);
- status = (*w->screen->placeWindow) (w, x, y, newX, newY);
- WRAP (ls, w->screen, placeWindow, lpPlaceWindow);
-
- return status;
-}
-
-static void
-lpActivateWindow (CompWindow *w)
-{
- LP_SCREEN (w->screen);
-
- int cX = (w->attrib.x - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
- int cY = (w->attrib.y - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
- Window root, child;
- int rx, ry, winx, winy;
- unsigned int mask;
- Bool ret;
-
- ret = XQueryPointer(w->screen->display->display, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-
- if (ret && lazypointerGetCentreOnActivate (w->screen->display))
- {
- ls->initialX = rx;
- ls->initialY = ry;
-
- ls->destX = cX;
- ls->destY = cY;
- ls->needsWarp = TRUE;
- damageScreen (w->screen);
- }
-
- UNWRAP (ls, w->screen, activateWindow);
- (*w->screen->activateWindow) (w);
- WRAP (ls, w->screen, activateWindow, lpActivateWindow);
-}
-
-static Bool
-lpFocusWindow (CompWindow *w)
-{
- LP_SCREEN (w->screen);
-
- int cX = (w->attrib.x - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
- int cY = (w->attrib.y - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
- Window root, child;
- int rx, ry, winx, winy;
- unsigned int mask;
- Bool ret;
- Bool status;
-
- ret = XQueryPointer(w->screen->display->display, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-
- if (ret && lazypointerGetCentreOnFocus (w->screen->display))
- {
- ls->initialX = rx;
- ls->initialY = ry;
-
- ls->destX = cX;
- ls->destY = cY;
- ls->needsWarp = TRUE;
- damageScreen (w->screen);
- }
-
- UNWRAP (ls, w->screen, focusWindow);
- status = (*w->screen->focusWindow) (w);
- WRAP (ls, w->screen, focusWindow, lpFocusWindow);
-
- return status;
-}
-
-static Bool
-lpWinInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompWindow *w;
-
- w = findWindowAtDisplay (d, getIntOptionNamed (option, nOption, "window", 0));
-
- if (!w)
- return FALSE;
-
- LP_SCREEN (w->screen);
-
- int cX = (w->attrib.x - w->input.left) + ((w->width + w->input.right + w->input.left) / 2);
- int cY = (w->attrib.y - w->input.top) + ((w->height + w->input.top + w->input.bottom) / 2);
- Window root, child;
- int rx, ry, winx, winy;
- unsigned int mask;
- Bool ret;
-
- ret = XQueryPointer(d->display, w->screen->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-
- if (ret)
- {
- ls->initialX = rx;
- ls->initialY = ry;
-
- ls->destX = cX;
- ls->destY = cY;
- ls->needsWarp = TRUE;
- damageScreen (w->screen);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-lpScreenInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
-
- if (!s)
- return FALSE;
-
- LP_SCREEN (s);
-
- int cX = (s->width / 2);
- int cY = (s->height / 2);
- Window root, child;
- int rx, ry, winx, winy;
- unsigned int mask;
- Bool ret;
-
- ret = XQueryPointer(d->display, s->root,
- &root, &child,
- &rx, &ry, &winx, &winy, &mask);
-
- if (ret)
- {
- ls->initialX = rx;
- ls->initialY = ry;
-
- ls->destX = cX;
- ls->destY = cY;
- ls->needsWarp = TRUE;
- damageScreen (s);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-lpLeftInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
-
- if (!s)
- return FALSE;
-
- warpPointer (s, -1, 0);
-
- return TRUE;
-}
-
-static Bool
-lpRightInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
-
- if (!s)
- return FALSE;
-
- warpPointer (s, 1, 0);
-
- return TRUE;
-}
-
-static Bool
-lpUpInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
-
- if (!s)
- return FALSE;
-
- warpPointer (s, 0, -1);
-
- return TRUE;
-}
-
-static Bool
-lpDownInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "screen", 0));
-
- if (!s)
- return FALSE;
-
- warpPointer (s, 0, -1);
-
- return TRUE;
-}
-
-static Bool
-lpInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- LpDisplay *ld;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- ld = malloc (sizeof (LpDisplay));
- if (!ld)
- return FALSE;
-
- ld->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (ld->screenPrivateIndex < 0)
- {
- free (ld);
- return FALSE;
- }
-
- lazypointerSetInitiateWindowKeyInitiate (d, lpWinInitiate);
- lazypointerSetInitiateScreenKeyInitiate (d, lpScreenInitiate);
- lazypointerSetInitiateLeftKeyInitiate (d, lpLeftInitiate);
- lazypointerSetInitiateRightKeyInitiate (d, lpRightInitiate);
- lazypointerSetInitiateUpKeyInitiate (d, lpUpInitiate);
- lazypointerSetInitiateDownKeyInitiate (d, lpDownInitiate);
-
- d->base.privates[displayPrivateIndex].ptr = ld;
-
- return TRUE;
-}
-
-static void
-lpFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- LP_DISPLAY (d);
-
- freeScreenPrivateIndex (d, ld->screenPrivateIndex);
-
- free (ld);
-}
-
-static Bool
-lpInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- LpScreen * ls;
-
- LP_DISPLAY (s->display);
-
- ls = malloc (sizeof (LpScreen));
- if (!ls)
- return FALSE;
-
- WRAP (ls, s, activateWindow, lpActivateWindow);
- WRAP (ls, s, focusWindow, lpFocusWindow);
- WRAP (ls, s, placeWindow, lpPlaceWindow);
- WRAP (ls, s, preparePaintScreen, lpPreparePaintScreen);
- WRAP (ls, s, donePaintScreen, lpDonePaintScreen);
-
- ls->needsWarp = FALSE;
- ls->destX = 0;
- ls->destY = 0;
-
- s->base.privates[ld->screenPrivateIndex].ptr = ls;
-
- return TRUE;
-}
-
-static void
-lpFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- LP_SCREEN (s);
-
- UNWRAP (ls, s, activateWindow);
- UNWRAP (ls, s, focusWindow);
- UNWRAP (ls, s, placeWindow);
- UNWRAP (ls, s, preparePaintScreen);
- UNWRAP (ls, s, donePaintScreen);
-
- free (ls);
-}
-
-static CompBool
-lpInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) lpInitDisplay,
- (InitPluginObjectProc) lpInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-lpFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) lpFiniDisplay,
- (FiniPluginObjectProc) lpFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static Bool
-lpInit (CompPlugin *p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-lpFini (CompPlugin *p)
-{
- freeDisplayPrivateIndex(displayPrivateIndex);
-}
-
-static CompPluginVTable lpVTable = {
- "lazypointer",
- 0,
- lpInit,
- lpFini,
- lpInitObject,
- lpFiniObject,
- 0,
- 0
-};
-
-CompPluginVTable*
-getCompPluginInfo (void)
-{
- return &lpVTable;
-}
diff --git a/lazypointer.h b/lazypointer.h
new file mode 100644
index 0000000..1a3f080
--- /dev/null
+++ b/lazypointer.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright © 2009 Sam Spilsbury
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Sam Spilsbury not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Sam Spilsbury makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * SAM SPILSBURY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL SAM SPILSBURY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Sam Spilsbury <smspillaz@gmail.com
+ */
+
+#include <core/core.h>
+#include <core/privatehandler.h>
+#include <composite/composite.h>
+
+class LPScreen :
+ public ScreenInterface,
+ public CompositeScreenInterface,
+ public PrivateHandler <LPScreen, CompScreen>,
+ public LazypointerOptions
+{
+ public:
+
+ LPScreen (CompScreen *s);
+
+ CompositeScreen *cScreen;
+
+ void preparePaint (int);
+ void donePaint ();
+ int destX, destY;
+ int initialX, initialY;
+ Bool needsWarp;
+
+ /* Actions */
+
+ static bool
+ screenInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+ static bool
+ winInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+ static bool
+ leftInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+ static bool
+ rightInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+ static bool
+ upInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+ static bool
+ downInitiate (CompAction *,
+ CompAction::State,
+ CompOption::Vector&);
+};
+
+class LPWindow :
+ public WindowInterface,
+ public PrivateHandler <LPWindow, CompWindow>
+{
+ public:
+
+ LPWindow (CompWindow *w);
+
+ bool focus ();
+ void activate ();
+ bool place (CompPoint &pos);
+
+ CompWindow *window;
+};
+
+#define LP_SCREEN(s) \
+ LPScreen *ls = LPScreen::get (s)
+
+#define LP_WINDOW(w) \
+ LPWindow *lw = LPWindow::get (w)
+
+class LPPluginVTable :
+ public CompPlugin::VTableForScreenAndWindow<LPScreen, LPWindow>
+{
+ public:
+
+ bool init ();
+
+ PLUGIN_OPTION_HELPER (LPScreen);
+};
+
+COMPIZ_PLUGIN_20081216 (lazypointer, LPPluginVTable);
diff --git a/lazypointer.xml.in b/lazypointer.xml.in
index 24db8a5..be3f38c 100644
--- a/lazypointer.xml.in
+++ b/lazypointer.xml.in
@@ -9,7 +9,7 @@
<plugin>place</plugin>
</relation>
</deps>
- <display>
+ <screen>
<option type="bool" name="centre_on_focus">
<_short>Center Mouse on Focussed Window</_short>
<_long>Center the mouse in the middle of a window when it is focussed</_long>
@@ -56,6 +56,6 @@
<_short>Move pointer down</_short>
<_long>Move the pointer down by specified amount</_long>
</option>
- </display>
+ </screen>
</plugin>
</compiz>
diff --git a/plugin.info b/plugin.info
index 16c5cd9..92fce9c 100644
--- a/plugin.info
+++ b/plugin.info
@@ -1 +1,3 @@
PLUGIN = lazypointer
+PKG_DEP = compiz-opengl
+LD_FLAGS = -Wl, -rpath /opt/compiz/lib/compiz