summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2010-07-08 00:37:08 -0600
committerScott Moreau <oreaus@gmail.com>2010-07-08 00:37:08 -0600
commita40d0d5b6589d3ea1d4cd2275e68854ac82aee57 (patch)
tree7bc96463a50a7643bef647edbbb477186446cd34
parentb808453e2c9ec69c9fedf91414309a81077e2ca0 (diff)
downloadphotowheel-a40d0d5b6589d3ea1d4cd2275e68854ac82aee57.tar.gz
photowheel-a40d0d5b6589d3ea1d4cd2275e68854ac82aee57.tar.bz2
Initial C++ commit.
-rw-r--r--CMakeLists.txt5
-rw-r--r--Makefile463
-rw-r--r--photo.c602
-rw-r--r--photo.xml.in102
-rw-r--r--photowheel.xml.in106
-rw-r--r--plugin.info2
-rw-r--r--src/photowheel.cpp360
-rw-r--r--src/photowheel.h123
8 files changed, 594 insertions, 1169 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..6cec4f9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,5 @@
+find_package (Compiz REQUIRED)
+
+include (CompizPlugin)
+
+compiz_plugin(photowheel PLUGINDEPS composite opengl cube)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 0c846fe..0000000
--- a/Makefile
+++ /dev/null
@@ -1,463 +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
-#
-
-#load config file
-include plugin.info
-
-
-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
-
-ECHO = `which echo`
-
-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 )
-
-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 $(PLUGIN).h ]; then $(ECHO) "$(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 += $(shell pkg-config --variable=includedir compiz)/compiz/compiz.h
-
-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)
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-#
-# 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); \
- cp $(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; \
- cp $(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; \
- cp $(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; \
- gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
- 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; \
- cp 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; \
- cp 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 "$(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/photo.c b/photo.c
deleted file mode 100644
index 912b4ba..0000000
--- a/photo.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/******************************
-Copyright stuff goes here =)
-...
-Based on Gears (see below)
-Joel Bosveld (Joel.Bosveld@gmail.com)
-******************************/
-
-/*
- * Compiz cube gears plugin
- *
- * gears.c
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <math.h>
-
-#include <compiz-core.h>
-#include <compiz-cube.h>
-
-#include "photo_options.h"
-
-#define PI 3.14159
-
-static int displayPrivateIndex;
-
-static int cubeDisplayPrivateIndex;
-
-typedef struct _PhotoTexture
-{
- CompTexture tex;
-
- unsigned height;
- unsigned width;
-
- GLuint dList;
-}
-PhotoTexture;
-
-typedef struct _PhotoDisplay
-{
- int screenPrivateIndex;
-
-}
-PhotoDisplay;
-
-typedef struct _PhotoScreen
-{
- DonePaintScreenProc donePaintScreen;
- PreparePaintScreenProc preparePaintScreen;
-
- CubeClearTargetOutputProc clearTargetOutput;
- CubePaintInsideProc paintInside;
-
- Bool damage;
-
- Bool firsttime;
-
- Bool transformOrder;
-
- Bool enablecull;
-
- PhotoTexture *photoTexture;
- int n; /* how many sides on prism */
- GLfloat l; /* how big is the prism */
- GLfloat h; /* how high is the prism */
- float rspeed; /* speed of rotation */
-
- float xpos;
- float ypos;
- float zpos;
-
- GLuint dList; /* caps */
-
- CompListValue *photoTexFiles;
-
- float angle;
-
-}
-PhotoScreen;
-
-#define GET_PHOTO_DISPLAY(d) \
- ((PhotoDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-#define PHOTO_DISPLAY(d) \
- PhotoDisplay *gd = GET_PHOTO_DISPLAY(d); /* Macros to get the gd pointer to PhotoDisplay struct */
-
-#define GET_PHOTO_SCREEN(s, gd) \
- ((PhotoScreen *) (s)->base.privates[(gd)->screenPrivateIndex].ptr)
-#define PHOTO_SCREEN(s) \
- PhotoScreen *gs = GET_PHOTO_SCREEN(s, GET_PHOTO_DISPLAY(s->display)) /* Macros to get the gs pointer to PhotoScreen struct */
-
-
-static void
-photoParamChange (CompScreen *s,
- CompOption *opt,
- PhotoScreenOptions num)
- {
- PHOTO_SCREEN (s);
-
- gs->h= photoGetHeight (s);
- gs->l= photoGetWidth (s);
- gs->rspeed = photoGetSpeed (s);
- gs->xpos = photoGetXpos (s);
- gs->ypos = photoGetYpos (s);
- gs->zpos = photoGetZpos (s);
- gs->transformOrder = photoGetOrder (s);
- gs->enablecull = photoGetCull (s);
- }
-
-
-static void
-photoCapChange (CompScreen *s,
- CompOption *opt,
- PhotoScreenOptions num)
-
- {
-
- PHOTO_SCREEN (s);
- int i;
- unsigned short *top;
- unsigned short *bot;
-
- top = photoGetTopColour (s);
- bot = photoGetBottomColour (s);
-
-
- if(!(gs->firsttime))
- {
- glDeleteLists (gs->dList, 1);
- }
-
- gs->dList = glGenLists (1);
- glNewList (gs->dList, GL_COMPILE);
- glBegin(GL_POLYGON);
-
- glColor4us(top[0],top[1],top[2],top[3]);
-
- for(i=gs->n-1;i>-1;i--)
- {
- glVertex3f( cos(i*2*PI/(gs->n)), 1, sin(i*2*PI/(gs->n)) );
- }
-
- glEnd();
-
- glBegin(GL_POLYGON);
-
- glColor4us(bot[0],bot[1],bot[2],bot[3]);
-
- for(i=0;i<(gs->n);i++)
- {
- glVertex3f( cos(i*2*PI/(gs->n)), -1, sin(i*2*PI/(gs->n)) );
- }
-
- glEnd();
- glEndList();
- }
-
-static void
-photoTextureChange (CompScreen *s,
- CompOption *opt,
- PhotoScreenOptions num)
- {
- PHOTO_SCREEN (s);
-
- int i;
- int i2;
-
- if(!(gs->firsttime))
- {
- for(i=0;i<(gs->n);i++)
- {
- finiTexture (s, &gs->photoTexture[i].tex);
- glDeleteLists (gs->photoTexture[i].dList, 1);
- }
-
- glDeleteLists (gs->dList, 1);
- }
-
- CompMatrix *mat;
-
-
- gs->photoTexFiles = photoGetPhotoTextures (s);
- gs->n=gs->photoTexFiles->nValue;
-
- gs->photoTexture=malloc(sizeof (PhotoTexture) * gs-> n);
-
- for(i=0;i<(gs->n);i++)
- {
- initTexture(s, &(gs->photoTexture[i].tex));
- if(!(readImageToTexture (s, &(gs->photoTexture[i]).tex, /*texture pointer*/
- gs->photoTexFiles->value[i].s, /*file*/
- &(gs->photoTexture[i]).width, /*pointer for width*/
- &(gs->photoTexture[i]).height))) /*pointer for height*/
- {
- compLogMessage ("photo", CompLogLevelWarn,
- "Failed to load image: %s",
- gs->photoTexFiles->value[i].s);
-
- finiTexture(s, &(gs->photoTexture[i].tex));
- initTexture(s, &(gs->photoTexture[i].tex));
- }
-
- mat = &gs->photoTexture[i].tex.matrix;
- gs->photoTexture[i].dList = glGenLists (1);
-
- i2=i+1;
- if((i2==gs->n))i2=0;
-
- glNewList (gs->photoTexture[i].dList, GL_COMPILE);
- glBegin(GL_QUADS);
-
- glTexCoord2f (COMP_TEX_COORD_X (mat, (gs->photoTexture[i]).width),
- COMP_TEX_COORD_Y (mat, 0));
- glVertex3f( cos(i*2*PI/(gs->n)), 1.0f, sin(i*2*PI/(gs->n)) ); // Top Left Of The Texture and Quad
-
- glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
- COMP_TEX_COORD_Y (mat, 0));
- glVertex3f( cos(i2*2*PI/(gs->n)), 1.0f, sin(i2*2*PI/(gs->n)) ); // Top Right Of The Texture and Quad
-
- glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
- COMP_TEX_COORD_Y (mat, (gs->photoTexture[i]).height));
- glVertex3f( cos(i2*2*PI/(gs->n)), -1.0f, sin(i2*2*PI/(gs->n)) ); // Bot Right Of The Texture and Quad
-
- glTexCoord2f (COMP_TEX_COORD_X (mat, (gs->photoTexture[i]).width),
- COMP_TEX_COORD_Y (mat, (gs->photoTexture[i]).height));
- glVertex3f( cos(i*2*PI/(gs->n)), -1.0f, sin(i*2*PI/(gs->n)) ); // Bot Left Of The Texture and Quad
-
- glEnd();
- glEndList ();
- }
-
- photoCapChange (s, NULL, 0);
-
- }
-
-static void
-photoClearTargetOutput (CompScreen *s, /* Doesn't do anything except glClear(GL_DEPTH_BUFFER_BIT)? - cube must change it? */
- float xRotate,
- float vRotate)
-{
- PHOTO_SCREEN (s);
- CUBE_SCREEN (s);
-
- UNWRAP (gs, cs, clearTargetOutput);
- (*cs->clearTargetOutput) (s, xRotate, vRotate);
- WRAP (gs, cs, clearTargetOutput, photoClearTargetOutput);
-
- glClear (GL_DEPTH_BUFFER_BIT);
-}
-
-static void /* draws the photo, then calls the cube function */
-photoPaintInside (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- CompOutput *output,
- int size)
-{
- PHOTO_SCREEN (s);
- CUBE_SCREEN (s);
-
- int i;
- Bool enabled;
-
- ScreenPaintAttrib sA = *sAttrib;
-
- sA.yRotate += cs->invert * (360.0f / size) *
- (cs->xRotations - (s->x * cs->nOutput)); /*?*/
-
- CompTransform mT = *transform;
-
- (*s->applyScreenTransform) (s, &sA, output, &mT);
-
- glPushMatrix();
- glLoadMatrixf (mT.m);
- glTranslatef (cs->outputXOffset, -cs->outputYOffset, 0.0f); /* OpenGL stuff to set correct transformation due to cube rotation? */
- glScalef (cs->outputXScale, cs->outputYScale, 1.0f);
-
- glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
-
- glEnable (GL_BLEND);
-
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- enabled = glIsEnabled (GL_CULL_FACE);
-
- if(gs->enablecull)glEnable(GL_CULL_FACE);
- else glDisable(GL_CULL_FACE);
-
-
- glPushMatrix();
-
- glDisable (GL_LIGHTING);
- glDisable (GL_COLOR_MATERIAL);
- glEnable (GL_DEPTH_TEST);
-
-
-/******************************/
-
- glScalef (0.25f, 0.25f, 0.25f);
-
- if(gs->transformOrder)glTranslatef(gs->xpos,gs->ypos,gs->zpos);
-
- glRotatef((gs->angle),0.0f,1.0f,0.0f);
-
- if(!(gs->transformOrder))glTranslatef(gs->xpos,gs->ypos,gs->zpos);
-
- (gs->angle)+=(gs->rspeed);
- if((gs->angle>=360.0f)) (gs->angle)=0.0f;
-
-
- glScalef (gs->l, gs->h, gs->l);
-
- for(i=0; i<(gs->n);i++)
- {
- glEnable (gs->photoTexture[i].tex.target);
-
- enableTexture (s, &(gs->photoTexture[i].tex),
- COMP_TEXTURE_FILTER_GOOD);
- glCallList (gs->photoTexture[i].dList);
-
- disableTexture (s, &(gs->photoTexture[i].tex));
- }
-
- glCallList(gs->dList);
-
-
-
-/****************************************/
-
- glPopMatrix();
-
- glEnable (GL_COLOR_MATERIAL);
-
- if (s->lighting)
- glEnable (GL_LIGHTING);
-
- glDisable (GL_DEPTH_TEST);
- glDisable (GL_BLEND);
-
- if (enabled) glEnable (GL_CULL_FACE);
- else glDisable (GL_CULL_FACE); /* resets settings to original */
-
- glPopMatrix();
- glPopAttrib();
-
- gs->damage = TRUE;
-
- UNWRAP (gs, cs, paintInside);
- (*cs->paintInside) (s, sAttrib, transform, output, size);
- WRAP (gs, cs, paintInside, photoPaintInside);
-}
-
-static void /* Rotates the various photo ... */
-photoPreparePaintScreen (CompScreen *s,
- int ms)
-{
- PHOTO_SCREEN (s);
-
-
-
- UNWRAP (gs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, ms);
- WRAP (gs, s, preparePaintScreen, photoPreparePaintScreen);
-}
-
-static void /* Calls damageScreen ? */
-photoDonePaintScreen (CompScreen * s)
-{
- PHOTO_SCREEN (s);
-
- if (gs->damage)
- {
- damageScreen (s);
- gs->damage = FALSE;
- }
-
- UNWRAP (gs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (gs, s, donePaintScreen, photoDonePaintScreen);
-}
-
-/* Inits display */
-
-static Bool
-photoInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- PhotoDisplay *gd;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION) ||
- !checkPluginABI ("cube", CUBE_ABIVERSION))
- return FALSE;
-
- if (!getPluginDisplayIndex (d, "cube", &cubeDisplayPrivateIndex))
- return FALSE;
-
- gd = malloc (sizeof (PhotoDisplay)); /* creates data struct - remainder is error checking */
-
- if (!gd)
- return FALSE;
-
- gd->screenPrivateIndex = allocateScreenPrivateIndex (d);
-
- if (gd->screenPrivateIndex < 0)
- {
- free (gd);
- return FALSE;
- }
-
- d->base.privates[displayPrivateIndex].ptr = gd; /* allows use of PHOTO_DISPLAY macro */
-
- return TRUE;
-}
-
-static void
-photoFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- PHOTO_DISPLAY (d);
-
- freeScreenPrivateIndex (d, gd->screenPrivateIndex);
- free (gd);
-}
-
-
-/* Function which is run when screen is initialized */
-
-static Bool
-photoInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- PhotoScreen *gs;
-
- PHOTO_DISPLAY (s->display); /* sets gd pointer used below */
-
- CUBE_SCREEN (s);
-
- gs = malloc (sizeof (PhotoScreen) ); /* creates gearScreen struct */
-
- if (!gs)
- return FALSE;
-
- s->base.privates[gd->screenPrivateIndex].ptr = gs; /* For the PHOTO_SCREEN macro to work */
-
- /*** My Code ***/
- gs->firsttime=TRUE;
- gs->rspeed=photoGetSpeed (s);
- gs->xpos=photoGetXpos (s);
- gs->ypos=photoGetYpos (s);
- gs->zpos=photoGetZpos (s);
- gs->transformOrder = photoGetOrder (s);
-
- photoSetPhotoTexturesNotify (s, photoTextureChange);
- photoSetHeightNotify (s, photoParamChange);
- photoSetWidthNotify (s, photoParamChange);
- photoSetSpeedNotify (s, photoParamChange);
- photoSetXposNotify (s, photoParamChange);
- photoSetYposNotify (s, photoParamChange);
- photoSetZposNotify (s, photoParamChange);
- photoSetOrderNotify (s, photoParamChange);
-
- photoSetTopColourNotify (s, photoCapChange);
- photoSetBottomColourNotify (s, photoCapChange);
- photoSetCullNotify (s, photoParamChange);
-
- photoTextureChange (s, NULL, 0);
- photoParamChange (s, NULL, 0);
-
-
- /*** End of my Code ***/
-
- WRAP (gs, s, donePaintScreen, photoDonePaintScreen); /*Functions version of ... is called instead of cores (which then also calls core function) */
- WRAP (gs, s, preparePaintScreen, photoPreparePaintScreen);
- WRAP (gs, cs, clearTargetOutput, photoClearTargetOutput);
- WRAP (gs, cs, paintInside, photoPaintInside);
-
- return TRUE;
-
-}
-
-/* Fuction is run when screen is uninitialized */
-
-static void
-photoFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- PHOTO_SCREEN (s); /*Sets the pointers cs gs */
- CUBE_SCREEN (s);
- int i;
-
- for(i=0;i<(gs->n);i++)
- {
- finiTexture (s, &gs->photoTexture[i].tex);
- glDeleteLists (gs->photoTexture[i].dList, 1);
- }
-
- glDeleteLists (gs->dList, 1);
-
- free(gs->photoTexture);
-
-
-
- UNWRAP (gs, s, donePaintScreen); /* gs is pointer to structure GearScreen, s is pointer to structure screen? - these functions are core functions*/
- UNWRAP (gs, s, preparePaintScreen);
-
- UNWRAP (gs, cs, clearTargetOutput); /* ... cs is pointer to structure CubeScreen? - these two functions are part of the Cube plugin*/
- UNWRAP (gs, cs, paintInside);
-
-
-
- free (gs);
-}
-
-/* Load and Unload plugin */
-
-static Bool
-photoInit (CompPlugin * p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex();
-
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-photoFini (CompPlugin * p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-/* Init Object - lists functions for Core, Display and Screen */
-
-static CompBool
-photoInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) photoInitDisplay,
- (InitPluginObjectProc) photoInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-photoFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) photoFiniDisplay,
- (FiniPluginObjectProc) photoFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-/* VTable */
-
-CompPluginVTable photoVTable = {
- "photo",
- 0, /* (?) */
- photoInit,
- photoFini,
- photoInitObject,
- photoFiniObject,
- 0, /* Get(?) Object Options */
- 0 /* Set(?) Object Options */
-};
-
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &photoVTable;
-}
diff --git a/photo.xml.in b/photo.xml.in
deleted file mode 100644
index c84ec51..0000000
--- a/photo.xml.in
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0"?>
-<compiz>
- <plugin name="photo" useBcop="true">
- <_short>Photowheel</_short>
- <_long>Render photo turn wheel inside of the transparent cube</_long>
- <category>Effects</category>
- <deps>
- <relation type="after">
- <plugin>cube</plugin>
- </relation>
- <requirement>
- <plugin>cube</plugin>
- </requirement>
- </deps>
- <screen>
- <option name="photo_textures" type="list">
- <_short>Photo Textures</_short>
- <_long>Photo textures</_long>
- <hints>file;image;</hints>
- <type>string</type>
- <default>
- </default>
- </option>
- <option name="height" type="float">
- <_short>Height</_short>
- <_long>Height</_long>
- <default>1.0</default>
- <min>0.0</min>
- <max>2.0</max>
- <precision>0.01</precision>
- </option>
- <option name="width" type="float">
- <_short>Width</_short>
- <_long>Width</_long>
- <default>1.0</default>
- <min>0.0</min>
- <max>3.0</max>
- <precision>0.01</precision>
- </option>
- <option name="speed" type="float">
- <_short>Speed</_short>
- <_long>Speed</_long>
- <default>0.5</default>
- <min>0.0</min>
- <max>5.0</max>
- <precision>0.01</precision>
- </option>
- <option name="xpos" type="float">
- <_short>X Offset</_short>
- <_long>X Offset (this is width)</_long>
- <default>0</default>
- <min>-2.0</min>
- <max>2.0</max>
- <precision>0.01</precision>
- </option>
- <option name="ypos" type="float">
- <_short>Y Offset</_short>
- <_long>Y Offset (this is height)</_long>
- <default>0</default>
- <min>-2.0</min>
- <max>2.0</max>
- <precision>0.01</precision>
- </option>
- <option name="zpos" type="float">
- <_short>Z Offset</_short>
- <_long>Z Offset (this is depth)</_long>
- <default>0</default>
- <min>-2.0</min>
- <max>2.0</max>
- <precision>0.01</precision>
- </option>
- <option name="order" type="bool">
- <_short>Rotate Around Axis</_short>
- <_long>Otherwise rotate around its center of cube</_long>
- <default>true</default>
- </option>
- <option name="top_colour" type="color">
- <_short>Top Color</_short>
- <_long>Color of top face of the photo wheel</_long>
- <default>
- <red>0xffff</red>
- <green>0xffff</green>
- <blue>0xffff</blue>
- </default>
- </option>
- <option name="bottom_colour" type="color">
- <_short>Bottom Color</_short>
- <_long>Color of bottom face of the photo wheel</_long>
- <default>
- <red>0xffff</red>
- <green>0xffff</green>
- <blue>0xffff</blue>
- </default>
- </option>
- <option name="cull" type="bool">
- <_short>Backface Culling</_short>
- <_long>Enable backface culling</_long>
- <default>true</default>
- </option>
- </screen>
- </plugin>
-</compiz>
diff --git a/photowheel.xml.in b/photowheel.xml.in
new file mode 100644
index 0000000..abb65d1
--- /dev/null
+++ b/photowheel.xml.in
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<compiz>
+ <plugin name="photowheel" useBcop="true">
+ <_short>Photowheel</_short>
+ <_long>Render photo turn wheel inside of the transparent cube</_long>
+ <category>Effects</category>
+ <deps>
+ <relation type="after">
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
+ <plugin>cube</plugin>
+ </relation>
+ <requirement>
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
+ <plugin>cube</plugin>
+ </requirement>
+ </deps>
+ <options>
+ <option name="photo_textures" type="list">
+ <_short>Photo Textures</_short>
+ <_long>Photo textures</_long>
+ <hints>file;image;</hints>
+ <type>string</type>
+ <default>
+ </default>
+ </option>
+ <option name="height" type="float">
+ <_short>Height</_short>
+ <_long>Height</_long>
+ <default>1.0</default>
+ <min>0.0</min>
+ <max>2.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="width" type="float">
+ <_short>Width</_short>
+ <_long>Width</_long>
+ <default>1.0</default>
+ <min>0.0</min>
+ <max>3.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="speed" type="float">
+ <_short>Speed</_short>
+ <_long>Speed</_long>
+ <default>0.5</default>
+ <min>0.0</min>
+ <max>5.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="xpos" type="float">
+ <_short>X Offset</_short>
+ <_long>X Offset (this is width)</_long>
+ <default>0</default>
+ <min>-2.0</min>
+ <max>2.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="ypos" type="float">
+ <_short>Y Offset</_short>
+ <_long>Y Offset (this is height)</_long>
+ <default>0</default>
+ <min>-2.0</min>
+ <max>2.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="zpos" type="float">
+ <_short>Z Offset</_short>
+ <_long>Z Offset (this is depth)</_long>
+ <default>0</default>
+ <min>-2.0</min>
+ <max>2.0</max>
+ <precision>0.01</precision>
+ </option>
+ <option name="order" type="bool">
+ <_short>Rotate Around Axis</_short>
+ <_long>Otherwise rotate around its center of cube</_long>
+ <default>true</default>
+ </option>
+ <option name="top_color" type="color">
+ <_short>Top Color</_short>
+ <_long>Color of top face of the photo wheel</_long>
+ <default>
+ <red>0xffff</red>
+ <green>0xffff</green>
+ <blue>0xffff</blue>
+ </default>
+ </option>
+ <option name="bottom_color" type="color">
+ <_short>Bottom Color</_short>
+ <_long>Color of bottom face of the photo wheel</_long>
+ <default>
+ <red>0xffff</red>
+ <green>0xffff</green>
+ <blue>0xffff</blue>
+ </default>
+ </option>
+ <option name="cull" type="bool">
+ <_short>Backface Culling</_short>
+ <_long>Enable backface culling</_long>
+ <default>true</default>
+ </option>
+ </options>
+ </plugin>
+</compiz>
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 1060d51..0000000
--- a/plugin.info
+++ /dev/null
@@ -1,2 +0,0 @@
-PLUGIN = photo
-PKG_DEP = compiz-cube
diff --git a/src/photowheel.cpp b/src/photowheel.cpp
new file mode 100644
index 0000000..d70a1c0
--- /dev/null
+++ b/src/photowheel.cpp
@@ -0,0 +1,360 @@
+/****************
+Copyright stuff goes here =)
+...
+Based on Gears (see below)
+Joel Bosveld (Joel.Bosveld@gmail.com)
+*****************************/
+
+/*
+ * Compiz cube gears plugin
+ *
+ * gears.c
+ *
+ * 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 "photowheel.h"
+
+COMPIZ_PLUGIN_20090315 (photowheel, PhotowheelPluginVTable);
+
+void
+PhotowheelScreen::paramChange (CompOption *option,
+ Options num)
+{
+ h = optionGetHeight ();
+ l = optionGetWidth ();
+ rspeed = optionGetSpeed ();
+ xpos = optionGetXpos ();
+ ypos = optionGetYpos ();
+ zpos = optionGetZpos ();
+ transformOrder = optionGetOrder ();
+ enableCull = optionGetCull ();
+}
+
+
+void
+PhotowheelScreen::capChange (CompOption *option,
+ Options num)
+
+{
+ int i;
+ unsigned short *top = optionGetTopColor ();
+ unsigned short *bot = optionGetBottomColor ();
+/*
+ if (!firsttime)
+ {
+ glDeleteLists (dList, 1);
+ }
+*/
+ dList = glGenLists (1);
+ glNewList (dList, GL_COMPILE);
+ glBegin (GL_POLYGON);
+
+ glColor4us (top[0], top[1], top[2], top[3]);
+
+ for( i = n - 1; i > -1; i--)
+ {
+ glVertex3f( cos(i*2*PI/n), 1, sin(i*2*PI/n) );
+ }
+
+ glEnd();
+
+ glBegin (GL_POLYGON);
+
+ glColor4us (bot[0], bot[1], bot[2], bot[3]);
+
+ for (i = 0; i < n; i++)
+ {
+ glVertex3f( cos(i*2*PI/n), -1, sin(i*2*PI/n) );
+ }
+
+ glEnd();
+ glEndList();
+}
+
+void
+PhotowheelScreen::textureChange (CompOption *option,
+ Options num)
+{
+ int i;
+ int i2;
+
+ GLTexture::Matrix mat;
+ CompSize tSize;
+
+ CompOption::Value::Vector imgFiles = optionGetPhotoTextures ();
+
+ n = imgFiles.size ();
+/*
+ if(!firsttime)
+ {
+ for (i = 0; i < n; i++)
+ {
+ photoTexture.at (i).tex.clear ();
+ glDeleteLists (photoTexture.at (i).dList, 1);
+ }
+ }
+*/
+ if (imgFiles.empty () || !imgFiles.size ())
+ {
+ compLogMessage ("photowheel", CompLogLevelWarn,
+ "Could not load image(s)!");
+ return;
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ CompString imgName = imgFiles[i].s ();
+
+ photoTexture.push_back (PhotowheelTexture ());
+
+ photoTexture.at (i).tex = GLTexture::readImageToTexture (imgName, tSize);
+
+ if (photoTexture.at (i).tex.empty ())
+ compLogMessage ("photo", CompLogLevelWarn,
+ "Failed to load image: %s",
+ imgFiles[i].s ().c_str ());
+
+ foreach (GLTexture* texture, photoTexture.at (i).tex)
+ {
+ mat = texture->matrix ();
+ photoTexture.at (i).dList = glGenLists (1);
+
+ i2 = i + 1;
+ if (i2 == n)
+ i2 = 0;
+
+ glNewList (photoTexture.at (i).dList, GL_COMPILE);
+ glBegin(GL_QUADS);
+
+ glTexCoord2f (COMP_TEX_COORD_X (mat, tSize.width ()),
+ COMP_TEX_COORD_Y (mat, 0));
+ /* Top Left Of The Texture and Quad */
+ glVertex3f( cos(i*2*PI/n), 1.0f, sin(i*2*PI/n) );
+
+ glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
+ COMP_TEX_COORD_Y (mat, 0));
+ /* Top Right Of The Texture and Quad */
+ glVertex3f( cos(i2*2*PI/n), 1.0f, sin(i2*2*PI/n) );
+
+ glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
+ COMP_TEX_COORD_Y (mat, tSize.height ()));
+ /* Bottom Right Of The Texture and Quad */
+ glVertex3f( cos(i2*2*PI/n), -1.0f, sin(i2*2*PI/n) );
+
+ glTexCoord2f (COMP_TEX_COORD_X (mat, tSize.width ()),
+ COMP_TEX_COORD_Y (mat, tSize.height ()));
+ /* Bottom Left Of The Texture and Quad */
+ glVertex3f( cos(i*2*PI/n), -1.0f, sin(i*2*PI/n) );
+
+ glEnd();
+ glEndList ();
+ }
+ }
+
+ capChange (NULL, num);
+}
+
+void
+PhotowheelScreen::cubeClearTargetOutput (float xRotate,
+ float vRotate)
+{
+ csScreen->cubeClearTargetOutput (xRotate, vRotate);
+
+ glClear (GL_DEPTH_BUFFER_BIT);
+}
+
+void
+PhotowheelScreen::cubePaintInside (const GLScreenPaintAttrib &sAttrib,
+ const GLMatrix &transform,
+ CompOutput *output,
+ int size)
+{
+ int i;
+ Bool enabled;
+
+ GLScreenPaintAttrib sA = sAttrib;
+
+ sA.yRotate += csScreen->invert () * (360.0f / size) *
+ (csScreen->xRotations () - (screen->vp ().x () *
+ csScreen->nOutput ()));
+
+ GLMatrix mT = transform;
+
+ gScreen->glApplyTransform (sA, output, &mT);
+
+ glPushMatrix();
+ glLoadMatrixf (mT.getMatrix ());
+ glTranslatef (csScreen->outputXOffset (), -csScreen->outputYOffset (), 0.0f);
+ glScalef (csScreen->outputXScale (), csScreen->outputYScale (), 1.0f);
+
+ glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
+
+ glEnable (GL_BLEND);
+
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ enabled = glIsEnabled (GL_CULL_FACE);
+
+ if(enableCull)
+ glEnable(GL_CULL_FACE);
+ else
+ glDisable(GL_CULL_FACE);
+
+ glPushMatrix();
+
+ glDisable (GL_LIGHTING);
+ glDisable (GL_COLOR_MATERIAL);
+ glEnable (GL_DEPTH_TEST);
+
+ glScalef (0.25f, 0.25f, 0.25f);
+
+ if(transformOrder)
+ glTranslatef(xpos, ypos, zpos);
+
+ glRotatef(angle, 0.0f, 1.0f, 0.0f);
+
+ if (!transformOrder)
+ glTranslatef(xpos, ypos, zpos);
+
+ angle += rspeed;
+
+ if (angle >= 360.0f)
+ angle = 0.0f;
+
+ glScalef (l, h, l);
+
+ for (i = 0; i < n; i++)
+ {
+ foreach (GLTexture* texture, photoTexture.at (i).tex)
+ {
+ texture->enable (GLTexture::Good);
+ glCallList (photoTexture.at (i).dList);
+ texture->disable ();
+ }
+ }
+
+ glCallList(dList);
+
+ glPopMatrix();
+
+ glEnable (GL_COLOR_MATERIAL);
+
+ if (gScreen->lighting ())
+ glEnable (GL_LIGHTING);
+
+ glDisable (GL_DEPTH_TEST);
+ glDisable (GL_BLEND);
+
+ /* resets settings to original */
+ if (enabled)
+ glEnable (GL_CULL_FACE);
+ else
+ glDisable (GL_CULL_FACE);
+
+ glPopMatrix();
+ glPopAttrib();
+
+ damage = true;
+
+ csScreen->cubePaintInside (sAttrib, transform, output, size);
+}
+
+void
+PhotowheelScreen::preparePaint (int ms)
+{
+ cScreen->preparePaint (ms);
+}
+
+void
+PhotowheelScreen::donePaint ()
+{
+ if (damage)
+ {
+ cScreen->damageScreen ();
+ damage = false;
+ }
+
+ cScreen->donePaint ();
+}
+
+PhotowheelScreen::PhotowheelScreen (CompScreen *screen) :
+ PluginClassHandler <PhotowheelScreen, CompScreen> (screen),
+ screen (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ csScreen (CubeScreen::get (screen)),
+ damage(false),
+ /* firsttime (true), */
+ angle(0.0)
+{
+ ScreenInterface::setHandler (screen, true);
+ CompositeScreenInterface::setHandler (cScreen, true);
+ GLScreenInterface::setHandler (gScreen, true);
+ CubeScreenInterface::setHandler (csScreen, true);
+
+ rspeed = optionGetSpeed ();
+ xpos = optionGetXpos ();
+ ypos = optionGetYpos ();
+ zpos = optionGetZpos ();
+ transformOrder = optionGetOrder ();
+
+ optionSetPhotoTexturesNotify (boost::bind (&PhotowheelScreen::
+ textureChange, this, _1, _2));
+ optionSetHeightNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetWidthNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetSpeedNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetXposNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetYposNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetZposNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+ optionSetOrderNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+
+ optionSetTopColorNotify (boost::bind (&PhotowheelScreen::
+ capChange, this, _1, _2));
+ optionSetBottomColorNotify (boost::bind (&PhotowheelScreen::
+ capChange, this, _1, _2));
+ optionSetCullNotify (boost::bind (&PhotowheelScreen::
+ paramChange, this, _1, _2));
+}
+
+PhotowheelScreen::~PhotowheelScreen ()
+{
+}
+
+bool
+PhotowheelPluginVTable::init ()
+{
+ 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/photowheel.h b/src/photowheel.h
new file mode 100644
index 0000000..e5649d1
--- /dev/null
+++ b/src/photowheel.h
@@ -0,0 +1,123 @@
+/*
+ * Compiz cube gears plugin
+ *
+ * gears.c
+ *
+ * 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 "photowheel_options.h"
+
+#define PI 3.14159
+
+class PhotowheelTexture
+{
+ public:
+
+ GLTexture::List tex;
+ GLuint dList;
+};
+
+class PhotowheelScreen :
+ public ScreenInterface,
+ public CompositeScreenInterface,
+ public GLScreenInterface,
+ public CubeScreenInterface,
+ public PluginClassHandler <PhotowheelScreen, CompScreen>,
+ public PhotowheelOptions
+{
+ public:
+
+ PhotowheelScreen (CompScreen *s);
+
+ ~PhotowheelScreen ();
+
+ CompScreen *screen;
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+ CubeScreen *csScreen;
+
+ void
+ paramChange (CompOption*, Options);
+
+ void
+ capChange (CompOption*, Options);
+
+ void
+ textureChange (CompOption*, Options);
+
+ void
+ cubeClearTargetOutput (float, float);
+
+ void
+ cubePaintInside (const GLScreenPaintAttrib&,
+ const GLMatrix&,
+ CompOutput*,
+ int);
+
+ void
+ preparePaint (int);
+
+ void
+ donePaint ();
+
+ bool damage, firsttime, transformOrder, enableCull;
+
+ std::vector <PhotowheelTexture> photoTexture;
+
+ int n; /* how many sides on prism */
+ GLfloat l; /* how big is the prism */
+ GLfloat h; /* how high is the prism */
+ float rspeed; /* speed of rotation */
+
+ float xpos;
+ float ypos;
+ float zpos;
+
+ GLuint dList; /* caps */
+
+ float angle;
+};
+
+#define PHOTOWHEEL_SCREEN(s) \
+ PhotowheelScreen *ps = PhotowheelScreen::get (s);
+
+class PhotowheelPluginVTable :
+ public CompPlugin::VTableForScreen
+ <PhotowheelScreen>
+{
+ public:
+
+ bool init ();
+};