summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2010-08-11 03:19:16 -0600
committerScott Moreau <oreaus@gmail.com>2010-08-11 03:19:16 -0600
commit14febd3cb2341fac2563b952bf9e572ca6e162c9 (patch)
tree2ea67d0a68d972455ca117da9fec4f34eb43da73
parentcb78df2807da6b8c84316770f8fbf48c573c7aae (diff)
downloadwizard-compiz-0.8.tar.gz
wizard-compiz-0.8.tar.bz2
Original code.compiz-0.8
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt6
-rwxr-xr-xMakefile533
-rw-r--r--include/wizard.h212
-rwxr-xr-xplugin.info3
-rwxr-xr-xsrc/wizard.cpp997
-rwxr-xr-xwizard.c (renamed from src/wizard.c)604
-rwxr-xr-xwizard.xml.in10
-rwxr-xr-xwizard_tex.h (renamed from include/wizard_tex.h)1
8 files changed, 924 insertions, 1442 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fa0096..5f6502a 100644..100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package (Compiz REQUIRED)
+include (CompizFusion)
-include (CompizPlugin)
-
-compiz_plugin (wizard PLUGINDEPS composite opengl mousepoll)
+compiz_fusion_plugin (wizard PLUGINDEPS mousepoll)
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..d9a07cf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,533 @@
+##
+#
+# 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/include/wizard.h b/include/wizard.h
deleted file mode 100644
index 5b86b5c..0000000
--- a/include/wizard.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Compiz wizard particle system plugin
- *
- * wizard.c
- *
- * Written by : Sebastian Kuhlen
- * E-mail : DiCon@tankwar.de
- *
- * This plugin and parts of its code have been inspired by the showmouse plugin
- * by Dennis Kasprzyk
- *
- * 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.
- *
- */
-
-#include <core/core.h>
-#include <composite/composite.h>
-#include <opengl/opengl.h>
-#include <mousepoll/mousepoll.h>
-
-#include "wizard_options.h"
-#include "wizard_tex.h"
-
-static float
-rRange (float avg, float range)
-{
- return avg + (float)((random () & 0xff)/127.5-1.)*range;
-}
-
-typedef enum
-{
- TRIGGER_PERSISTENT = 0,
- TRIGGER_MOUSEMOVEMENT,
- TRIGGER_RANDOMSHOT,
- TRIGGER_RANDOMPERIOD
-} TriggerType;
-
-typedef enum
-{
- MOVEMENT_MOUSEPOSITION = 0,
- MOVEMENT_FOLLOWMOUSE,
- MOVEMENT_BOUNCE,
- MOVEMENT_WRAP
-} MovementType;
-
-class GPoint
-{
- public:
-
- float strength; // Strength of this gravity source
- float x; // X position
- float y; // Y position
- float espeed; // Speed of the gravity source
- float eangle; // Angle for the movement of this gravity source
- int movement; // Type of movement of this gravity source
-};
-
-class Particle
-{
- public:
-
- float c[3]; // Color
- float a; // alpha value
- float x; // X position
- float y; // Y position
- float t; // t position (age, born at 1, dies at 0)
- float phi; // Orientation of texture
- float vx; // X speed
- float vy; // Y speed
- float vt; // t speed (aging speed)
- float vphi; // Rotation speed
- float s; // size (side of the square)
- float snew; // Size when born (reduced to s while new)
- float g; // Gravity from this particle
-};
-
-class Emitter
-{
- public:
-
- bool set_active; // Set to active in the settings
- bool active; // Currently active (differs from set_active for
- // the random period trigger)
- int trigger; // When to generate particles
- int count; // Amount of particles to be generated
- float h; // color hue (0..1)
- float dh; // color hue range
- float l; // color lightness (0..1)
- float dl; // color lightness range
- float a; // Alpha
- float da; // Alpha range
- float x; // X position
- float y; // Y position
- float espeed; // Speed of the emitter
- float eangle; // Angle for the movement of this emitter
- int movement; // Type of movement of this emitter
- float dx; // X range
- float dy; // Y range
- float dcirc; // Circular range
- float vx; // X speed
- float vy; // Y speed
- float vt; // t speed (aging speed)
- float vphi; // Rotation speed
- float dvx; // X speed range
- float dvy; // Y speed range
- float dvcirc; // Circular speed range
- float dvt; // t speed (aging speed) range
- float dvphi; // Rotation speed range
- float s; // size (side of the square)
- float ds; // size (side of the square) range
- float snew; // Size when born (reduced to s while new)
- float dsnew; // Size when born (reduced to s while new) range
- float g; // Gravity of particles
- float dg; // Gravity range
- float gp; // Part of particles that have gravity
-};
-
-class ParticleSystem
-{
- public:
-
- int hardLimit; // Not to be exceeded
- int softLimit; // If exceeded, old particles age faster
- int lastCount; // Living particle count to evaluate softLimit
- float tnew; // Particle is new if t > tnew
- float told; // Particle is old if t < told
- float gx; // Global gravity x
- float gy; // Global gravity y
- Particle *particles; // The actual particles
- GLuint tex; // Particle Texture
- bool active;
- float darken; // Darken background
- GLuint blendMode;
- Emitter *e; // All emitters in here
- GPoint *g; // All gravity point sources in here
- int ne; // Emitter count
- int ng; // GPoint count
-
- GLfloat *vertices_cache;
- int vertex_cache_count;
- GLfloat *coords_cache;
- int coords_cache_count;
- GLfloat *colors_cache;
- int color_cache_count;
- GLfloat *dcolors_cache;
- int dcolors_cache_count;
-};
-
-class WizardScreen :
- public PluginClassHandler <WizardScreen, CompScreen>,
- public WizardOptions,
- public ScreenInterface,
- public CompositeScreenInterface,
- public GLScreenInterface
-{
- public:
- WizardScreen (CompScreen *screen);
- ~WizardScreen ();
-
- CompositeScreen *cScreen;
- GLScreen *gScreen;
-
- int mx, my; //Mouse Position from polling
-
- bool active;
-
- ParticleSystem *ps;
-
- MousePoller pollHandle;
-
- void loadGPoints (ParticleSystem *ps);
-
- void loadEmitters (ParticleSystem *ps);
-
- void drawParticles (ParticleSystem * ps);
-
- void positionUpdate (const CompPoint &pos);
-
- void preparePaint (int time);
-
- void donePaint ();
-
- bool
- glPaintOutput (const GLScreenPaintAttrib &sa,
- const GLMatrix &transform,
- const CompRegion &region,
- CompOutput *output,
- unsigned int mask);
-
- bool toggle ();
-
- void
- optionChanged (CompOption *opt,
- WizardOptions::Options num);
-};
-
-class WizardPluginVTable :
- public CompPlugin::VTableForScreen <WizardScreen>
-{
- public:
- bool init ();
-};
-
-COMPIZ_PLUGIN_20090315 (wizard, WizardPluginVTable);
diff --git a/plugin.info b/plugin.info
new file mode 100755
index 0000000..7dde764
--- /dev/null
+++ b/plugin.info
@@ -0,0 +1,3 @@
+PLUGIN = wizard
+PKG_DEP = compiz-mousepoll
+CHK_HEADERS = compiz-mousepoll.h
diff --git a/src/wizard.cpp b/src/wizard.cpp
deleted file mode 100755
index 5108855..0000000
--- a/src/wizard.cpp
+++ /dev/null
@@ -1,997 +0,0 @@
-/*
- * Compiz wizard particle system plugin
- *
- * wizard.c
- *
- * Written by : Sebastian Kuhlen
- * E-mail : DiCon@tankwar.de
- *
- * This plugin and parts of its code have been inspired by the showmouse plugin
- * by Dennis Kasprzyk
- *
- * 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.
- *
- */
-
-#include <math.h>
-#include <string.h>
-
-#include "wizard.h"
-
-static void
-initParticles (int hardLimit, int softLimit, ParticleSystem * ps)
-{
- if (ps->particles)
- free (ps->particles);
- ps->particles = (Particle*) calloc (hardLimit, sizeof (Particle));
- ps->tex = 0;
- ps->hardLimit = hardLimit;
- ps->softLimit = softLimit;
- ps->active = false;
- ps->lastCount = 0;
-
- // Initialize cache
- ps->vertices_cache = NULL;
- ps->colors_cache = NULL;
- ps->coords_cache = NULL;
- ps->dcolors_cache = NULL;
- ps->vertex_cache_count = 0;
- ps->color_cache_count = 0;
- ps->coords_cache_count = 0;
- ps->dcolors_cache_count = 0;
-
- Particle *part = ps->particles;
- int i;
- for (i = 0; i < hardLimit; i++, part++)
- part->t = 0.0f;
-}
-
-void
-WizardScreen::loadGPoints (ParticleSystem *ps)
-{
- if (ps->g)
- free (ps->g);
-
- int i;
- GPoint *gi;
- CompOption::Value::Vector cvv = optionGetGStrength ();
- ps->ng = cvv.size ();
- ps->g = (GPoint*) calloc (ps->ng, sizeof (GPoint));
-
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->strength = (float)cvv.at (i).i ()/ 1000.;
-
- cvv = optionGetGPosx ();
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->x = (float)cvv.at (i).i ();
-
- cvv = optionGetGPosy ();
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->y = (float)cvv.at (i).i ();
-
- cvv = optionGetGSpeed ();
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->espeed = (float)cvv.at (i).i () / 100.;
-
- cvv = optionGetGAngle ();
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->eangle = (float)cvv.at (i).i () / 180.*M_PI;
-
- cvv = optionGetGMovement ();
- gi = ps->g;
- for (i = 0; i < ps->ng; i++, gi++)
- gi->movement = cvv.at (i).i ();
-}
-
-void
-WizardScreen::loadEmitters (ParticleSystem *ps)
-{
- if (ps->e)
- free (ps->e);
-
- int i;
- Emitter *ei;
- CompOption::Value::Vector cvv = optionGetEActive ();
- ps->ne = cvv.size ();
- ps->e = (Emitter*) calloc (ps->ne, sizeof (Emitter));
-
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->set_active = ei->active = cvv.at (i).b ();
-
- cvv = optionGetETrigger ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->trigger = cvv.at (i).i ();
-
- cvv = optionGetEPosx ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->x = (float)cvv.at (i).i ();
-
- cvv = optionGetEPosy ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->y = (float)cvv.at (i).i ();
-
- cvv = optionGetESpeed ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->espeed = (float)cvv.at (i).i () / 100.;
-
- cvv = optionGetEAngle ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->eangle = (float)cvv.at (i).i () / 180.*M_PI;
-
- cvv = optionGetEMovement ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->movement = cvv.at (i).i ();
-
- cvv = optionGetECount ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->count = (float)cvv.at (i).i ();
-
- cvv = optionGetEH ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->h = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDh ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dh = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEL ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->l = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDl ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dl = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEA ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->a = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDa ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->da = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDx ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dx = (float)cvv.at (i).i ();
-
- cvv = optionGetEDy ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dy = (float)cvv.at (i).i ();
-
- cvv = optionGetEDcirc ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dcirc = (float)cvv.at (i).i ();
-
- cvv = optionGetEVx ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->vx = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEVy ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->vy = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEVt ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->vt = (float)cvv.at (i).i () / 10000.;
-
- cvv = optionGetEVphi ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->vphi = (float)cvv.at (i).i () / 10000.;
-
- cvv = optionGetEDvx ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dvx = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDvy ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dvy = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDvcirc ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dvcirc = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDvt ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dvt = (float)cvv.at (i).i () / 10000.;
-
- cvv = optionGetEDvphi ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dvphi = (float)cvv.at (i).i () / 10000.;
-
- cvv = optionGetES ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->s = (float)cvv.at (i).i ();
-
- cvv = optionGetEDs ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->ds = (float)cvv.at (i).i ();
-
- cvv = optionGetESnew ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->snew = (float)cvv.at (i).i ();
-
- cvv = optionGetEDsnew ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dsnew = (float)cvv.at (i).i ();
-
- cvv = optionGetEG ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->g = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEDg ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->dg = (float)cvv.at (i).i () / 1000.;
-
- cvv = optionGetEGp ();
- ei = ps->e;
- for (i = 0; i < ps->ne; i++, ei++)
- ei->gp = (float)cvv.at (i).i () / 10000.;
-}
-
-void
-WizardScreen::drawParticles (ParticleSystem * ps)
-{
- glPushMatrix ();
-
- glEnable (GL_BLEND);
- if (ps->tex)
- {
- glBindTexture (GL_TEXTURE_2D, ps->tex);
- glEnable (GL_TEXTURE_2D);
- }
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- /* Check that the cache is big enough */
- if (ps->hardLimit > ps->vertex_cache_count)
- {
- ps->vertices_cache =
- (GLfloat*) realloc (ps->vertices_cache,
- ps->hardLimit * 4 * 3 * sizeof (GLfloat));
- ps->vertex_cache_count = ps->hardLimit;
- }
-
- if (ps->hardLimit > ps->coords_cache_count)
- {
- ps->coords_cache =
- (GLfloat*) realloc (ps->coords_cache,
- ps->hardLimit * 4 * 2 * sizeof (GLfloat));
- ps->coords_cache_count = ps->hardLimit;
- }
-
- if (ps->hardLimit > ps->color_cache_count)
- {
- ps->colors_cache =
- (GLfloat*) realloc (ps->colors_cache,
- ps->hardLimit * 4 * 4 * sizeof (GLfloat));
- ps->color_cache_count = ps->hardLimit;
- }
-
- if (ps->darken > 0)
- {
- if (ps->dcolors_cache_count < ps->hardLimit)
- {
- ps->dcolors_cache =
- (GLfloat*) realloc (ps->dcolors_cache,
- ps->hardLimit * 4 * 4 * sizeof (GLfloat));
- ps->dcolors_cache_count = ps->hardLimit;
- }
- }
-
- GLfloat *dcolors = ps->dcolors_cache;
- GLfloat *vertices = ps->vertices_cache;
- GLfloat *coords = ps->coords_cache;
- GLfloat *colors = ps->colors_cache;
-
- int cornersSize = sizeof (GLfloat) * 8;
- int colorSize = sizeof (GLfloat) * 4;
-
- GLfloat cornerCoords[8] = {0.0, 0.0,
- 0.0, 1.0,
- 1.0, 1.0,
- 1.0, 0.0};
-
- int numActive = 0;
-
- Particle *part = ps->particles;
- int i;
- for (i = 0; i < ps->hardLimit; i++, part++)
- {
- if (part->t > 0.0f)
- {
- numActive += 4;
-
- float cOff = part->s / 2.; //Corner offset from center
-
- if (part->t > ps->tnew) //New particles start larger
- cOff += (part->snew - part->s) * (part->t - ps->tnew)
- / (1. - ps->tnew) / 2.;
- else if (part->t < ps->told) //Old particles shrink
- cOff -= part->s * (ps->told - part->t) / ps->told / 2.;
-
- //Offsets after rotation of Texture
- float offA = cOff * (cos (part->phi) - sin (part->phi));
- float offB = cOff * (cos (part->phi) + sin (part->phi));
-
- vertices[0] = part->x - offB;
- vertices[1] = part->y - offA;
- vertices[2] = 0;
-
- vertices[3] = part->x - offA;
- vertices[4] = part->y + offB;
- vertices[5] = 0;
-
- vertices[6] = part->x + offB;
- vertices[7] = part->y + offA;
- vertices[8] = 0;
-
- vertices[9] = part->x + offA;
- vertices[10] = part->y - offB;
- vertices[11] = 0;
-
- vertices += 12;
-
- memcpy (coords, cornerCoords, cornersSize);
-
- coords += 8;
-
- colors[0] = part->c[0];
- colors[1] = part->c[1];
- colors[2] = part->c[2];
-
- if (part->t > ps->tnew) //New particles start at a == 1
- colors[3] = part->a + (1. - part->a) * (part->t - ps->tnew)
- / (1. - ps->tnew);
- else if (part->t < ps->told) //Old particles fade to a = 0
- colors[3] = part->a * part->t / ps->told;
- else //The others have their own a
- colors[3] = part->a;
-
- memcpy (colors + 4, colors, colorSize);
- memcpy (colors + 8, colors, colorSize);
- memcpy (colors + 12, colors, colorSize);
-
- colors += 16;
-
- if (ps->darken > 0)
- {
- dcolors[0] = colors[0];
- dcolors[1] = colors[1];
- dcolors[2] = colors[2];
- dcolors[3] = colors[3] * ps->darken;
- memcpy (dcolors + 4, dcolors, colorSize);
- memcpy (dcolors + 8, dcolors, colorSize);
- memcpy (dcolors + 12, dcolors, colorSize);
-
- dcolors += 16;
- }
- }
- }
-
- glEnableClientState (GL_COLOR_ARRAY);
-
- glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (GLfloat), ps->coords_cache);
- glVertexPointer (3, GL_FLOAT, 3 * sizeof (GLfloat), ps->vertices_cache);
-
- // darken the background
- if (ps->darken > 0)
- {
- glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
- glColorPointer (4, GL_FLOAT, 4 * sizeof (GLfloat), ps->dcolors_cache);
- glDrawArrays (GL_QUADS, 0, numActive);
- }
- // draw particles
- glBlendFunc (GL_SRC_ALPHA, ps->blendMode);
-
- glColorPointer (4, GL_FLOAT, 4 * sizeof (GLfloat), ps->colors_cache);
-
- glDrawArrays (GL_QUADS, 0, numActive);
-
- glDisableClientState (GL_COLOR_ARRAY);
-
- glPopMatrix ();
- glColor4usv (defaultColor);
- gScreen->setTexEnvMode (GL_REPLACE);
- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glDisable (GL_TEXTURE_2D);
- glDisable (GL_BLEND);
-}
-
-static void
-updateParticles (ParticleSystem * ps, float time)
-{
- int i, j;
- int newCount = 0;
- Particle *part;
- GPoint *gi;
- float gdist, gangle;
- ps->active = false;
-
- part = ps->particles;
- for (i = 0; i < ps->hardLimit; i++, part++)
- {
- if (part->t > 0.0f)
- {
- // move particle
- part->x += part->vx * time;
- part->y += part->vy * time;
-
- // Rotation
- part->phi += part->vphi*time;
-
- //Aging of particles
- part->t += part->vt * time;
- //Additional aging of particles increases if softLimit is exceeded
- if (ps->lastCount > ps->softLimit)
- part->t += part->vt * time * (ps->lastCount - ps->softLimit)
- / (ps->hardLimit - ps->softLimit);
-
- //Global gravity
- part->vx += ps->gx * time;
- part->vy += ps->gy * time;
-
- //GPoint gravity
- gi = ps->g;
- for (j = 0; j < ps->ng; j++, gi++)
- {
- if (gi->strength != 0)
- {
- gdist = sqrt ((part->x-gi->x)*(part->x-gi->x)
- + (part->y-gi->y)*(part->y-gi->y));
- if (gdist > 1)
- {
- gangle = atan2 (gi->y-part->y, gi->x-part->x);
- part->vx += gi->strength / gdist * cos (gangle) * time;
- part->vy += gi->strength / gdist * sin (gangle) * time;
- }
- }
- }
-
- ps->active = true;
- newCount++;
- }
- }
- ps->lastCount = newCount;
-
- //Particle gravity
- Particle *gpart;
- part = ps->particles;
- for (i = 0; i < ps->hardLimit; i++, part++)
- {
- if (part->t > 0.0f && part->g != 0)
- {
- gpart = ps->particles;
- for (j = 0; j < ps->hardLimit; j++, gpart++)
- {
- if (gpart->t > 0.0f)
- {
- gdist = sqrt ((part->x-gpart->x)*(part->x-gpart->x)
- + (part->y-gpart->y)*(part->y-gpart->y));
- if (gdist > 1)
- {
- gangle = atan2 (part->y-gpart->y, part->x-gpart->x);
- gpart->vx += part->g/gdist* cos (gangle) * part->t*time;
- gpart->vy += part->g/gdist* sin (gangle) * part->t*time;
- }
- }
- }
- }
- }
-}
-
-static void
-finiParticles (ParticleSystem * ps)
-{
- free (ps->e);
- free (ps->particles);
- if (ps->tex)
- glDeleteTextures (1, &ps->tex);
-
- if (ps->vertices_cache)
- free (ps->vertices_cache);
- if (ps->colors_cache)
- free (ps->colors_cache);
- if (ps->coords_cache)
- free (ps->coords_cache);
- if (ps->dcolors_cache)
- free (ps->dcolors_cache);
-}
-
-static void
-genNewParticles (ParticleSystem *ps, Emitter *e)
-{
-
- float q, p, t, h, l;
- int count = e->count;
-
- Particle *part = ps->particles;
- int i, j;
-
- for (i = 0; i < ps->hardLimit && count > 0; i++, part++)
- {
- if (part->t <= 0.0f)
- {
- //Position
- part->x = rRange (e->x, e->dx); // X Position
- part->y = rRange (e->y, e->dy); // Y Position
- if ((q = rRange (e->dcirc/2.,e->dcirc/2.)) > 0)
- {
- p = rRange (0, M_PI);
- part->x += q * cos (p);
- part->y += q * sin (p);
- }
-
- //Speed
- part->vx = rRange (e->vx, e->dvx); // X Speed
- part->vy = rRange (e->vy, e->dvy); // Y Speed
- if ((q = rRange (e->dvcirc/2.,e->dvcirc/2.)) > 0)
- {
- p = rRange (0, M_PI);
- part->vx += q * cos (p);
- part->vy += q * sin (p);
- }
- part->vt = rRange (e->vt, e->dvt); // Aging speed
- if (part->vt > -0.0001)
- part->vt = -0.0001;
-
- //Size, Gravity and Rotation
- part->s = rRange (e->s, e->ds); // Particle size
- part->snew = rRange (e->snew, e->dsnew); // Particle start size
- if (e->gp > (float)(random () & 0xffff) / 65535.)
- part->g = rRange (e->g, e->dg); // Particle gravity
- else
- part->g = 0.;
- part->phi = rRange (0, M_PI); // Random orientation
- part->vphi = rRange (e->vphi, e->dvphi); // Rotation speed
-
- //Alpha
- part->a = rRange (e->a, e->da); // Alpha
- if (part->a > 1)
- part->a = 1.;
- else if (part->a < 0)
- part->a = 0.;
-
- //HSL to RGB conversion from Wikipedia simplified by S = 1
- h = rRange (e->h, e->dh); //Random hue within range
- if (h < 0)
- h += 1.;
- else if (t > 1)
- h -= 1.;
- l = rRange (e->l, e->dl); //Random lightness ...
- if (l > 1)
- l = 1.;
- else if (l < 0)
- l = 0.;
- q = e->l * 2;
- if (q > 1)
- q = 1.;
- p = 2 * e->l - q;
- for (j = 0; j < 3; j++)
- {
- t = h + (1-j)/3.;
- if (t < 0)
- t += 1.;
- else if (t > 1)
- t -= 1.;
- if (t < 1/6.)
- part->c[j] = p + ((q-p)*6*t);
- else if (t < .5)
- part->c[j] = q;
- else if (t < 2/3.)
- part->c[j] = p + ((q-p)*6*(2/3.-t));
- else
- part->c[j] = p;
- }
-
- // give new life
- part->t = 1.;
-
- ps->active = true;
- count -= 1;
- }
- }
-}
-
-void
-WizardScreen::positionUpdate (const CompPoint &pos)
-{
- mx = pos.x ();
- my = pos.y ();
-
- if (ps && active && ps->e)
- {
- Emitter *ei = ps->e;
- GPoint *gi = ps->g;
- int i;
- for (i = 0; i < ps->ng; i++, gi++)
- {
- if (gi->movement == MOVEMENT_MOUSEPOSITION)
- {
- gi->x = pos.x ();
- gi->y = pos.y ();
- }
- }
-
- for (i = 0; i < ps->ne; i++, ei++)
- {
- if (ei->movement == MOVEMENT_MOUSEPOSITION)
- {
- ei->x = pos.x ();
- ei->y = pos.y ();
- }
- if (ei->active && ei->trigger == TRIGGER_MOUSEMOVEMENT)
- genNewParticles (ps, ei);
- }
- }
-}
-
-void
-WizardScreen::preparePaint (int time)
-{
- if (active && !pollHandle.active ())
- pollHandle.start ();
-
- if (active && !ps)
- {
- ps = (ParticleSystem*) calloc(1, sizeof (ParticleSystem));
- if (!ps)
- {
- cScreen->preparePaint (time);
- return;
- }
- loadGPoints (ps);
- loadEmitters (ps);
- initParticles (optionGetHardLimit (), optionGetSoftLimit (), ps);
- ps->darken = optionGetDarken ();
- ps->blendMode = (optionGetBlend ()) ? GL_ONE :
- GL_ONE_MINUS_SRC_ALPHA;
- ps->tnew = optionGetTnew ();
- ps->told = optionGetTold ();
- ps->gx = optionGetGx ();
- ps->gy = optionGetGy ();
-
- glGenTextures (1, &ps->tex);
- glBindTexture (GL_TEXTURE_2D, ps->tex);
-
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, particleTex);
- glBindTexture (GL_TEXTURE_2D, 0);
- }
-
- if (ps && active && ps->e)
- {
- Emitter *ei = ps->e;
- GPoint *gi = ps->g;
- int i;
-
- for (i = 0; i < ps->ng; i++, gi++)
- {
- if (gi->movement==MOVEMENT_BOUNCE || gi->movement==MOVEMENT_WRAP)
- {
- gi->x += gi->espeed * cos (gi->eangle) * time;
- gi->y += gi->espeed * sin (gi->eangle) * time;
- if (gi->x >= screen->width ())
- {
- if (gi->movement==MOVEMENT_BOUNCE)
- {
- gi->x = 2*screen->width () - gi->x - 1;
- gi->eangle = M_PI - gi->eangle;
- }
- else if (gi->movement==MOVEMENT_WRAP)
- gi->x -= screen->width ();
- }
- else if (gi->x < 0)
- {
- if (gi->movement==MOVEMENT_BOUNCE)
- {
- gi->x *= -1;
- gi->eangle = M_PI - gi->eangle;
- }
- else if (gi->movement==MOVEMENT_WRAP)
- gi->x += screen->width ();
- }
- if (gi->y >= screen->height ())
- {
- if (gi->movement==MOVEMENT_BOUNCE)
- {
- gi->y = 2*screen->height () - gi->y - 1;
- gi->eangle *= -1;
- }
- else if (gi->movement==MOVEMENT_WRAP)
- gi->y -= screen->height ();
- }
- else if (gi->y < 0)
- {
- if (gi->movement==MOVEMENT_BOUNCE)
- {
- gi->y *= -1;
- gi->eangle *= -1;
- }
- else if (gi->movement==MOVEMENT_WRAP)
- gi->y += screen->height ();
- }
- }
- if (gi->movement==MOVEMENT_FOLLOWMOUSE
- && (my!=gi->y||mx!=gi->x))
- {
- gi->eangle = atan2(my-gi->y, mx-gi->x);
- gi->x += gi->espeed * cos(gi->eangle) * time;
- gi->y += gi->espeed * sin(gi->eangle) * time;
- }
- }
-
- for (i = 0; i < ps->ne; i++, ei++)
- {
- if (ei->movement==MOVEMENT_BOUNCE || ei->movement==MOVEMENT_WRAP)
- {
- ei->x += ei->espeed * cos (ei->eangle) * time;
- ei->y += ei->espeed * sin (ei->eangle) * time;
- if (ei->x >= screen->width ())
- {
- if (ei->movement==MOVEMENT_BOUNCE)
- {
- ei->x = 2*screen->width () - ei->x - 1;
- ei->eangle = M_PI - ei->eangle;
- }
- else if (ei->movement==MOVEMENT_WRAP)
- ei->x -= screen->width ();
- }
- else if (ei->x < 0)
- {
- if (ei->movement==MOVEMENT_BOUNCE)
- {
- ei->x *= -1;
- ei->eangle = M_PI - ei->eangle;
- }
- else if (ei->movement==MOVEMENT_WRAP)
- ei->x += screen->width ();
- }
- if (ei->y >= screen->height ())
- {
- if (ei->movement==MOVEMENT_BOUNCE)
- {
- ei->y = 2*screen->height () - ei->y - 1;
- ei->eangle *= -1;
- }
- else if (ei->movement==MOVEMENT_WRAP)
- ei->y -= screen->height ();
- }
- else if (ei->y < 0)
- {
- if (ei->movement==MOVEMENT_BOUNCE)
- {
- ei->y *= -1;
- ei->eangle *= -1;
- }
- else if (ei->movement==MOVEMENT_WRAP)
- ei->y += screen->height ();
- }
- }
- if (ei->movement==MOVEMENT_FOLLOWMOUSE
- && (my!=ei->y||mx!=ei->x))
- {
- ei->eangle = atan2 (my-ei->y, mx-ei->x);
- ei->x += ei->espeed * cos (ei->eangle) * time;
- ei->y += ei->espeed * sin (ei->eangle) * time;
- }
- if (ei->trigger == TRIGGER_RANDOMPERIOD
- && ei->set_active && !((int)random ()&0xff))
- ei->active = !ei->active;
- if (ei->active && (
- (ei->trigger == TRIGGER_PERSISTENT) ||
- (ei->trigger == TRIGGER_RANDOMSHOT && !((int)random()&0xff)) ||
- (ei->trigger == TRIGGER_RANDOMPERIOD)
- ))
- genNewParticles (ps, ei);
- }
- }
-
- if (ps && ps->active)
- {
- updateParticles (ps, time);
- cScreen->damageScreen ();
- }
-
- cScreen->preparePaint (time);
-}
-
-void
-WizardScreen::donePaint ()
-{
- if (active || (ps && ps->active))
- cScreen->damageScreen ();
-
- if (!active && pollHandle.active ())
- pollHandle.stop ();
-
- if (!active && ps && !ps->active)
- {
- finiParticles (ps);
- free (ps);
- ps = NULL;
- }
-
- cScreen->donePaint ();
-}
-
-bool
-WizardScreen::glPaintOutput (const GLScreenPaintAttrib &sa,
- const GLMatrix &transform,
- const CompRegion &region,
- CompOutput *output,
- unsigned int mask)
-{
- bool status;
- GLMatrix sTransform;
-
- status = gScreen->glPaintOutput (sa, transform, region, output, mask);
-
- if (!ps || !ps->active)
- return status;
-
- sTransform.reset ();
-
- sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
-
- glPushMatrix ();
- glLoadMatrixf (sTransform.getMatrix ());
-
- drawParticles (ps);
-
- glPopMatrix ();
-
- glColor4usv (defaultColor);
-
- return status;
-}
-
-bool
-WizardScreen::toggle ()
-{
- active = !active;
- cScreen->preparePaintSetEnabled (this, active);
- cScreen->donePaintSetEnabled (this, active);
- gScreen->glPaintOutputSetEnabled (this, active);
-
- cScreen->damageScreen ();
- return true;
-}
-
-void
-WizardScreen::optionChanged (CompOption *opt,
- WizardOptions::Options num)
-{
- loadGPoints (ps);
- loadEmitters (ps);
-}
-
-WizardScreen::WizardScreen (CompScreen *screen) :
- PluginClassHandler <WizardScreen, CompScreen> (screen),
- cScreen (CompositeScreen::get (screen)),
- gScreen (GLScreen::get (screen)),
- active (false),
- ps (NULL)
-{
- ScreenInterface::setHandler (screen, false);
- CompositeScreenInterface::setHandler (cScreen, false);
- GLScreenInterface::setHandler (gScreen, false);
-
-#define optionNotify(name) \
- optionSet##name##Notify (boost::bind (&WizardScreen::optionChanged, \
- this, _1, _2))
-
- optionNotify (GStrength);
- optionNotify (GPosx);
- optionNotify (GPosy);
- optionNotify (GSpeed);
- optionNotify (GAngle);
- optionNotify (GMovement);
- optionNotify (EActive);
- optionNotify (EName);
- optionNotify (ETrigger);
- optionNotify (EPosx);
- optionNotify (EPosy);
- optionNotify (ESpeed);
- optionNotify (EAngle);
- optionNotify (GMovement);
- optionNotify (ECount);
- optionNotify (EH);
- optionNotify (EDh);
- optionNotify (EL);
- optionNotify (EDl);
- optionNotify (EA);
- optionNotify (EDa);
- optionNotify (EDx);
- optionNotify (EDy);
- optionNotify (EDcirc);
- optionNotify (EVx);
- optionNotify (EVy);
- optionNotify (EVt);
- optionNotify (EVphi);
- optionNotify (EDvx);
- optionNotify (EDvy);
- optionNotify (EDvcirc);
- optionNotify (EDvt);
- optionNotify (EDvphi);
- optionNotify (ES);
- optionNotify (EDs);
- optionNotify (ESnew);
- optionNotify (EDsnew);
- optionNotify (EG);
- optionNotify (EDg);
- optionNotify (EGp);
-
-#undef optionNotify
-
- pollHandle.setCallback (boost::bind (&WizardScreen::positionUpdate, this, _1));
-
- optionSetToggleInitiate (boost::bind (&WizardScreen::toggle, this));
-}
-
-WizardScreen::~WizardScreen ()
-{
- if (pollHandle.active ())
- pollHandle.stop ();
-
- if (ps && ps->active)
- cScreen->damageScreen ();
-}
-
-bool
-WizardPluginVTable::init ()
-{
- if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
- !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
- !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI) ||
- !CompPlugin::checkPluginABI ("mousepoll", COMPIZ_MOUSEPOLL_ABI))
- return false;
-
- return true;
-}
diff --git a/src/wizard.c b/wizard.c
index d26340b..76705c6 100755
--- a/src/wizard.c
+++ b/wizard.c
@@ -24,7 +24,163 @@
#include <math.h>
#include <string.h>
-#include "wizard.h"
+#include <compiz-core.h>
+#include <compiz-mousepoll.h>
+
+#include "wizard_options.h"
+#include "wizard_tex.h"
+
+#define GET_WIZARD_DISPLAY(d) \
+ ((WizardDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
+
+#define WIZARD_DISPLAY(d) \
+ WizardDisplay *wd = GET_WIZARD_DISPLAY (d)
+
+#define GET_WIZARD_SCREEN(s, sd) \
+ ((WizardScreen *) (s)->base.privates[(sd)->screenPrivateIndex].ptr)
+
+#define WIZARD_SCREEN(s) \
+ WizardScreen *ws = GET_WIZARD_SCREEN (s, GET_WIZARD_DISPLAY (s->display))
+
+static float
+rRange (float avg, float range)
+{
+ return avg + (float)((random () & 0xff)/127.5-1.)*range;
+}
+
+typedef enum
+{
+ TRIGGER_PERSISTENT = 0,
+ TRIGGER_MOUSEMOVEMENT,
+ TRIGGER_RANDOMSHOT,
+ TRIGGER_RANDOMPERIOD
+} TriggerType;
+
+typedef enum
+{
+ MOVEMENT_MOUSEPOSITION = 0,
+ MOVEMENT_FOLLOWMOUSE,
+ MOVEMENT_BOUNCE,
+ MOVEMENT_WRAP
+} MovementType;
+
+typedef struct _GPoint
+{
+ float strength; // Strength of this gravity source
+ float x; // X position
+ float y; // Y position
+ float espeed; // Speed of the gravity source
+ float eangle; // Angle for the movement of this gravity source
+ int movement; // Type of movement of this gravity source
+} GPoint;
+
+typedef struct _Particle
+{
+ float c[3]; // Color
+ float a; // alpha value
+ float x; // X position
+ float y; // Y position
+ float t; // t position (age, born at 1, dies at 0)
+ float phi; // Orientation of texture
+ float vx; // X speed
+ float vy; // Y speed
+ float vt; // t speed (aging speed)
+ float vphi; // Rotation speed
+ float s; // size (side of the square)
+ float snew; // Size when born (reduced to s while new)
+ float g; // Gravity from this particle
+} Particle;
+
+typedef struct _Emitter
+{
+ Bool set_active; // Set to active in the settings
+ Bool active; // Currently active (differs from set_active for
+ // the random period trigger)
+ int trigger; // When to generate particles
+ int count; // Amount of particles to be generated
+ float h; // color hue (0..1)
+ float dh; // color hue range
+ float l; // color lightness (0..1)
+ float dl; // color lightness range
+ float a; // Alpha
+ float da; // Alpha range
+ float x; // X position
+ float y; // Y position
+ float espeed; // Speed of the emitter
+ float eangle; // Angle for the movement of this emitter
+ int movement; // Type of movement of this emitter
+ float dx; // X range
+ float dy; // Y range
+ float dcirc; // Circular range
+ float vx; // X speed
+ float vy; // Y speed
+ float vt; // t speed (aging speed)
+ float vphi; // Rotation speed
+ float dvx; // X speed range
+ float dvy; // Y speed range
+ float dvcirc; // Circular speed range
+ float dvt; // t speed (aging speed) range
+ float dvphi; // Rotation speed range
+ float s; // size (side of the square)
+ float ds; // size (side of the square) range
+ float snew; // Size when born (reduced to s while new)
+ float dsnew; // Size when born (reduced to s while new) range
+ float g; // Gravity of particles
+ float dg; // Gravity range
+ float gp; // Part of particles that have gravity
+} Emitter;
+
+typedef struct _ParticleSystem
+{
+ int hardLimit; // Not to be exceeded
+ int softLimit; // If exceeded, old particles age faster
+ int lastCount; // Living particle count to evaluate softLimit
+ float tnew; // Particle is new if t > tnew
+ float told; // Particle is old if t < told
+ float gx; // Global gravity x
+ float gy; // Global gravity y
+ Particle *particles; // The actual particles
+ GLuint tex; // Particle Texture
+ Bool active;
+ float darken; // Darken background
+ GLuint blendMode;
+ Emitter *e; // All emitters in here
+ GPoint *g; // All gravity point sources in here
+ int ne; // Emitter count
+ int ng; // GPoint count
+
+ GLfloat *vertices_cache;
+ int vertex_cache_count;
+ GLfloat *coords_cache;
+ int coords_cache_count;
+ GLfloat *colors_cache;
+ int color_cache_count;
+ GLfloat *dcolors_cache;
+ int dcolors_cache_count;
+} ParticleSystem;
+
+static int displayPrivateIndex = 0;
+
+typedef struct _WizardDisplay
+{
+ int screenPrivateIndex;
+ MousePollFunc *mpFunc;
+} WizardDisplay;
+
+typedef struct _WizardScreen
+{
+ int mx, my; //Mouse Position from polling
+
+ Bool active;
+
+ ParticleSystem *ps;
+
+ PositionPollingHandle pollHandle;
+
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintOutputProc paintOutput;
+} WizardScreen;
static void
initParticles (int hardLimit, int softLimit, ParticleSystem * ps)
@@ -35,7 +191,7 @@ initParticles (int hardLimit, int softLimit, ParticleSystem * ps)
ps->tex = 0;
ps->hardLimit = hardLimit;
ps->softLimit = softLimit;
- ps->active = false;
+ ps->active = FALSE;
ps->lastCount = 0;
// Initialize cache
@@ -54,15 +210,15 @@ initParticles (int hardLimit, int softLimit, ParticleSystem * ps)
part->t = 0.0f;
}
-void
-WizardScreen::loadGPoints (ParticleSystem *ps)
+static void
+loadGPoints (CompScreen *s, ParticleSystem *ps)
{
if (ps->g)
free (ps->g);
int i;
GPoint *gi;
- CompListValue *clv = optionGetGStrength ();
+ CompListValue *clv = wizardGetGStrength (s);
ps->ng = clv->nValue;
ps->g = calloc (ps->ng, sizeof (GPoint));
@@ -70,41 +226,41 @@ WizardScreen::loadGPoints (ParticleSystem *ps)
for (i = 0; i < ps->ng; i++, gi++)
gi->strength = (float)clv->value[i].i / 1000.;
- clv = optionGetGPosx ();
+ clv = wizardGetGPosx (s);
gi = ps->g;
for (i = 0; i < ps->ng; i++, gi++)
gi->x = (float)clv->value[i].i;
- clv = optionGetGPosy ();
+ clv = wizardGetGPosy (s);
gi = ps->g;
for (i = 0; i < ps->ng; i++, gi++)
gi->y = (float)clv->value[i].i;
- clv = optionGetGSpeed ();
+ clv = wizardGetGSpeed (s);
gi = ps->g;
for (i = 0; i < ps->ng; i++, gi++)
gi->espeed = (float)clv->value[i].i / 100.;
- clv = optionGetGAngle ();
+ clv = wizardGetGAngle (s);
gi = ps->g;
for (i = 0; i < ps->ng; i++, gi++)
gi->eangle = (float)clv->value[i].i / 180.*M_PI;
- clv = optionGetGMovement ();
+ clv = wizardGetGMovement (s);
gi = ps->g;
for (i = 0; i < ps->ng; i++, gi++)
gi->movement = clv->value[i].i;
}
-void
-WizardScreen::loadEmitters (ParticleSystem *ps)
+static void
+loadEmitters (CompScreen *s, ParticleSystem *ps)
{
if (ps->e)
free (ps->e);
int i;
Emitter *ei;
- CompListValue *clv = optionGetEActive ();
+ CompListValue *clv = wizardGetEActive (s);
ps->ne = clv->nValue;
ps->e = calloc (ps->ne, sizeof (Emitter));
@@ -112,169 +268,169 @@ WizardScreen::loadEmitters (ParticleSystem *ps)
for (i = 0; i < ps->ne; i++, ei++)
ei->set_active = ei->active = clv->value[i].b;
- clv = optionGetETrigger ();
+ clv = wizardGetETrigger (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->trigger = clv->value[i].i;
- clv = optionGetEPosx ();
+ clv = wizardGetEPosx (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->x = (float)clv->value[i].i;
- clv = optionGetEPosy ();
+ clv = wizardGetEPosy (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->y = (float)clv->value[i].i;
- clv = optionGetESpeed ();
+ clv = wizardGetESpeed (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->espeed = (float)clv->value[i].i / 100.;
- clv = optionGetEAngle ();
+ clv = wizardGetEAngle (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->eangle = (float)clv->value[i].i / 180.*M_PI;
- clv = optionGetEMovement ();
+ clv = wizardGetEMovement (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->movement = clv->value[i].i;
- clv = optionGetECount ();
+ clv = wizardGetECount (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->count = (float)clv->value[i].i;
- clv = optionGetEH ();
+ clv = wizardGetEH (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->h = (float)clv->value[i].i / 1000.;
- clv = optionGetEDh ();
+ clv = wizardGetEDh (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dh = (float)clv->value[i].i / 1000.;
- clv = optionGetEL ();
+ clv = wizardGetEL (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->l = (float)clv->value[i].i / 1000.;
- clv = optionGetEDl ();
+ clv = wizardGetEDl (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dl = (float)clv->value[i].i / 1000.;
- clv = optionGetEA ();
+ clv = wizardGetEA (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->a = (float)clv->value[i].i / 1000.;
- clv = optionGetEDa ();
+ clv = wizardGetEDa (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->da = (float)clv->value[i].i / 1000.;
- clv = optionGetEDx ();
+ clv = wizardGetEDx (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dx = (float)clv->value[i].i;
- clv = optionGetEDy ();
+ clv = wizardGetEDy (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dy = (float)clv->value[i].i;
- clv = optionGetEDcirc ();
+ clv = wizardGetEDcirc (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dcirc = (float)clv->value[i].i;
- clv = optionGetEVx ();
+ clv = wizardGetEVx (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->vx = (float)clv->value[i].i / 1000.;
- clv = optionGetEVy ();
+ clv = wizardGetEVy (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->vy = (float)clv->value[i].i / 1000.;
- clv = optionGetEVt ();
+ clv = wizardGetEVt (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->vt = (float)clv->value[i].i / 10000.;
- clv = optionGetEVphi ();
+ clv = wizardGetEVphi (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->vphi = (float)clv->value[i].i / 10000.;
- clv = optionGetEDvx ();
+ clv = wizardGetEDvx (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dvx = (float)clv->value[i].i / 1000.;
- clv = optionGetEDvy ();
+ clv = wizardGetEDvy (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dvy = (float)clv->value[i].i / 1000.;
- clv = optionGetEDvcirc ();
+ clv = wizardGetEDvcirc (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dvcirc = (float)clv->value[i].i / 1000.;
- clv = optionGetEDvt ();
+ clv = wizardGetEDvt (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dvt = (float)clv->value[i].i / 10000.;
- clv = optionGetEDvphi ();
+ clv = wizardGetEDvphi (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dvphi = (float)clv->value[i].i / 10000.;
- clv = optionGetES ();
+ clv = wizardGetES (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->s = (float)clv->value[i].i;
- clv = optionGetEDs ();
+ clv = wizardGetEDs (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->ds = (float)clv->value[i].i;
- clv = optionGetESnew ();
+ clv = wizardGetESnew (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->snew = (float)clv->value[i].i;
- clv = optionGetEDsnew ();
+ clv = wizardGetEDsnew (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dsnew = (float)clv->value[i].i;
- clv = optionGetEG ();
+ clv = wizardGetEG (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->g = (float)clv->value[i].i / 1000.;
- clv = optionGetEDg ();
+ clv = wizardGetEDg (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->dg = (float)clv->value[i].i / 1000.;
- clv = optionGetEGp ();
+ clv = wizardGetEGp (s);
ei = ps->e;
for (i = 0; i < ps->ne; i++, ei++)
ei->gp = (float)clv->value[i].i / 10000.;
}
-void
-WizardScreen::drawParticles (ParticleSystem * ps)
+static void
+drawParticles (CompScreen * s, ParticleSystem * ps)
{
glPushMatrix ();
@@ -449,7 +605,7 @@ updateParticles (ParticleSystem * ps, float time)
Particle *part;
GPoint *gi;
float gdist, gangle;
- ps->active = false;
+ ps->active = FALSE;
part = ps->particles;
for (i = 0; i < ps->hardLimit; i++, part++)
@@ -491,7 +647,7 @@ updateParticles (ParticleSystem * ps, float time)
}
}
- ps->active = true;
+ ps->active = TRUE;
newCount++;
}
}
@@ -630,29 +786,30 @@ genNewParticles (ParticleSystem *ps, Emitter *e)
// give new life
part->t = 1.;
- ps->active = true;
+ ps->active = TRUE;
count -= 1;
}
}
}
-void
-WizardScreen::damageRegion ()
+static void
+damageRegion (CompScreen *s)
{
+ REGION r;
// int i;
// Particle *p;
// float cOff;
float x1, x2, y1, y2;
- if (!ps)
+ WIZARD_SCREEN (s);
+
+ if (!ws->ps)
return;
x1 = 0;
- x2 = screen->width ();
+ x2 = s->width;
y1 = 0;
- y2 = screen->height ();
-
- CompRegion r (x1, x2, y1, y2);
+ y2 = s->height;
/* // I don't know much about this system, but since this plugin is meant to be
// a heavy toy, which occupies almost the whole screen, calculating the
@@ -679,7 +836,7 @@ WizardScreen::damageRegion ()
y1 = MIN (y1, p->y - cOff);
y2 = MAX (y2, p->y + cOff);
}
-
+*/
r.rects = &r.extents;
r.numRects = r.size = 1;
@@ -688,22 +845,24 @@ WizardScreen::damageRegion ()
r.extents.x2 = ceil (x2);
r.extents.y1 = floor (y1);
r.extents.y2 = ceil (y2);
-*/
- cScreen->damageRegion (r);
+
+ damageScreenRegion (s, &r);
}
-void
-WizardScreen::positionUpdate (const CompPoint &pos)
+static void
+positionUpdate (CompScreen *s, int x, int y)
{
- mx = pos.x ();
- my = pos.x ();
+ WIZARD_SCREEN (s);
+
+ ws->mx = x;
+ ws->my = y;
- if (ps && active && ps->e)
+ if (ws->ps && ws->active && ws->ps->e)
{
- Emitter *ei = ps->e;
- GPoint *gi = ps->g;
+ Emitter *ei = ws->ps->e;
+ GPoint *gi = ws->ps->g;
int i;
- for (i = 0; i < ps->ng; i++, gi++)
+ for (i = 0; i < ws->ps->ng; i++, gi++)
{
if (gi->movement == MOVEMENT_MOUSEPOSITION)
{
@@ -712,7 +871,7 @@ WizardScreen::positionUpdate (const CompPoint &pos)
}
}
- for (i = 0; i < ps->ne; i++, ei++)
+ for (i = 0; i < ws->ps->ne; i++, ei++)
{
if (ei->movement == MOVEMENT_MOUSEPOSITION)
{
@@ -720,41 +879,46 @@ WizardScreen::positionUpdate (const CompPoint &pos)
ei->y = y;
}
if (ei->active && ei->trigger == TRIGGER_MOUSEMOVEMENT)
- genNewParticles (ps, ei);
+ genNewParticles (ws->ps, ei);
}
}
}
-void
-WizardScreen::preparePaint (int time)
+static void
+wizardPreparePaintScreen (CompScreen *s, int time)
{
- if (active && !pollHandle.active ())
+ WIZARD_SCREEN (s);
+ WIZARD_DISPLAY (s->display);
+
+ if (ws->active && !ws->pollHandle)
{
-// (*wd->mpFunc->getCurrentPosition) (s, &mx, &my); //???
- pollHandle.start ();
+ (*wd->mpFunc->getCurrentPosition) (s, &ws->mx, &ws->my);
+ ws->pollHandle = (*wd->mpFunc->addPositionPolling) (s, positionUpdate);
}
- if (active && !ps)
+ if (ws->active && !ws->ps)
{
- ps = (ParticleSystem*) calloc(1, sizeof (ParticleSystem));
- if (!ps)
+ ws->ps = calloc(1, sizeof (ParticleSystem));
+ if (!ws->ps)
{
- cScreen->preparePaint (time);
+ UNWRAP (ws, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, time);
+ WRAP (ws, s, preparePaintScreen, wizardPreparePaintScreen);
return;
}
- loadGPoints (s, ps);
- loadEmitters (s, ps);
- initParticles (optionGetHardLimit (), optionGetSoftLimit (), ps);
- ps->darken = optionGetDarken ();
- ps->blendMode = (optionGetBlend ()) ? GL_ONE :
+ loadGPoints (s, ws->ps);
+ loadEmitters (s, ws->ps);
+ initParticles (wizardGetHardLimit (s), wizardGetSoftLimit (s), ws->ps);
+ ws->ps->darken = wizardGetDarken (s);
+ ws->ps->blendMode = (wizardGetBlend (s)) ? GL_ONE :
GL_ONE_MINUS_SRC_ALPHA;
- ps->tnew = optionGetTnew ();
- ps->told = optionGetTold ();
- ps->gx = optionGetGx ();
- ps->gy = optionGetGy ();
+ ws->ps->tnew = wizardGetTnew (s);
+ ws->ps->told = wizardGetTold (s);
+ ws->ps->gx = wizardGetGx (s);
+ ws->ps->gy = wizardGetGy (s);
- glGenTextures (1, &ps->tex);
- glBindTexture (GL_TEXTURE_2D, ps->tex);
+ glGenTextures (1, &ws->ps->tex);
+ glBindTexture (GL_TEXTURE_2D, ws->ps->tex);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -764,13 +928,13 @@ WizardScreen::preparePaint (int time)
glBindTexture (GL_TEXTURE_2D, 0);
}
- if (ps && active && ps->e)
+ if (ws->ps && ws->active && ws->ps->e)
{
- Emitter *ei = ps->e;
- GPoint *gi = ps->g;
+ Emitter *ei = ws->ps->e;
+ GPoint *gi = ws->ps->g;
int i;
- for (i = 0; i < ps->ng; i++, gi++)
+ for (i = 0; i < ws->ps->ng; i++, gi++)
{
if (gi->movement==MOVEMENT_BOUNCE || gi->movement==MOVEMENT_WRAP)
{
@@ -818,15 +982,15 @@ WizardScreen::preparePaint (int time)
}
}
if (gi->movement==MOVEMENT_FOLLOWMOUSE
- && (my!=gi->y||mx!=gi->x))
+ && (ws->my!=gi->y||ws->mx!=gi->x))
{
- gi->eangle = atan2(my-gi->y, mx-gi->x);
+ gi->eangle = atan2(ws->my-gi->y, ws->mx-gi->x);
gi->x += gi->espeed * cos(gi->eangle) * time;
gi->y += gi->espeed * sin(gi->eangle) * time;
}
}
- for (i = 0; i < ps->ne; i++, ei++)
+ for (i = 0; i < ws->ps->ne; i++, ei++)
{
if (ei->movement==MOVEMENT_BOUNCE || ei->movement==MOVEMENT_WRAP)
{
@@ -874,9 +1038,9 @@ WizardScreen::preparePaint (int time)
}
}
if (ei->movement==MOVEMENT_FOLLOWMOUSE
- && (my!=ei->y||mx!=ei->x))
+ && (ws->my!=ei->y||ws->mx!=ei->x))
{
- ei->eangle = atan2 (my-ei->y, mx-ei->x);
+ ei->eangle = atan2 (ws->my-ei->y, ws->mx-ei->x);
ei->x += ei->espeed * cos (ei->eangle) * time;
ei->y += ei->espeed * sin (ei->eangle) * time;
}
@@ -888,63 +1052,76 @@ WizardScreen::preparePaint (int time)
(ei->trigger == TRIGGER_RANDOMSHOT && !((int)random()&0xff)) ||
(ei->trigger == TRIGGER_RANDOMPERIOD)
))
- genNewParticles (ps, ei);
+ genNewParticles (ws->ps, ei);
}
}
- if (ps && ps->active)
+ if (ws->ps && ws->ps->active)
{
- updateParticles (ps, time);
- damageRegion ();
+ updateParticles (ws->ps, time);
+ damageRegion (s);
}
- cScreen->preparePaint (time);
+ UNWRAP (ws, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, time);
+ WRAP (ws, s, preparePaintScreen, wizardPreparePaintScreen);
}
-void
-WizardScreen::donePaint ()
+static void
+wizardDonePaintScreen (CompScreen *s)
{
- if (active || (ps && ps->active))
- cScreen->damageRegion ();
+ WIZARD_SCREEN (s);
+ WIZARD_DISPLAY (s->display);
- if (!active && pollHandle.active ())
- pollHandle.stop ();
+ if (ws->active || (ws->ps && ws->ps->active))
+ damageRegion (s);
- if (!active && ps && !ps->active)
+ if (!ws->active && ws->pollHandle)
{
- finiParticles (ps);
- free (ps);
- ps = NULL;
+ (*wd->mpFunc->removePositionPolling) (s, ws->pollHandle);
+ ws->pollHandle = 0;
+ }
+
+ if (!ws->active && ws->ps && !ws->ps->active)
+ {
+ finiParticles (ws->ps);
+ free (ws->ps);
+ ws->ps = NULL;
}
- cScreen->donePaint ();
+ UNWRAP (ws, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (ws, s, donePaintScreen, wizardDonePaintScreen);
}
-static bool
-WizardScreen::glPaintOutput (const GLScreenPaintAttrib &sa,
- const GLMatrix &transform,
- const CompRegion &region,
- CompOutput *output,
- unsigned int mask)
+static Bool
+wizardPaintOutput (CompScreen *s,
+ const ScreenPaintAttrib *sa,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask)
{
- bool status;
- GLMatrix sTransform;
+ Bool status;
+ CompTransform sTransform;
- status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
+ WIZARD_SCREEN (s);
- if (!ps || !ps->active)
+ UNWRAP (ws, s, paintOutput);
+ status = (*s->paintOutput) (s, sa, transform, region, output, mask);
+ WRAP (ws, s, paintOutput, wizardPaintOutput);
+
+ if (!ws->ps || !ws->ps->active)
return status;
- sTransform.reset ();
-// matrixGetIdentity (&sTransform);
+ matrixGetIdentity (&sTransform);
- sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
-// transformToScreenSpace (output, -DEFAULT_Z_CAMERA, &sTransform);
+ transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
glPushMatrix ();
- glLoadMatrixf (sTransform.getMatrix ());
+ glLoadMatrixf (sTransform.m);
- drawParticles (ps);
+ drawParticles (s, ws->ps);
glPopMatrix ();
@@ -953,70 +1130,7 @@ WizardScreen::glPaintOutput (const GLScreenPaintAttrib &sa,
return status;
}
-bool
-WizardScreen::initiate ()
-{
- active = true;
- return true;
-}
-
-bool
-WizardScreen::terminate ()
-{
- active = false;
- return true;
-}
-
-WizardScreen::WizardScreen (CompScreen *screen) :
- PluginClassHandler <WizardScreen, CompScreen> (screen),
- cScreen (CompositeScreen::get (screen)),
- gScreen (GLScreen::get (screen)),
- active (false),
- pollHandle (0),
- ps (NULL);
-
- return true;
-{
- ScreenInterface::setHandler (screen, false);
- CompositeScreenInterface::setHandler (cScreen, false);
- GLScreenInterface::setHandler (gScreen, false);
-
- poller.setCallback (boost::bind (&WizardScreen::positionUpdate, this, _1));
-
- optionSetInitiateInitiate (boost::bind (&WizardScreen::initiate, this));
- optionSetInitiateTerminate (boost::bind (&WizardScreen::terminate, this));
-}
-
-WizardScreen::~WizardScreen ()
-{
- pollHandle.stop ();
-// if (ws->apollHandle)
-// (*wd->mpFunc->removePositionPolling) (s, ws->pollHandle);
-
- if (ps && ps->active)
- cScreen->damageScreen ();
-
- //Free the pointer
- free (ws);
-}
-
-bool
-WizardPluginVTable::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;
- if (!CompPlugin::checkPluginABI ("mousepoll", COMPIZ_MOUSEPOLL_ABI))
- return false;
-
- return true;
-}
-
-/*
-static bool
+static Bool
wizardTerminate (CompDisplay *d,
CompAction *action,
CompActionState state,
@@ -1029,19 +1143,19 @@ wizardTerminate (CompDisplay *d,
xid = getIntOptionNamed (option, nOption, "root", 0);
s = findScreenAtDisplay (d, xid);
- if ()
+ if (s)
{
- WIZARD_SCREEN ();
+ WIZARD_SCREEN (s);
- ws->active = false;
- damageRegion ();
+ ws->active = FALSE;
+ damageRegion (s);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool
+static Bool
wizardInitiate (CompDisplay *d,
CompAction *action,
CompActionState state,
@@ -1054,20 +1168,21 @@ wizardInitiate (CompDisplay *d,
xid = getIntOptionNamed (option, nOption, "root", 0);
s = findScreenAtDisplay (d, xid);
- if ()
+ if (s)
{
- WIZARD_SCREEN ();
+ WIZARD_SCREEN (s);
if (ws->active)
return wizardTerminate (d, action, state, option, nOption);
- ws->active = true;
+ ws->active = TRUE;
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool
+
+static Bool
wizardInitScreen (CompPlugin *p, CompScreen *s)
{
WIZARD_DISPLAY (s->display);
@@ -1075,7 +1190,7 @@ wizardInitScreen (CompPlugin *p, CompScreen *s)
WizardScreen *ws = (WizardScreen *) calloc (1, sizeof (WizardScreen) );
if (!ws)
- return false;
+ return FALSE;
s->base.privates[wd->screenPrivateIndex].ptr = ws;
@@ -1083,19 +1198,19 @@ wizardInitScreen (CompPlugin *p, CompScreen *s)
WRAP (ws, s, preparePaintScreen, wizardPreparePaintScreen);
WRAP (ws, s, donePaintScreen, wizardDonePaintScreen);
- ws->active = false;
+ ws->active = FALSE;
ws->pollHandle = 0;
ws->ps = NULL;
- return true;
+ return TRUE;
}
static void
wizardFiniScreen (CompPlugin *p, CompScreen *s)
{
- WIZARD_SCREEN ();
+ WIZARD_SCREEN (s);
WIZARD_DISPLAY (s->display);
//Restore the original function
@@ -1107,13 +1222,13 @@ wizardFiniScreen (CompPlugin *p, CompScreen *s)
(*wd->mpFunc->removePositionPolling) (s, ws->pollHandle);
if (ws->ps && ws->ps->active)
- damageScreen ();
+ damageScreen (s);
//Free the pointer
free (ws);
}
-static bool
+static Bool
wizardInitDisplay (CompPlugin *p, CompDisplay *d)
{
//Generate a wizard display
@@ -1122,15 +1237,15 @@ wizardInitDisplay (CompPlugin *p, CompDisplay *d)
if (!checkPluginABI ("core", CORE_ABIVERSION) ||
!checkPluginABI ("mousepoll", MOUSEPOLL_ABIVERSION))
- return false;
+ return FALSE;
if (!getPluginDisplayIndex (d, "mousepoll", &index))
- return false;
+ return FALSE;
wd = (WizardDisplay *) malloc (sizeof (WizardDisplay));
if (!wd)
- return false;
+ return FALSE;
//Allocate a private index
wd->screenPrivateIndex = allocateScreenPrivateIndex (d);
@@ -1140,17 +1255,17 @@ wizardInitDisplay (CompPlugin *p, CompDisplay *d)
{
//Its invalid so free memory and return
free (wd);
- return false;
+ return FALSE;
}
wd->mpFunc = d->base.privates[index].ptr;
- optionSetInitiateInitiate (d, wizardInitiate);
- optionSetInitiateTerminate (d, wizardTerminate);
+ wizardSetInitiateInitiate (d, wizardInitiate);
+ wizardSetInitiateTerminate (d, wizardTerminate);
//Record the display
d->base.privates[displayPrivateIndex].ptr = wd;
- return true;
+ return TRUE;
}
static void
@@ -1165,15 +1280,15 @@ wizardFiniDisplay (CompPlugin *p, CompDisplay *d)
-static bool
+static Bool
wizardInit (CompPlugin * p)
{
displayPrivateIndex = allocateDisplayPrivateIndex ();
if (displayPrivateIndex < 0)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
static void
@@ -1183,4 +1298,43 @@ wizardFini (CompPlugin * p)
freeDisplayPrivateIndex (displayPrivateIndex);
}
-*/
+static CompBool
+wizardInitObject (CompPlugin *p, CompObject *o)
+{
+ static InitPluginObjectProc dispTab[] = {
+ (InitPluginObjectProc) 0, /* InitCore */
+ (InitPluginObjectProc) wizardInitDisplay,
+ (InitPluginObjectProc) wizardInitScreen
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
+}
+
+static void
+wizardFiniObject (CompPlugin *p, CompObject *o)
+{
+ static FiniPluginObjectProc dispTab[] = {
+ (FiniPluginObjectProc) 0, /* FiniCore */
+ (FiniPluginObjectProc) wizardFiniDisplay,
+ (FiniPluginObjectProc) wizardFiniScreen
+ };
+
+ DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
+}
+
+CompPluginVTable wizardVTable = {
+ "wizard",
+ 0,
+ wizardInit,
+ wizardFini,
+ wizardInitObject,
+ wizardFiniObject,
+ 0,
+ 0
+};
+
+CompPluginVTable *
+getCompPluginInfo (void)
+{
+ return &wizardVTable;
+}
diff --git a/wizard.xml.in b/wizard.xml.in
index 222cd68..82e7dcf 100755
--- a/wizard.xml.in
+++ b/wizard.xml.in
@@ -12,15 +12,17 @@
<plugin>mousepoll</plugin>
</requirement>
</deps>
- <options>
+ <display>
<group>
<_short>General</_short>
- <option name="toggle" type="key">
- <_short>Toggle</_short>
+ <option name="initiate" type="key">
+ <_short>Initiate</_short>
<_long>Toggle all particle effects.</_long>
<default>&lt;Super&gt;w</default>
</option>
</group>
+ </display>
+ <screen>
<group>
<_short>Gravity</_short>
<subgroup>
@@ -848,6 +850,6 @@
</option>
</subgroup>
</group>
- </options>
+ </screen>
</plugin>
</compiz>
diff --git a/include/wizard_tex.h b/wizard_tex.h
index 35685a2..b8c8736 100755
--- a/include/wizard_tex.h
+++ b/wizard_tex.h
@@ -2821,4 +2821,5 @@ static const unsigned char particleTex[65536] = {
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
};