summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Gurgel Pinho <eduardo@mad4.Chagas>2009-11-16 22:58:55 -0300
committerEduardo Gurgel Pinho <eduardo@mad4.Chagas>2009-11-16 22:58:55 -0300
commitec23ce88bdfb5b5fbe05cda5e97b5359be7c142c (patch)
tree79acd4f140918aa3f4c8421f93a2a896adea8892
parent0e0a035ab7cf604275eb544cf1bf03991d8b9b37 (diff)
downloadgears-ec23ce88bdfb5b5fbe05cda5e97b5359be7c142c.tar.gz
gears-ec23ce88bdfb5b5fbe05cda5e97b5359be7c142c.tar.bz2
Initial C++ port.
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--gears.xml.in4
-rw-r--r--plugin.info3
-rw-r--r--src/gears.cpp (renamed from gears.c)359
-rw-r--r--src/gears.h98
6 files changed, 196 insertions, 807 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0578f8..2808e1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
-compiz_fusion_plugin (gears PLUGINDEPS cube)
+include (CompizPlugin)
+
+compiz_plugin (gears PLUGINDEPS composite opengl cube)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d9a07cf..0000000
--- a/Makefile
+++ /dev/null
@@ -1,533 +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 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -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_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-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 )
-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 %.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 %.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
-
-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: %.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 $@ $<
- @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) --quiet --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)
- @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/gears.xml.in b/gears.xml.in
index a29d5e9..d3bdfcd 100644
--- a/gears.xml.in
+++ b/gears.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<compiz>
- <plugin name="gears">
+ <plugin name="gears" useBcop="true">
<_short>Cube Gears</_short>
<_long>Render gears inside of the transparent cube</_long>
<category>Effects</category>
@@ -10,6 +10,8 @@
</relation>
<requirement>
<plugin>cube</plugin>
+ <plugin>opengl</plugin>
+ <plugin>composite</plugin>
</requirement>
</deps>
</plugin>
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 94591cf..0000000
--- a/plugin.info
+++ /dev/null
@@ -1,3 +0,0 @@
-PLUGIN = gears
-PKG_DEP = compiz-cube
-CHK_HEADERS = compiz-cube.h
diff --git a/gears.c b/src/gears.cpp
index 2b27058..305a970 100644
--- a/gears.c
+++ b/src/gears.cpp
@@ -1,7 +1,7 @@
/*
* Compiz cube gears plugin
*
- * gears.c
+ * gears.cpp
*
* This is an example plugin to show how to render something inside
* of the transparent cube
@@ -24,54 +24,10 @@
* http://cvsweb.xfree86.org/cvsweb/xc/programs/glxgears/glxgears.c
*/
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <math.h>
+#include "gears.h"
-#include <compiz-core.h>
-#include <compiz-cube.h>
-
-static int displayPrivateIndex;
-
-static int cubeDisplayPrivateIndex;
-
-typedef struct _GearsDisplay
-{
- int screenPrivateIndex;
-
-}
-GearsDisplay;
-
-typedef struct _GearsScreen
-{
- DonePaintScreenProc donePaintScreen;
- PreparePaintScreenProc preparePaintScreen;
-
- CubeClearTargetOutputProc clearTargetOutput;
- CubePaintInsideProc paintInside;
-
- Bool damage;
-
- float contentRotation;
- GLuint gear1, gear2, gear3;
- float angle;
- float a1, a2, a3;
-}
-GearsScreen;
-
-#define GET_GEARS_DISPLAY(d) \
- ((GearsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-#define GEARS_DISPLAY(d) \
- GearsDisplay *gd = GET_GEARS_DISPLAY(d);
-
-#define GET_GEARS_SCREEN(s, gd) \
- ((GearsScreen *) (s)->base.privates[(gd)->screenPrivateIndex].ptr)
-#define GEARS_SCREEN(s) \
- GearsScreen *gs = GET_GEARS_SCREEN(s, GET_GEARS_DISPLAY(s->display))
+COMPIZ_PLUGIN_20090315 (gears, GearsPluginVTable);
static void
gear (GLfloat inner_radius,
@@ -233,48 +189,42 @@ gear (GLfloat inner_radius,
glEnd();
}
-static void
-gearsClearTargetOutput (CompScreen *s,
- float xRotate,
- float vRotate)
+void
+GearsScreen::cubeClearTargetOutput (float xRotate,
+ float vRotate)
{
- GEARS_SCREEN (s);
- CUBE_SCREEN (s);
-
- UNWRAP (gs, cs, clearTargetOutput);
- (*cs->clearTargetOutput) (s, xRotate, vRotate);
- WRAP (gs, cs, clearTargetOutput, gearsClearTargetOutput);
+ csScreen->cubeClearTargetOutput (xRotate, vRotate);
glClear (GL_DEPTH_BUFFER_BIT);
}
-static void
-gearsPaintInside (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- CompOutput *output,
- int size)
+
+void GearsScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib,
+ const GLMatrix &transform,
+ CompOutput *output,
+ int size)
{
- GEARS_SCREEN (s);
- CUBE_SCREEN (s);
+// CUBE_SCREEN (screen);
static GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
- ScreenPaintAttrib sA = *sAttrib;
+ GLScreenPaintAttrib sA = sAttrib;
- sA.yRotate += cs->invert * (360.0f / size) *
- (cs->xRotations - (s->x * cs->nOutput));
+ sA.yRotate += csScreen->invert () * (360.0f / size) *
+ (csScreen->xRotations () - (screen->vp ().x () * csScreen->nOutput ()));
- CompTransform mT = *transform;
+ //CompTransform mT = *transform;
+ GLMatrix mT = transform;
- (*s->applyScreenTransform) (s, &sA, output, &mT);
+ gScreen->glApplyTransform (sA, output, &mT);
+// (*s->applyScreenTransform) (s, &sA, output, &mT);
glPushMatrix();
- glLoadMatrixf (mT.m);
- glTranslatef (cs->outputXOffset, -cs->outputYOffset, 0.0f);
- glScalef (cs->outputXScale, cs->outputYScale, 1.0f);
+ glLoadMatrixf (mT.getMatrix ());
+ glTranslatef (csScreen->outputXOffset (), -csScreen->outputYOffset (), 0.0f);
+ glScalef (csScreen->outputXScale (), csScreen->outputYScale (), 1.0f);
- Bool enabledCull = FALSE;
+ bool enabledCull = false;
glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
@@ -282,13 +232,13 @@ gearsPaintInside (CompScreen *s,
if (!glIsEnabled (GL_CULL_FACE) )
{
- enabledCull = TRUE;
+ enabledCull = true;
glEnable (GL_CULL_FACE);
}
glPushMatrix();
- glRotatef (gs->contentRotation, 0.0, 1.0, 0.0);
+ glRotatef (contentRotation, 0.0, 1.0, 0.0);
glScalef (0.05, 0.05, 0.05);
glColor4usv (defaultColor);
@@ -303,20 +253,20 @@ gearsPaintInside (CompScreen *s,
glPushMatrix();
glTranslatef (-3.0, -2.0, 0.0);
- glRotatef (gs->angle, 0.0, 0.0, 1.0);
- glCallList (gs->gear1);
+ glRotatef (angle, 0.0, 0.0, 1.0);
+ glCallList (gear1);
glPopMatrix();
glPushMatrix();
glTranslatef (3.1, -2.0, 0.0);
- glRotatef (-2.0 * gs->angle - 9.0, 0.0, 0.0, 1.0);
- glCallList (gs->gear2);
+ glRotatef (-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
+ glCallList (gear2);
glPopMatrix();
glPushMatrix();
glTranslatef (-3.1, 4.2, 0.0);
- glRotatef (-2.0 * gs->angle - 25.0, 0.0, 0.0, 1.0);
- glCallList (gs->gear3);
+ glRotatef (-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
+ glCallList (gear3);
glPopMatrix();
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white);
@@ -327,7 +277,7 @@ gearsPaintInside (CompScreen *s,
glDisable (GL_NORMALIZE);
glEnable (GL_COLOR_MATERIAL);
- if (!s->lighting)
+ if (!gScreen->lighting ())
glDisable (GL_LIGHTING);
glDisable (GL_DEPTH_TEST);
@@ -338,98 +288,57 @@ gearsPaintInside (CompScreen *s,
glPopMatrix();
glPopAttrib();
- gs->damage = TRUE;
+ damage = true;
- UNWRAP (gs, cs, paintInside);
- (*cs->paintInside) (s, sAttrib, transform, output, size);
- WRAP (gs, cs, paintInside, gearsPaintInside);
+ csScreen->cubePaintInside (sAttrib, transform, output, size);
}
-
-static void
-gearsPreparePaintScreen (CompScreen *s,
- int ms)
+void
+GearsScreen::preparePaint (int ms)
{
- GEARS_SCREEN (s);
-
- gs->contentRotation += ms * 360.0 / 20000.0;
- gs->contentRotation = fmod (gs->contentRotation, 360.0);
- gs->angle += ms * 360.0 / 8000.0;
- gs->angle = fmod (gs->angle, 360.0);
- gs->a1 += ms * 360.0 / 3000.0;
- gs->a1 = fmod (gs->a1, 360.0);
- gs->a2 += ms * 360.0 / 2000.0;
- gs->a2 = fmod (gs->a2, 360.0);
- gs->a3 += ms * 360.0 / 1000.0;
- gs->a3 = fmod (gs->a3, 360.0);
-
- UNWRAP (gs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, ms);
- WRAP (gs, s, preparePaintScreen, gearsPreparePaintScreen);
-}
-
-static void
-gearsDonePaintScreen (CompScreen * s)
-{
- GEARS_SCREEN (s);
-
- if (gs->damage)
- {
- damageScreen (s);
- gs->damage = FALSE;
- }
- UNWRAP (gs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (gs, s, donePaintScreen, gearsDonePaintScreen);
+ contentRotation += ms * 360.0 / 20000.0;
+ contentRotation = fmod (contentRotation, 360.0);
+ angle += ms * 360.0 / 8000.0;
+ angle = fmod (angle, 360.0);
+ a1 += ms * 360.0 / 3000.0;
+ a1 = fmod (a1, 360.0);
+ a2 += ms * 360.0 / 2000.0;
+ a2 = fmod (a2, 360.0);
+ a3 += ms * 360.0 / 1000.0;
+ a3 = fmod (a3, 360.0);
+
+ cScreen->preparePaint (ms);
}
-
-static Bool
-gearsInitDisplay (CompPlugin *p,
- CompDisplay *d)
+void
+GearsScreen::donePaint ()
{
- GearsDisplay *gd;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION) ||
- !checkPluginABI ("cube", CUBE_ABIVERSION))
- return FALSE;
-
- if (!getPluginDisplayIndex (d, "cube", &cubeDisplayPrivateIndex))
- return FALSE;
-
- gd = malloc (sizeof (GearsDisplay));
-
- if (!gd)
- return FALSE;
-
- gd->screenPrivateIndex = allocateScreenPrivateIndex (d);
-
- if (gd->screenPrivateIndex < 0)
+ if (damage)
{
- free (gd);
- return FALSE;
+ cScreen->damageScreen ();
+ damage = false;
}
- d->base.privates[displayPrivateIndex].ptr = gd;
-
- return TRUE;
+ cScreen->donePaint ();
}
-static void
-gearsFiniDisplay (CompPlugin *p,
- CompDisplay *d)
+GearsScreen::GearsScreen (CompScreen *screen) :
+ PluginClassHandler <GearsScreen, CompScreen> (screen),
+ screen (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ csScreen (CubeScreen::get (screen)),
+ damage(false),
+ contentRotation(0.0),
+ angle(0.0),
+ a1(0.0),
+ a2(0.0),
+ a3(0.0)
{
- GEARS_DISPLAY (d);
-
- freeScreenPrivateIndex (d, gd->screenPrivateIndex);
- free (gd);
-}
-
-static Bool
-gearsInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- GearsScreen *gs;
+ ScreenInterface::setHandler (screen);
+ CompositeScreenInterface::setHandler (cScreen);
+ GLScreenInterface::setHandler (gScreen);
+ CubeScreenInterface::setHandler (csScreen);
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
@@ -438,133 +347,47 @@ gearsInitScreen (CompPlugin *p,
static GLfloat ambientLight[] = { 0.3f, 0.3f, 0.3f, 0.3f };
static GLfloat diffuseLight[] = { 0.5f, 0.5f, 0.5f, 0.5f };
- GEARS_DISPLAY (s->display);
-
- CUBE_SCREEN (s);
-
- gs = malloc (sizeof (GearsScreen) );
-
- if (!gs)
- return FALSE;
-
- s->base.privates[gd->screenPrivateIndex].ptr = gs;
-
glLightfv (GL_LIGHT1, GL_AMBIENT, ambientLight);
glLightfv (GL_LIGHT1, GL_DIFFUSE, diffuseLight);
glLightfv (GL_LIGHT1, GL_POSITION, pos);
- gs->damage = FALSE;
-
- gs->contentRotation = 0.0;
-
- gs->gear1 = glGenLists (1);
- glNewList (gs->gear1, GL_COMPILE);
+ gear1 = glGenLists (1);
+ glNewList (gear1, GL_COMPILE);
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear (1.0, 4.0, 1.0, 20, 0.7);
glEndList();
- gs->gear2 = glGenLists (1);
- glNewList (gs->gear2, GL_COMPILE);
+ gear2 = glGenLists (1);
+ glNewList (gear2, GL_COMPILE);
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear (0.5, 2.0, 2.0, 10, 0.7);
glEndList();
- gs->gear3 = glGenLists (1);
- glNewList (gs->gear3, GL_COMPILE);
+ gear3 = glGenLists (1);
+ glNewList (gear3, GL_COMPILE);
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear (1.3, 2.0, 0.5, 10, 0.7);
glEndList();
- gs->angle = 0.0;
- gs->a1 = 0.0;
- gs->a2 = 0.0;
- gs->a3 = 0.0;
-
- WRAP (gs, s, donePaintScreen, gearsDonePaintScreen);
- WRAP (gs, s, preparePaintScreen, gearsPreparePaintScreen);
- WRAP (gs, cs, clearTargetOutput, gearsClearTargetOutput);
- WRAP (gs, cs, paintInside, gearsPaintInside);
-
- return TRUE;
}
-static void
-gearsFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- GEARS_SCREEN (s);
- CUBE_SCREEN (s);
-
- glDeleteLists (gs->gear1, 1);
- glDeleteLists (gs->gear2, 1);
- glDeleteLists (gs->gear3, 1);
-
- UNWRAP (gs, s, donePaintScreen);
- UNWRAP (gs, s, preparePaintScreen);
-
- UNWRAP (gs, cs, clearTargetOutput);
- UNWRAP (gs, cs, paintInside);
-
- free (gs);
-}
-
-static Bool
-gearsInit (CompPlugin * p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex();
-
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-gearsFini (CompPlugin * p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-static CompBool
-gearsInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) gearsInitDisplay,
- (InitPluginObjectProc) gearsInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-gearsFiniObject (CompPlugin *p,
- CompObject *o)
+GearsScreen::~GearsScreen ()
{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) gearsFiniDisplay,
- (FiniPluginObjectProc) gearsFiniScreen
- };
+ glDeleteLists (gear1, 1);
+ glDeleteLists (gear2, 1);
+ glDeleteLists (gear3, 1);
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
}
-CompPluginVTable gearsVTable = {
- "gears",
- 0,
- gearsInit,
- gearsFini,
- gearsInitObject,
- gearsFiniObject,
- 0,
- 0
-};
-
-CompPluginVTable *
-getCompPluginInfo20070830 (void)
+bool
+GearsPluginVTable::init ()
{
- return &gearsVTable;
+ 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/gears.h b/src/gears.h
new file mode 100644
index 0000000..409a0e6
--- /dev/null
+++ b/src/gears.h
@@ -0,0 +1,98 @@
+/*
+ * Compiz cube gears plugin
+ *
+ * gears.h
+ *
+ * This is an example plugin to show how to render something inside
+ * of the transparent cube
+ *
+ * Copyright : (C) 2007 by Dennis Kasprzyk
+ * E-mail : onestone@opencompositing.org
+ *
+ *
+ * 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.
+ *
+ * Based on glxgears.c:
+ * http://cvsweb.xfree86.org/cvsweb/xc/programs/glxgears/glxgears.c
+ */
+
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <signal.h>
+#include <unistd.h>
+#include <cmath>
+
+#include <core/core.h>
+#include <core/pluginclasshandler.h>
+#include <composite/composite.h>
+#include <opengl/opengl.h>
+#include <cube/cube.h>
+#include "gears_options.h"
+
+class GearsScreen :
+ public ScreenInterface,
+ public CompositeScreenInterface,
+ public GLScreenInterface,
+ public CubeScreenInterface,
+ public PluginClassHandler <GearsScreen, CompScreen>,
+ public GearsOptions
+{
+ public:
+
+ GearsScreen (CompScreen *s);
+
+ ~GearsScreen ();
+
+ CompScreen *screen;
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+ CubeScreen *csScreen;
+
+ void
+ cubeClearTargetOutput (float xRotate,
+ float vRotate);
+ void
+ cubePaintInside (const GLScreenPaintAttrib &sAttrib,
+ const GLMatrix &transform,
+ CompOutput *output,
+ int size);
+
+ void
+ preparePaint (int);
+
+ void
+ donePaint ();
+
+ private:
+
+ bool damage;
+
+ float contentRotation;
+ GLuint gear1, gear2, gear3;
+ float angle;
+ float a1, a2, a3;
+};
+
+
+#define GET_GEARS_SCREEN (screen) \
+GearsScreen *es = GearsScreen::get (screen);
+
+
+class GearsPluginVTable :
+ public CompPlugin::VTableForScreen<GearsScreen>
+{
+ public:
+
+ bool init ();
+};
+
+