summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2009-08-31 07:42:33 +0800
committerSam Spilsbury <smspillaz@gmail.com>2009-08-31 07:42:33 +0800
commitcbe090d47744427ad394df1d9d2a03144ddef19b (patch)
tree4754a393dda613bd5179e207894a82990144bb0a
parent8538d7c5a94fe880ff36feee3e750d9ab984600c (diff)
downloadexample-cbe090d47744427ad394df1d9d2a03144ddef19b.tar.gz
example-cbe090d47744427ad394df1d9d2a03144ddef19b.tar.bz2
Update buildsystem
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile507
-rw-r--r--example.xml.in29
-rw-r--r--plugin.info9
-rw-r--r--src/example.cpp415
-rw-r--r--src/example.h266
6 files changed, 714 insertions, 518 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b96e5c..2475d9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compix REQUIRED)
-compiz_fusion_plugin (example)
+include (Compiz)
+
+compiz_fusion_plugin (example PLUGINDEPS composite opengl)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index fb9d387..0000000
--- a/Makefile
+++ /dev/null
@@ -1,507 +0,0 @@
-##
-#
-# Compiz plugin Makefile
-#
-# Copyright : (C) 2007 by Dennis Kasprzyk
-# E-mail : onestone@deltatauchi.de
-#
-#
-# 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.
-#
-##
-
-# plugin.info file contents
-#
-# PLUGIN = foo
-# PKG_DEP = pango
-# LDFLAGS_ADD = -lGLU
-# CFLAGS_ADD = -I/usr/include/foo
-# CHK_HEADERS = compiz-cube.h
-#
-
-#load config file
-
-ECHO = `which echo`
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-ifeq ($(shell if [ -f plugin.info ]; then $(ECHO) -n "found"; fi ),found)
-include plugin.info
-else
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\033[1;31m[ERROR]\033[0m \"plugin.info\" file not found"; \
- else \
- $(ECHO) "[ERROR] \"plugin.info\" file not found"; \
- fi;))
-endif
-
-ifneq ($(shell if pkg-config --exists compiz; then $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m Compiz not installed"; \
- else \
- $(ECHO) -n "[ERROR] Compiz not installed"; \
- fi))
-endif
-
-
-ifneq ($(shell if [ -n "$(PKG_DEP)" ]; then if pkg-config --exists $(PKG_DEP); then $(ECHO) -n "found"; fi; \
- else $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m "; \
- else \
- $(ECHO) -n "[ERROR] "; \
- fi; \
- pkg-config --print-errors --short-errors --errors-to-stdout $(PKG_DEP); ))
-endif
-
-
-ifeq ($(BUILD_GLOBAL),true)
- PREFIX = $(shell pkg-config --variable=prefix compiz)
- CLIBDIR = $(shell pkg-config --variable=libdir compiz)
- CINCDIR = $(shell pkg-config --variable=includedir compiz)
- PKGDIR = $(CLIBDIR)/pkgconfig
- DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz
- XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
-else
- DESTDIR = $(HOME)/.compiz/plugins
- XMLDIR = $(HOME)/.compiz/metadata
- IMAGEDIR = $(HOME)/.compiz/images
- DATADIR = $(HOME)/.compiz/data
-endif
-
-BUILDDIR = build
-
-CC = gcc
-CPP = g++
-LIBTOOL = libtool
-INSTALL = install
-
-BCOP = `pkg-config --variable=bin bcop`
-
-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 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\""; \
- else if [ -e $(PLUGIN).xml ]; then cat $(PLUGIN).xml | grep "useBcop=\"true\""; fi; fi)
-
-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-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 )
-schema-target := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-schema-output := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/compiz-$(PLUGIN).schema; fi )
-
-ifeq ($(BUILD_GLOBAL),true)
- pkg-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" ]; then $(ECHO) "$(BUILDDIR)/compiz-$(PLUGIN).pc"; fi )
- hdr-install-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" -a -e compiz-$(PLUGIN).h ]; then $(ECHO) "compiz-$(PLUGIN).h"; fi )
-endif
-
-# find all the object files
-
-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/^.\///'))
-
-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))
-
-# additional files
-
-data-files := $(shell find data/ -name '*' -type f 2> /dev/null | sed -e 's/data\///')
-image-files := $(shell find images/ -name '*' -type f 2> /dev/null | sed -e 's/images\///')
-
-# system include path parameter, -isystem doesn't work on old gcc's
-inc-path-param = $(shell if [ -z "`gcc --version | head -n 1 | grep ' 3'`" ]; then $(ECHO) "-isystem"; else $(ECHO) "-I"; fi)
-
-# Tests
-ifeq ($(shell if [ -n "$(is-bcop-target)" -a -z "$(BCOP)" ]; then $(ECHO) -n "error"; fi ),error)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m BCOP not installed but is needed to build plugin"; \
- else \
- $(ECHO) -n "[ERROR] BCOP not installed but is needed to build plugin"; \
- fi))
-endif
-
-ifeq ($(shell if [ "x$(BUILD_GLOBAL)" != "xtrue" -a -e compiz-$(PLUGIN).pc.in ]; then $(ECHO) -n "warn"; fi ),warn)
-$(warning $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[WARNING]\033[0m This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\" "; \
- else \
- $(ECHO) -n "[WARNING] This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\""; \
- fi))
-endif
-
-#
-# Do it.
-#
-
-.PHONY: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-all: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-trans-build: $(trans-target)
-
-bcop-build: $(bcop-target-hdr) $(bcop-target-src)
-
-schema-creation: $(schema-output)
-
-c-build-objs: $(all-c-objs)
-
-c-link-plugin: $(BUILDDIR)/lib$(PLUGIN).la
-
-pkg-creation: $(pkg-target)
-
-#
-# Create build directory
-#
-
-$(BUILDDIR) :
- @mkdir -p $(BUILDDIR)
-
-$(DESTDIR) :
- @mkdir -p $(DESTDIR)
-
-#
-# fallback if xml.in doesn't exists
-#
-$(BUILDDIR)/%.xml: %.xml
- @cp $< $@
-
-#
-# Translating
-#
-$(BUILDDIR)/%.xml: %.xml.in
- @if [ -d $(POFILEDIR) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mtranslate \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "translate $< -> $@"; \
- fi; \
- intltool-merge -x -u $(POFILEDIR) $< $@ > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mtranslate : \033[34m$< -> $@\033[0m"; \
- fi; \
- else \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mconvert \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "convert $< -> $@"; \
- fi; \
- cat $< | sed -e 's;<_;<;g' -e 's;</_;</;g' > $@; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mconvert : \033[34m$< -> $@\033[0m"; \
- fi; \
- fi
-
-#
-# BCOP'ing
-
-$(BUILDDIR)/%_options.h: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --header=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%_options.c: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --source=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Schema generation
-
-$(BUILDDIR)/compiz-%.schema: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mschema'ing\033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "schema'ing $< -> $@"; \
- fi
- @xsltproc `pkg-config --variable=xsltdir compiz-gconf`/schemas.xslt $< > $@
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mschema : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# pkg config file generation
-
-$(BUILDDIR)/compiz-%.pc: compiz-%.pc.in
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mpkgconfig \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "pkgconfig $< -> $@"; \
- fi
- @COMPIZREQUIRES=`cat $(PKGDIR)/compiz.pc | grep Requires | sed -e 's;Requires: ;;g'`; \
- COMPIZCFLAGS=`cat $(PKGDIR)/compiz.pc | grep Cflags | sed -e 's;Cflags: ;;g'`; \
- sed -e 's;@prefix@;$(PREFIX);g' -e 's;\@libdir@;$(CLIBDIR);g' \
- -e 's;@includedir@;$(CINCDIR);g' -e 's;\@VERSION@;0.0.1;g' \
- -e "s;@COMPIZ_REQUIRES@;$$COMPIZREQUIRES;g" \
- -e "s;@COMPIZ_CFLAGS@;$$COMPIZCFLAGS;g" $< > $@;
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mpkgconfig : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Compiling
-#
-
-$(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 $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cxx $(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) --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Linking
-#
-
-cxx-rpath-prefix := -Wl,-rpath,
-
-$(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mlinking \033[0m: \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "linking : $@"; \
- fi
- @$(LIBTOOL) --quiet --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
-
-
-clean:
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mremoving \033[0m: \033[0;31m./$(BUILDDIR)\033[0m"; \
- else \
- $(ECHO) "removing : ./$(BUILDDIR)"; \
- fi
- @rm -rf $(BUILDDIR)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mremoving : \033[34m./$(BUILDDIR)\033[0m"; \
- fi
-
-
-install: $(DESTDIR) all
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "install : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi
- @mkdir -p $(DESTDIR)
- @$(INSTALL) $(BUILDDIR)/.libs/lib$(PLUGIN).so $(DESTDIR)/lib$(PLUGIN).so
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi
- @if [ -e $(BUILDDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "install : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- mkdir -p $(XMLDIR); \
- $(INSTALL) $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "install : $(schema-output)"; \
- fi; \
- if [ "x$(USER)" = "xroot" ]; then \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-install-rule $(schema-output) > /dev/null; \
- else \
- gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
- fi; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- mkdir -p $(DATADIR); \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(DATADIR)/$$FILE"; \
- fi; \
- FILEDIR="$(DATADIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s data/$$FILE $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- mkdir -p $(IMAGEDIR); \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \
- fi; \
- FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s images/$$FILE $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
-
-uninstall:
- @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi; \
- rm -f $(DESTDIR)/lib$(PLUGIN).so; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi; \
- fi
- @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- rm -f $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- rm -f $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" -a 'x$(USER)' = 'xroot' ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(schema-output)"; \
- fi; \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-uninstall-rule $(schema-output) > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \
- fi; \
- rm -f $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \
- fi; \
- rm -f $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
diff --git a/example.xml.in b/example.xml.in
new file mode 100644
index 0000000..2b75615
--- /dev/null
+++ b/example.xml.in
@@ -0,0 +1,29 @@
+<compiz>
+ <plugin name="example" useBcop="true">
+ <_short>Example plugin</_short>
+ <_long>Developers are awesome</_long>
+ <relation type="after">
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
+ </relation>
+ <requirement>
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
+ </requirement>
+ <screen>
+ <option type="key" name="example">
+ <_short>Example Action</_short>
+ <_long>Example action. See what comes out of a terminal? Familiar with the code yet?</_long>
+ </option>
+ <option type="key" name="special">
+ <_short>Special Action</_short>
+ <_long>Special action. See how it works</_long>
+ </option>
+ <option type="key" name="custom">
+ <_short>Custom Action</_short>
+ <_long>Custom action. Where did that 42 come from? Isn't boost::bind awesome!</_long>
+ </option>
+ </screen>
+ </plugin>
+</compiz>
+
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 0cf43ca..0000000
--- a/plugin.info
+++ /dev/null
@@ -1,9 +0,0 @@
-# Plugin.info is a file the Makefile imports for further information about your plugin.
-# Plugin name
-PLUGIN = example
-# Any pkg-config packages this plugin depends on?
-#PKG_DEP = compiz
-# Any flags that should be passed to the linker?
-#LD_FLAGS =
-# Any flags that should be passed to the compiler?
-#CFLAGS =
diff --git a/src/example.cpp b/src/example.cpp
new file mode 100644
index 0000000..2589ebb
--- /dev/null
+++ b/src/example.cpp
@@ -0,0 +1,415 @@
+/* Compiz example plugin
+ * example.cpp
+ *
+ * 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.
+ *
+ * Your own copyright notice would go above. You are free to choose whatever
+ * licence you want, just take note that some compiz code is GPL and you will
+ * not be able to re-use it if you want to use a different licence.
+ */
+
+#include "example.h"
+
+/* You must also call this. This creates a proper vTable for a plugin name in the
+ * first argument (it's a macro, so you don't need a string). This changes from
+ * time to time as the vTable changes, so it is a good way of ensure plugins keep
+ * current */
+
+COMPIZ_PLUGIN_20090315 (example, ExamplePluginVTable);
+
+/* This is the function that is called before the screen is 're-painted'. It is used for animation
+ * and such because it gives you a time difference between when the last time the screen was repainted
+ * and the current time of the execution of the functions in milliseconds). It's part of the composite
+ * plugin's interface
+ */
+
+void
+ExampleScreen::preparePaint (int ms)
+{
+ /* compLogMessage is a framework for reporting messages to the terminal via compiz */
+ compLogMessage ("example", CompLogLevelInfo, "preparePaint Called\n");
+
+ /* At the end of every function, you must call BaseClass->functionName (args) in order to pass on
+ * the call chain */
+ cScreen->preparePaint (ms);
+}
+
+/* This is the guts of the paint function. You can transform the way the entire output is painted
+ * or you can just draw things on screen with openGL. The unsigned int here is a mask for painting
+ * the screen, see opengl/opengl.h on how you can change it */
+
+bool
+ExampleScreen::glPaintOutput (const GLScreenPaintAttrib &attrib, // Some basic attribs on how the screen should be painted
+ const GLMatrix &transform, // Screen transformation matrix
+ const CompRegion &region, // Region of screen being painted
+ CompOutput *output, // Output properties. Use this to the get output width and height for the output being painted
+ unsigned int mask /* Some other paint properties, see opengl.h */)
+{
+ bool ret;
+ compLogMessage ("example", CompLogLevelInfo, "glPaintOutput Called\n");
+
+ /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
+ ret = gScreen->glPaintOutput (attrib, transform, region, output, mask);
+
+ return ret;
+}
+
+/* This is called when the output is transformed by a matrix. Basically the same, but core has
+ * done a few things for us like clip planes etc */
+
+void
+ExampleScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib, // Some basic attribs on how the screen should be painted
+ const GLMatrix &transform, // Screen transformation matrix
+ const CompRegion &region, // Region of screen being painted
+ CompOutput *output, // Output properties. Use this to the get output width and height for the output being painted
+ unsigned int mask /* Some other paint properties, see opengl.h */)
+{
+ compLogMessage ("example", CompLogLevelInfo, "glPaintOutput Called\n");
+
+ /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
+ gScreen->glPaintOutput (attrib, transform, region, output, mask);
+}
+
+/* This is called after screen painting is finished. It gives you a chance to do any cleanup and or
+ * call another repaint with screen->damageScreen (). It's also part of the composite plugin's
+ * interface.
+ */
+
+void
+ExampleScreen::donePaint ()
+{
+ compLogMessage ("example", CompLogLevelInfo, "donePaint Called\n");
+
+ cScreen->donePaint ();
+}
+
+/* This is our event handler. It directly hooks into the screen's X Event handler and allows us to handle
+ * our raw X Events
+ */
+
+void
+ExampleScreen::handleEvent (XEvent *event)
+{
+ compLogMessage ("example", CompLogLevelInfo, "handleEventCalled\n");
+
+ /* Switch event->type to see what kind of even we received */
+
+ switch (event->type)
+ {
+ /* Read event->xbutton for properties on this */
+ case ButtonPress:
+ fprintf (stderr, " * - Button Pressed Event!\n");
+ break;
+ /* Read event->xbutton for properties on this */
+ case ButtonRelease:
+ fprintf (stderr, " * - Button Released Event!\n");
+ break;
+ /* Read event->xmotion for properties on this */
+ case MotionNotify:
+ fprintf (stderr, " * - Motion Notify Event!\n");
+ break;
+ /* Read event->xkey for properties on this */
+ case KeyPress:
+ fprintf (stderr, " * - Key Pressed Event!\n");
+ break;
+ /* Read event->xkey for properties on this */
+ case KeyRelease:
+ fprintf (stderr, " * - Key Released Event!\n");
+ break;
+ /* Read event->xcrossing for properties on this */
+ case EnterNotify:
+ fprintf (stderr, " * - Enter Notify Event!\n");
+ break;
+ /* Read event->xcrossing for properties on this */
+ case LeaveNotify:
+ fprintf (stderr, " * - Leave Notify Event!\n");
+ break;
+ /* Read event->xconfigure for properties on this */
+ case ConfigureNotify:
+ fprintf (stderr, " * - ConfigureNotify Event!\n");
+ break;
+ default:
+ fprintf (stderr, " * - Unknown Event!\n");
+ break;
+ }
+
+ screen->handleEvent (event);
+}
+
+/* This gets called whenever the window needs to be repainted. WindowPaintAttrib gives you some
+ * attributes like brightness/saturation etc to play around with. GLMatrix is the window's
+ * transformation matrix. the unsigned int is the mask, have a look at opengl.h on what you can do
+ * with it */
+
+bool
+ExampleWindow::glPaint (const GLWindowPaintAttrib &attrib, // Brightness, Saturation, Opacity etc
+ const GLMatrix &transform, // Transformation Matrix
+ const CompRegion &region, // Repaint region
+ unsigned int mask) // Other flags. See opengl.h
+{
+ bool ret;
+ compLogMessage ("example", CompLogLevelInfo, "glPaint called!\n");
+
+ ret = gWindow->glPaint (attrib, transform, region, mask);
+
+ return ret;
+}
+
+/* This get's called whenever a window's rect is damaged. You can do stuff here or you can adjust the damage
+ * rectangle so that the window will update properly. Part of the CompositeWindowInterface.
+ */
+
+bool
+ExampleWindow::damageRect (bool initial, // initial damage?
+ const CompRect &rect) // The actual rect. Modifyable.
+{
+ bool ret;
+ compLogMessage ("example", CompLogLevelInfo, "damageRect called!\n");
+
+ ret = cWindow->damageRect (initial, rect);
+
+ return ret;
+}
+
+/* This is called whenever the window is focussed */
+
+bool
+ExampleWindow::focus ()
+{
+ bool ret;
+ compLogMessage ("example", CompLogLevelInfo, "focus called!\n");
+
+ ret = window->focus ();
+
+ return ret;
+}
+
+/* This is called whenever the window is activated */
+
+void
+ExampleWindow::activate ()
+{
+ compLogMessage ("example", CompLogLevelInfo, "activate called!\n");
+
+ window->activate ();
+}
+
+/* This is called whenever the window must be placed. You can alter the placement position by altering
+ * the CompPoint & */
+
+bool
+ExampleWindow::place (CompPoint &point)
+{
+ bool ret;
+ compLogMessage ("example", CompLogLevelInfo, "place called!\n");
+
+ ret = window->place (point);
+ return ret;
+}
+
+/* This is called whenever the window is moved. It tells you how far it's been moved and whether that
+ * move should be immediate or animated. (Immediate is usually for a sudden move, false for that
+ * usually means the user moved the window */
+
+void
+ExampleWindow::moveNotify (int dx,
+ int dy,
+ bool immediate)
+{
+ compLogMessage ("example", CompLogLevelInfo, "moveNotify called!\n");
+
+ window->moveNotify (dx, dy, immediate);
+}
+
+/* This is called whenever the window is resized. It tells you how much the window has been resized */
+
+void
+ExampleWindow::resizeNotify (int dx,
+ int dy,
+ int dwidth,
+ int dheight)
+{
+ compLogMessage ("example", CompLogLevelInfo, "resizeNotify called!\n");
+
+ window->resizeNotify (dx, dy, dwidth, dheight);
+}
+
+/* This is called when another plugin deems a window to be 'grabbed'. You can't actually 'grab' a
+ * window in X, but it is useful in case you need to know when a user has grabbed a window for some reason */
+
+void
+ExampleWindow::grabNotify (int x,
+ int y,
+ unsigned int state,
+ unsigned int mask)
+{
+ compLogMessage ("example", CompLogLevelInfo, "grabNotify called!\n");
+
+ window->grabNotify (x, y, state, mask);
+}
+
+/* This is called when a window in released from a grab. See above */
+
+void
+ExampleWindow::ungrabNotify ()
+{
+ compLogMessage ("example", CompLogLevelInfo, "ungrabNotify called!\n");
+
+ window->ungrabNotify ();
+}
+
+/* This is called when another misc notification arises, such as Map/Unmap etc */
+
+void
+ExampleWindow::windowNotify (CompWindowNotify n)
+{
+ compLogMessage ("example", CompLogLevelInfo, "windowNotify called!\n");
+
+ window->windowNotify (n);
+}
+
+/* This is an action. It is called on a keybinding as set in the options. It is binded when
+ * the class is constructed
+ */
+
+bool
+ExampleScreen::exampleInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options)
+{
+ compLogMessage ("example", CompLogLevelInfo, "exampleInitaite called!\n");
+
+ return false;
+}
+
+/* Some actions are initiated until the key is let go of, at which point they are terminated */
+
+bool
+ExampleScreen::specialInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options)
+{
+ compLogMessage ("example", CompLogLevelInfo, "specialInitiate called!\n");
+
+ /* You have to set the state to StateTerm* once you've finished with the action */
+
+ if (state & CompAction::StateInitButton)
+ {
+ action->setState (action->state () | CompAction::StateTermButton);
+ }
+
+ if (state & CompAction::StateInitKey)
+ action->setState (action->state () | CompAction::StateTermKey);
+
+ return false;
+}
+
+bool
+ExampleScreen::specialTerminate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options)
+{
+ compLogMessage ("example", CompLogLevelInfo, "specialTerminate called!\n");
+
+ /* It's always good practice to remove that state too */
+
+ action->setState (action->state () &
+ ~(CompAction::StateTermKey |
+ CompAction::StateTermButton));
+
+ return false;
+}
+
+/* Some actions are so awesome that you can have custom parameters with boost::bind */
+
+bool
+ExampleScreen::customInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector options,
+ int theMeaningOfLife)
+{
+ compLogMessage ("example", CompLogLevelInfo, "customInitiate called! The meaning of life is %i\n", theMeaningOfLife);
+
+ return false;
+}
+
+/* These are your constructors. You should initialize variables in the order that they are in the classes in your .h file */
+
+/* Lets get into buisness. This is the constructor, it replaces the initScreen, initEtc
+ * things that used to be in compiz and is called automatically when an instance of this
+ * class is created. Notice how it is the same name as the class name. It has to be that way.
+ */
+
+ExampleScreen::ExampleScreen (CompScreen *screen) :// The constructor takes a CompScreen *,
+ PluginClassHandler <ExampleScreen, CompScreen> (screen), // Initiate PluginClassHandler class template
+ screen (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ foo (42)
+{
+ compLogMessage ("example", CompLogLevelInfo, "ExampleScreen constructor called!");
+ ScreenInterface::setHandler (screen); // Sets the screen function hook handler
+ CompositeScreenInterface::setHandler (cScreen); // Ditto for cScreen
+ GLScreenInterface::setHandler (gScreen); // Ditto for gScreen
+
+ optionSetExampleInitiate (exampleInitiate); // Initiate handler for 'example' action
+ optionSetSpecialInitiate (specialInitiate); // Initiate handler for 'special' action
+ optionSetSpecialTerminate (specialTerminate); // Terminate handler for 'custorm' action
+ optionSetCustomInitiate (boost::bind (customInitiate, _1, _2, _3, 42)); // Initiate handler for 'special' action. Note how boost::bind is used to create a new function with more args? Neat eh?
+}
+
+/* This is the destructor. It is called when the class is destroyed. If you allocated any
+ * memory or need to do some cleanup, here is where you do it. Note the tilde (~)?
+ */
+
+ExampleScreen::~ExampleScreen ()
+{
+ compLogMessage ("example", CompLogLevelInfo, "ExampleScreen destructor called!\n");
+}
+
+ExampleWindow::ExampleWindow (CompWindow *window) :
+ PluginClassHandler <ExampleWindow, CompWindow> (window), // Initiate our PrivateHandler class template
+ window (window),
+ cWindow (CompositeWindow::get (window)),
+ gWindow (GLWindow::get (window))
+{
+ compLogMessage ("example", CompLogLevelInfo, "ExampleWindow constructor called!");
+ WindowInterface::setHandler (window); // Sets the window function hook handler
+ CompositeWindowInterface::setHandler (cWindow); // Ditto for cWindow
+ GLWindowInterface::setHandler (gWindow); // Ditto for gWindow
+}
+
+ExampleWindow::~ExampleWindow ()
+{
+ compLogMessage ("example", CompLogLevelInfo, "ExampleWindow destructor called!\n");
+}
+
+/* This is the very first function compiz calls. It kicks off plugin initialization */
+
+bool
+ExamplePluginVTable::init ()
+{
+ /* Calls to checkPluginABI check the ABI of a particular plugin to see if it is loaded
+ * and in sync with your current build. If it fails the plugin will not load otherwise
+ * compiz will crash.
+ */
+
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
+ return false;
+ if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI))
+ return false;
+ if (!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ return false;
+
+ return true;
+}
diff --git a/src/example.h b/src/example.h
new file mode 100644
index 0000000..cc5f77e
--- /dev/null
+++ b/src/example.h
@@ -0,0 +1,266 @@
+/* Compiz example plugin
+ * example.h
+ *
+ * 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.
+ *
+ * Your own copyright notice would go above. You are free to choose whatever
+ * licence you want, just take note that some compiz code is GPL and you will
+ * not be able to re-use it if you want to use a different licence.
+ */
+
+/* The include path is set to /PREFIX/include/compiz in the Makefile, so you
+ * don't need to worry about not being able to find compiz headers */
+
+#include <core/core.h>
+
+/* You need to include this in order to get access to the CompPrivate templates */
+
+#include <core/pluginclasshandler.h>
+
+/* Compositing is no longer built in by-default, so you need to include the interface
+ * of the composite plugin.
+ */
+
+#include <composite/composite.h>
+
+/* OpenGL support is now no longer built in by-default as well. You have to use the
+ * interface of the opengl plugin if you want to do anything with that. */
+
+#include <opengl/opengl.h>
+
+/* This is the options class header created for us automatically on build with BCOP */
+
+#include "example_options.h"
+
+/* This is your base screen class. This class definition can be considered the top most
+ * as there is no multi-screen or multi-display support in compiz++, only one compiz
+ * instance per screen.
+ */
+
+class ExampleScreen :
+ /* You should inherit the ScreenInterface class if you want to dynamically hook
+ * screen-level core functions. */
+ public ScreenInterface,
+ /* Same goes for screen functions in the composite plugin */
+ public CompositeScreenInterface,
+ /* And opengl plugin */
+ public GLScreenInterface,
+ /* This sets up a privates handler, where you can access an instance of your class for
+ * every CompScreen object (same goes for ExampleWindow and CompWindow). It adds the
+ * member function ::get, which will allow you get an instance of this class from a
+ * CompScreen * object. Oh, and the memory management is done for you now ^_^
+ */
+ public PluginClassHandler <ExampleScreen, CompScreen>,
+ /* And finally, because we are using BCOP to generate our options, it creates a class
+ * with a bunch of getters and setters that are added to out class when we inherit it. Yay.
+ */
+ public ExampleOptions
+{
+
+ public:
+
+ /* Lets get into buisness. This is the constructor, it replaces the initScreen, initEtc
+ * things that used to be in compiz and is called automatically when an instance of this
+ * class is created. Notice how it is the same name as the class name. It has to be that way.
+ */
+
+ ExampleScreen (CompScreen *s);
+
+ /* This is the destructor. It is called when the class is destroyed. If you allocated any
+ * memory or need to do some cleanup, here is where you do it. Note the tilde (~)?
+ */
+
+ ~ExampleScreen ();
+
+ /* We store CompositeScreen, GLScreen, and CompScreen to avoid unecessary calls to ::get */
+ CompScreen *screen;
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+
+ /* And some member variables */
+ int foo;
+
+ /* Now. Because we imported ScreenInterface and CompositeScreenInterface, we get all the
+ * core functions in there for free. Here's the twist. Those functions are stored as 'virtual',
+ * so they can be overridden. That is what we do here. So instead of a core function being called,
+ * our own is
+ */
+
+ /* This is the function that is called before the screen is 're-painted'. It is used for animation
+ * and such because it gives you a time difference between when the last time the screen was repainted
+ * and the current time of the execution of the functions in milliseconds). It's part of the composite
+ * plugin's interface
+ */
+
+ void
+ preparePaint (int);
+
+ /* This is the guts of the paint function. You can transform the way the entire output is painted
+ * or you can just draw things on screen with openGL. The unsigned int here is a mask for painting
+ * the screen, see opengl/opengl.h on how you can change it */
+
+ bool
+ glPaintOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &, const CompRegion &,
+ CompOutput *, unsigned int);
+
+ /* This is called when the output is transformed by a matrix. Basically the same, but core has
+ * done a few things for us like clip planes etc */
+
+ void
+ glPaintTransformedOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &, const CompRegion &,
+ CompOutput *, unsigned int);
+
+
+ /* This is called after screen painting is finished. It gives you a chance to do any cleanup and or
+ * call another repaint with screen->damageScreen (). It's also part of the composite plugin's
+ * interface.
+ */
+
+ void
+ donePaint ();
+
+ /* This is our event handler. It directly hooks into the screen's X Event handler and allows us to handle
+ * our raw X Events
+ */
+
+ void
+ handleEvent (XEvent *);
+
+ /* Actions, these are called on keypresses, buttonpress, edges etc by compiz */
+
+ static bool
+ exampleInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options);
+
+ /* Initiate / Terminate action pair */
+
+ static bool
+ specialInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options);
+
+ static bool
+ specialTerminate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector &options);
+
+ /* Actions with additional args through boost::bind */
+
+ static bool
+ customInitiate (CompAction *action,
+ CompAction::State state,
+ CompOption::Vector options,
+ int theMeaningOfLife);
+};
+
+class ExampleWindow :
+ /* Same for Example Screen, inherit interfaces, private handlers, options */
+ public WindowInterface,
+ public CompositeWindowInterface,
+ public GLWindowInterface,
+ public PluginClassHandler <ExampleWindow, CompWindow>
+{
+
+ public:
+
+ /* Constructors, destructors etc */
+
+ ExampleWindow (CompWindow *);
+ ~ExampleWindow ();
+
+ /* We store CompositeWindow, GLWindow, and CompWindow to avoid unecessary calls to ::get */
+ CompWindow *window;
+ CompositeWindow *cWindow;
+ GLWindow *gWindow;
+
+ /* This gets called whenever the window needs to be repainted. WindowPaintAttrib gives you some
+ * attributes like brightness/saturation etc to play around with. GLMatrix is the window's
+ * transformation matrix. the unsigned int is the mask, have a look at opengl.h on what you can do
+ * with it */
+
+ bool
+ glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
+ const CompRegion &, unsigned int);
+
+ /* This get's called whenever a window's rect is damaged. You can do stuff here or you can adjust the damage
+ * rectangle so that the window will update properly. Part of the CompositeWindowInterface.
+ */
+
+ bool
+ damageRect (bool, const CompRect &);
+
+ /* This is called whenever the window is focussed */
+ bool
+ focus ();
+
+ /* This is called whenever the window is activated */
+ void
+ activate ();
+
+ /* This is called whenever the window must be placed. You can alter the placement position by altering
+ * the CompPoint & */
+ bool
+ place (CompPoint &);
+
+ /* This is called whenever the window is moved. It tells you how far it's been moved and whether that
+ * move should be immediate or animated. (Immediate is usually for a sudden move, false for that
+ * usually means the user moved the window */
+ void
+ moveNotify (int, int, bool);
+
+ /* This is called whenever the window is resized. It tells you how much the window has been resized */
+ void
+ resizeNotify (int, int, int, int);
+
+ /* This is called when another plugin deems a window to be 'grabbed'. You can't actually 'grab' a
+ * window in X, but it is useful in case you need to know when a user has grabbed a window for some reason */
+ void
+ grabNotify (int, int, unsigned int, unsigned int);
+
+ /* This is called when a window in released from a grab. See above */
+ void
+ ungrabNotify ();
+
+ /* This is called when another misc notification arises, such as Map/Unmap etc */
+ void
+ windowNotify (CompWindowNotify);
+
+};
+
+/* Most plugins set up macros to access their Screen and Window classes based on a CompScreen * or CompWindow * */
+
+#define EX_SCREEN (screen) \
+ExampleScreen *es = ExampleScreen::get (screen);
+
+#define EX_WINDOW (window) \
+ExampleWindow *ew = ExampleWindow::get (window);
+
+/* Your vTable class is some basic info about the plugin that core uses.
+ */
+
+class ExamplePluginVTable :
+ /* Inheriting CompPlugin::VTableForScreenAndWindow <ScreenClass, WindowClass>
+ * automatically does most of the vTable setup for you */
+ public CompPlugin::VTableForScreenAndWindow<ExampleScreen, ExampleWindow>
+{
+ public:
+
+ /* You MUST have this function. Compiz calls this function first off and that
+ * is what kick-starts your initialization procedure. It must be named
+ * _exactly_ init too */
+
+ bool init ();
+};