summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@ACER-SUSE.SUSE>2007-11-09 18:34:57 +0900
committerSam Spilsbury <Sam@ACER-SUSE.SUSE>2007-11-09 18:34:57 +0900
commit21817bb2fd56dc23f146c0c637f43125a28a2e72 (patch)
treeafa070a396ed7fbfe47b7cc8b182fac5e001b1cc
parentc1bf6b52681558e0075449ccf000c157544d8b16 (diff)
downloadstars-21817bb2fd56dc23f146c0c637f43125a28a2e72.tar.gz
stars-21817bb2fd56dc23f146c0c637f43125a28a2e72.tar.bz2
..... Forgot to git add......
-rw-r--r--Makefile463
-rw-r--r--images/star.pngbin0 -> 10392 bytes
-rw-r--r--plugin.info1
-rw-r--r--star.c803
-rw-r--r--star.xml.in130
5 files changed, 1397 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e1835ab
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,463 @@
+##
+#
+# 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/images/star.png b/images/star.png
new file mode 100644
index 0000000..52793ef
--- /dev/null
+++ b/images/star.png
Binary files differ
diff --git a/plugin.info b/plugin.info
new file mode 100644
index 0000000..6ef8e13
--- /dev/null
+++ b/plugin.info
@@ -0,0 +1 @@
+PLUGIN = star
diff --git a/star.c b/star.c
new file mode 100644
index 0000000..52cd54a
--- /dev/null
+++ b/star.c
@@ -0,0 +1,803 @@
+/**
+ *
+ * Compiz star plugin
+ *
+ * star.c
+ *
+ * This plugin is used to draw some fancy stars on the
+ * screen, much akin to snow.
+ *
+ * Copyright (c) 2007 Kyle Mallory <kyle.mallory@utah.edu>
+ *
+ * Based on the 'snow' plugin:
+ * Copyright (c) 2006 Eckhart P. <beryl@cornergraf.net>
+ * Copyright (c) 2006 Brian Jørgensen <qte@fundanemt.com>
+ * Maintained by Danny Baumann <maniac@opencompositing.org>
+ *
+ * Ported to Compiz by:
+ * Copyright (c) 2007 Sam Spilsbury <smspillaz@gmail.com>
+ *
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ **/
+
+/*
+ * Many thanks to Atie H. <atie.at.matrix@gmail.com> for providing
+ * a clean plugin template
+ * Also thanks to the folks from #beryl-dev, especially Quinn_Storm
+ * for helping me make this possible
+ */
+
+#include <math.h>
+
+#include <compiz-core.h>
+#include "star_options.h"
+
+#define GET_SNOW_DISPLAY(d) \
+ ((SnowDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
+
+#define SNOW_DISPLAY(d) \
+ SnowDisplay *sd = GET_SNOW_DISPLAY (d)
+
+#define GET_SNOW_SCREEN(s, sd) \
+ ((SnowScreen *) (s)->base.privates[(sd)->screenPrivateIndex].ptr)
+
+#define SNOW_SCREEN(s) \
+ SnowScreen *ss = GET_SNOW_SCREEN (s, GET_SNOW_DISPLAY (s->display))
+
+static int displayPrivateIndex = 0;
+
+/* ------------------- STRUCTS ----------------------------- */
+typedef struct _SnowDisplay
+{
+ int screenPrivateIndex;
+
+ Bool useTextures;
+
+ int snowTexNFiles;
+ CompOptionValue *snowTexFiles;
+} SnowDisplay;
+
+typedef struct _SnowTexture
+{
+ CompTexture tex;
+
+ unsigned int width;
+ unsigned int height;
+
+ Bool loaded;
+ GLuint dList;
+} SnowTexture;
+
+typedef struct _SnowFlake
+{
+ float x, y, z;
+ float xs, ys, zs;
+ float ra; /* rotation angle */
+ float rs; /* rotation speed */
+
+ SnowTexture *tex;
+} SnowFlake;
+
+typedef struct _SnowScreen
+{
+ CompScreen *s;
+
+ Bool active;
+
+ CompTimeoutHandle timeoutHandle;
+
+ PaintOutputProc paintOutput;
+ DrawWindowProc drawWindow;
+
+ SnowTexture *snowTex;
+ int snowTexturesLoaded;
+
+ GLuint displayList;
+ Bool displayListNeedsUpdate;
+
+ SnowFlake *allSnowFlakes;
+} SnowScreen;
+
+/* some forward declarations */
+static void initiateSnowFlake (SnowScreen * ss, SnowFlake * sf);
+static void snowMove (CompDisplay *d, SnowFlake * sf);
+
+int GetRand(int min, int max);
+int GetRand(int min, int max)
+{
+ return (rand() % (max - min + 1) + min);
+}
+
+float mmrand(int min, int max, float divisor);
+float mmrand(int min, int max, float divisor)
+{
+ return ((float)GetRand(min, max)) / divisor;
+};
+float bezierCurve(float p, float time);
+float bezierCurve(float p, float time) {
+ float out = p * (time+0.01) * 10;//(a*(i*i*i)) + (3.0*b*(i*i)*h) + (3.0*c*i*(h*h)) + (d*(h*h*h));
+ return out;
+}
+
+static void
+snowThink (SnowScreen *ss,
+ SnowFlake *sf)
+{
+ int boxing;
+
+ boxing = starGetScreenBoxing (ss->s->display);
+
+ if (sf->y >= ss->s->height + boxing ||
+ sf->x <= -boxing ||
+ sf->y >= ss->s->width + boxing ||
+ sf->z <= -((float) starGetScreenDepth (ss->s->display) / 500.0) ||
+ sf->z >= 1)
+ {
+ initiateSnowFlake (ss, sf);
+ }
+ snowMove (ss->s->display, sf);
+}
+
+static void
+snowMove (CompDisplay *d,
+ SnowFlake *sf)
+{
+ float tmp = 1.0f / (100.0f - starGetSnowSpeed (d));
+ int snowUpdateDelay = starGetSnowUpdateDelay (d);
+
+ float xs = bezierCurve(sf->xs, tmp);
+ float ys = bezierCurve(sf->ys, tmp);
+ float zs = bezierCurve(sf->zs, tmp);
+
+ sf->x += (float)(xs * (double)snowUpdateDelay) / (100 - (tmp + 0.5));
+ sf->y += (float)(ys * (double)snowUpdateDelay) / (100 - (tmp + 0.5));
+ sf->z += (float)(zs * (double)snowUpdateDelay) / (100 - (tmp + 0.5));
+
+}
+
+static Bool
+stepSnowPositions (void *closure)
+{
+ CompScreen *s = closure;
+ int i, numFlakes;
+ SnowFlake *snowFlake;
+ Bool onTop;
+
+ SNOW_SCREEN (s);
+
+ if (!ss->active)
+ return TRUE;
+
+ snowFlake = ss->allSnowFlakes;
+ numFlakes = starGetNumSnowflakes (s->display);
+ onTop = starGetSnowOverWindows (s->display);
+
+ for (i = 0; i < numFlakes; i++)
+ snowThink(ss, snowFlake++);
+
+ if (ss->active && !onTop)
+ {
+ CompWindow *w;
+
+ for (w = s->windows; w; w = w->next)
+ {
+ if (w->type & CompWindowTypeDesktopMask)
+ addWindowDamage (w);
+ }
+ }
+ else if (ss->active)
+ damageScreen (s);
+
+ return TRUE;
+}
+
+static Bool
+snowToggle (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed (option, nOption, "root", 0);
+ s = findScreenAtDisplay (d, xid);
+
+ if (s)
+ {
+ SNOW_SCREEN (s);
+ ss->active = !ss->active;
+ if (!ss->active)
+ damageScreen (s);
+ }
+
+ return TRUE;
+}
+
+/* -------------------- HELPER FUNCTIONS ------------------------ */
+
+/* --------------------------- RENDERING ------------------------- */
+static void
+setupDisplayList (SnowScreen *ss)
+{
+ float snowSize = starGetSnowSize (ss->s->display);
+
+ ss->displayList = glGenLists (1);
+
+ glNewList (ss->displayList, GL_COMPILE);
+ glBegin (GL_QUADS);
+
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+ glVertex3f (0, 0, -0.0);
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+ glVertex3f (0, snowSize, -0.0);
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+ glVertex3f (snowSize, snowSize, -0.0);
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+ glVertex3f (snowSize, 0, -0.0);
+
+ glEnd ();
+ glEndList ();
+}
+
+static void
+beginRendering (SnowScreen *ss,
+ CompScreen *s)
+{
+ if (starGetUseBlending (s->display))
+ glEnable (GL_BLEND);
+
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ if (ss->displayListNeedsUpdate)
+ {
+ setupDisplayList (ss);
+ ss->displayListNeedsUpdate = FALSE;
+ }
+
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+ if (ss->snowTexturesLoaded && starGetUseTextures (s->display))
+ {
+
+ int j = 0;
+
+ for (j = 0; j < ss->snowTexturesLoaded; j++)
+ {
+
+ int i, numFlakes = starGetNumSnowflakes (s->display);
+ SnowFlake *snowFlake = ss->allSnowFlakes;
+ enableTexture (ss->s, &ss->snowTex[j].tex, COMP_TEXTURE_FILTER_GOOD);
+
+ for (i = 0; i < numFlakes; i++)
+ {
+ if (snowFlake->tex == &ss->snowTex[j])
+ {
+ glTranslatef(snowFlake->x, snowFlake->y, snowFlake->z);
+ glCallList(ss->snowTex[j].dList);
+ glTranslatef(-snowFlake->x, -snowFlake->y, -snowFlake->z);
+ }
+ snowFlake++;
+ }
+ disableTexture (ss->s, &ss->snowTex[j].tex);
+ }
+ /*int j;
+
+ for (j = 0; j < ss->snowTexturesLoaded; j++)
+ {
+ SnowFlake *snowFlake = ss->allSnowFlakes;
+ int i, numFlakes = snowGetNumSnowflakes (s->display);
+ Bool snowRotate = snowGetSnowRotation (s->display);
+
+ enableTexture (ss->s, &ss->snowTex[j].tex,
+ COMP_TEXTURE_FILTER_GOOD);
+
+ for (i = 0; i < numFlakes; i++)
+ {
+ if (snowFlake->tex == &ss->snowTex[j])
+ {
+ glTranslatef (snowFlake->x, snowFlake->y, snowFlake->z);
+ if (snowRotate)
+ glRotatef (snowFlake->ra, 0, 0, 1);
+ glCallList (ss->snowTex[j].dList);
+ if (snowRotate)
+ glRotatef (-snowFlake->ra, 0, 0, 1);
+ glTranslatef (-snowFlake->x, -snowFlake->y, -snowFlake->z);
+ }
+ snowFlake++;
+ }
+ disableTexture (ss->s, &ss->snowTex[j].tex);
+ }*/
+ }
+ else
+ {
+ SnowFlake *snowFlake = ss->allSnowFlakes;
+ int i, numFlakes = starGetNumSnowflakes (s->display);
+
+ for (i = 0; i < numFlakes; i++)
+ {
+ glTranslatef (snowFlake->x, snowFlake->y, snowFlake->z);
+ glRotatef (snowFlake->ra, 0, 0, 1);
+ glCallList (ss->displayList);
+ glRotatef (-snowFlake->ra, 0, 0, 1);
+ glTranslatef (-snowFlake->x, -snowFlake->y, -snowFlake->z);
+ snowFlake++;
+ }
+ }
+
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ if (starGetUseBlending (s->display))
+ {
+ glDisable (GL_BLEND);
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+}
+
+/* ------------------------ FUNCTIONS -------------------- */
+
+static Bool
+snowPaintOutput (CompScreen *s,
+ const ScreenPaintAttrib *sa,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ Bool status;
+
+ SNOW_SCREEN (s);
+
+ if (ss->active && !starGetSnowOverWindows (s->display))
+ mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+
+ UNWRAP (ss, s, paintOutput);
+ status = (*s->paintOutput) (s, sa, transform, region, output, mask);
+ WRAP (ss, s, paintOutput, snowPaintOutput);
+
+ if (ss->active && starGetSnowOverWindows (s->display))
+ {
+ CompTransform sTransform = *transform;
+
+ transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
+
+ glPushMatrix ();
+ glLoadMatrixf (sTransform.m);
+ beginRendering (ss, s);
+ glPopMatrix ();
+ }
+
+ return status;
+}
+
+static Bool
+snowDrawWindow (CompWindow *w,
+ const CompTransform *transform,
+ const FragmentAttrib *attrib,
+ Region region,
+ unsigned int mask)
+{
+ Bool status;
+
+ SNOW_SCREEN (w->screen);
+
+ /* First draw Window as usual */
+ UNWRAP (ss, w->screen, drawWindow);
+ status = (*w->screen->drawWindow) (w, transform, attrib, region, mask);
+ WRAP (ss, w->screen, drawWindow, snowDrawWindow);
+
+ /* Check whether this is the Desktop Window */
+ if (ss->active && (w->type & CompWindowTypeDesktopMask) &&
+ !starGetSnowOverWindows (w->screen->display))
+ {
+ beginRendering (ss, w->screen);
+ }
+
+ return status;
+}
+
+static void
+initiateSnowFlake (SnowScreen *ss,
+ SnowFlake *sf)
+{
+ /* TODO: possibly place snowflakes based on FOV, instead of a cube. */
+ int boxing = starGetScreenBoxing (ss->s->display);
+ float init;
+
+ // speed of star
+ sf->xs = mmrand(-50000, 50000, 5000);
+ sf->ys = mmrand(-50000, 50000, 5000);
+ sf->zs = mmrand(000, 200, 2000);
+
+ //TODO: possibly place stars based on FOV, instead of a cube.
+ sf->x = ss->s->width * .5;
+ sf->y = ss->s->height * .5;
+ sf->z = mmrand(000, 0.1, 5000);
+ init = mmrand(0,100, 1); //init = distance to center of the screen
+
+ sf->x += init * sf->xs;
+ sf->y += init * sf->ys;
+
+ /* switch (snowGetSnowDirection (ss->s->display))
+ {
+ case SnowDirectionTopToBottom:
+ sf->x = mmRand (-boxing, ss->s->width + boxing, 1);
+ sf->xs = mmRand (-1, 1, 500);
+ sf->y = mmRand (-300, 0, 1);
+ sf->ys = mmRand (1, 3, 1);
+ break;
+ case SnowDirectionBottomToTop:
+ sf->x = mmRand (-boxing, ss->s->width + boxing, 1);
+ sf->xs = mmRand (-1, 1, 500);
+ sf->y = mmRand (ss->s->height, ss->s->height + 300, 1);
+ sf->ys = -mmRand (1, 3, 1);
+ break;
+ case SnowDirectionRightToLeft:
+ sf->x = mmRand (ss->s->width, ss->s->width + 300, 1);
+ sf->xs = -mmRand (1, 3, 1);
+ sf->y = mmRand (-boxing, ss->s->height + boxing, 1);
+ sf->ys = mmRand (-1, 1, 500);
+ break;
+ case SnowDirectionLeftToRight:
+ sf->x = mmRand (-300, 0, 1);
+ sf->xs = mmRand (1, 3, 1);
+ sf->y = mmRand (-boxing, ss->s->height + boxing, 1);
+ sf->ys = mmRand (-1, 1, 500);
+ break;
+ default:
+ break;
+ }
+
+ sf->z = mmRand (-snowGetScreenDepth (ss->s->display), 0.1, 5000);
+ sf->zs = mmRand (-1000, 1000, 500000);
+ sf->ra = mmRand (-1000, 1000, 50);
+ sf->rs = mmRand (-1000, 1000, 1000);*/
+}
+
+static void
+setSnowflakeTexture (SnowScreen *ss,
+ SnowFlake *sf)
+{
+ if (ss->snowTexturesLoaded)
+ sf->tex = &ss->snowTex[rand () % ss->snowTexturesLoaded];
+}
+
+static void
+updateSnowTextures (CompScreen *s)
+{
+ int i, count = 0;
+ float snowSize = starGetSnowSize(s->display);
+ int numFlakes = starGetNumSnowflakes(s->display);
+ SnowFlake *snowFlake;
+
+ SNOW_SCREEN (s);
+ SNOW_DISPLAY (s->display);
+
+ snowFlake = ss->allSnowFlakes;
+
+ for (i = 0; i < ss->snowTexturesLoaded; i++)
+ {
+ finiTexture (s, &ss->snowTex[i].tex);
+ glDeleteLists (ss->snowTex[i].dList, 1);
+ }
+
+ if (ss->snowTex)
+ free (ss->snowTex);
+ ss->snowTexturesLoaded = 0;
+
+ ss->snowTex = calloc (1, sizeof (SnowTexture) * sd->snowTexNFiles);
+
+ for (i = 0; i < sd->snowTexNFiles; i++)
+ {
+ CompMatrix *mat;
+ SnowTexture *sTex;
+
+ ss->snowTex[count].loaded =
+ readImageToTexture (s, &ss->snowTex[count].tex,
+ sd->snowTexFiles[i].s,
+ &ss->snowTex[count].width,
+ &ss->snowTex[count].height);
+ if (!ss->snowTex[count].loaded)
+ {
+ compLogMessage (s->display, "snow", CompLogLevelWarn,
+ "Texture not found : %s", sd->snowTexFiles[i].s);
+ continue;
+ }
+ compLogMessage (s->display, "snow", CompLogLevelInfo,
+ "Loaded Texture %s", sd->snowTexFiles[i].s);
+
+ mat = &ss->snowTex[count].tex.matrix;
+ sTex = &ss->snowTex[count];
+
+ sTex->dList = glGenLists (1);
+ glNewList (sTex->dList, GL_COMPILE);
+
+ glBegin (GL_QUADS);
+
+ glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0));
+ glVertex2f (0, 0);
+ glTexCoord2f (COMP_TEX_COORD_X (mat, 0),
+ COMP_TEX_COORD_Y (mat, sTex->height));
+ glVertex2f (0, snowSize * sTex->height / sTex->width);
+ glTexCoord2f (COMP_TEX_COORD_X (mat, sTex->width),
+ COMP_TEX_COORD_Y (mat, sTex->height));
+ glVertex2f (snowSize, snowSize * sTex->height / sTex->width);
+ glTexCoord2f (COMP_TEX_COORD_X (mat, sTex->width),
+ COMP_TEX_COORD_Y (mat, 0));
+ glVertex2f (snowSize, 0);
+
+ glEnd ();
+ glEndList ();
+
+ count++;
+ }
+
+ ss->snowTexturesLoaded = count;
+ if (count < sd->snowTexNFiles)
+ ss->snowTex = realloc (ss->snowTex, sizeof (SnowTexture) * count);
+
+ for (i = 0; i < numFlakes; i++)
+ setSnowflakeTexture (ss, snowFlake++);
+}
+
+static Bool
+snowInitScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ SnowScreen *ss;
+ int i, numFlakes = starGetNumSnowflakes (s->display);
+ SnowFlake *snowFlake;
+
+ SNOW_DISPLAY (s->display);
+
+ ss = calloc (1, sizeof(SnowScreen));
+
+ s->base.privates[sd->screenPrivateIndex].ptr = ss;
+
+ ss->s = s;
+ ss->snowTexturesLoaded = 0;
+ ss->snowTex = NULL;
+ ss->active = FALSE;
+ ss->displayListNeedsUpdate = FALSE;
+
+ ss->allSnowFlakes = snowFlake = malloc (numFlakes * sizeof (SnowFlake));
+
+ for (i = 0; i < numFlakes; i++)
+ {
+ initiateSnowFlake (ss, snowFlake);
+ setSnowflakeTexture (ss, snowFlake);
+ snowFlake++;
+ }
+
+ updateSnowTextures (s);
+ setupDisplayList (ss);
+
+ WRAP (ss, s, paintOutput, snowPaintOutput);
+ WRAP (ss, s, drawWindow, snowDrawWindow);
+
+ ss->timeoutHandle = compAddTimeout (starGetSnowUpdateDelay (s->display),
+ stepSnowPositions, s);
+
+ return TRUE;
+}
+
+static void
+snowFiniScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ int i;
+
+ SNOW_SCREEN (s);
+
+ if (ss->timeoutHandle)
+ compRemoveTimeout (ss->timeoutHandle);
+
+ for (i = 0; i < ss->snowTexturesLoaded; i++)
+ {
+ finiTexture (s, &ss->snowTex[i].tex);
+ glDeleteLists (ss->snowTex[i].dList, 1);
+ }
+
+ if (ss->snowTex)
+ free (ss->snowTex);
+
+ if (ss->allSnowFlakes)
+ free (ss->allSnowFlakes);
+
+ UNWRAP (ss, s, paintOutput);
+ UNWRAP (ss, s, drawWindow);
+
+ free (ss);
+}
+
+static void
+snowDisplayOptionChanged (CompDisplay *d,
+ CompOption *opt,
+ StarDisplayOptions num)
+{
+ SNOW_DISPLAY (d);
+
+ switch (num)
+ {
+ case StarDisplayOptionSnowSize:
+ {
+ CompScreen *s;
+
+ for (s = d->screens; s; s = s->next)
+ {
+ SNOW_SCREEN (s);
+ ss->displayListNeedsUpdate = TRUE;
+ updateSnowTextures (s);
+ }
+ }
+ break;
+ case StarDisplayOptionSnowUpdateDelay:
+ {
+ CompScreen *s;
+
+ for (s = d->screens; s; s = s->next)
+ {
+ SNOW_SCREEN (s);
+
+ if (ss->timeoutHandle)
+ compRemoveTimeout (ss->timeoutHandle);
+ ss->timeoutHandle =
+ compAddTimeout (starGetSnowUpdateDelay (d),
+ stepSnowPositions, s);
+ }
+ }
+ break;
+ case StarDisplayOptionNumSnowflakes:
+ {
+ CompScreen *s;
+ int i, numFlakes;
+ SnowFlake *snowFlake;
+
+ numFlakes = starGetNumSnowflakes (d);
+ for (s = d->screens; s; s = s->next)
+ {
+ SNOW_SCREEN (s);
+ ss->allSnowFlakes = realloc (ss->allSnowFlakes,
+ numFlakes * sizeof (SnowFlake));
+ snowFlake = ss->allSnowFlakes;
+
+ for (i = 0; i < numFlakes; i++)
+ {
+ initiateSnowFlake (ss, snowFlake);
+ setSnowflakeTexture (ss, snowFlake);
+ snowFlake++;
+ }
+ }
+ }
+ break;
+ case StarDisplayOptionSnowTextures:
+ {
+ CompScreen *s;
+ CompOption *texOpt;
+
+ texOpt = starGetSnowTexturesOption (d);
+
+ sd->snowTexFiles = texOpt->value.list.value;
+ sd->snowTexNFiles = texOpt->value.list.nValue;
+
+ for (s = d->screens; s; s = s->next)
+ updateSnowTextures (s);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static Bool
+snowInitDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ CompOption *texOpt;
+ SnowDisplay *sd;
+
+ if (!checkPluginABI ("core", CORE_ABIVERSION))
+ return FALSE;
+
+ sd = malloc (sizeof (SnowDisplay));
+
+ sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (sd->screenPrivateIndex < 0)
+ {
+ free (sd);
+ return FALSE;
+ }
+
+ starSetToggleKeyInitiate (d, snowToggle);
+ starSetNumSnowflakesNotify (d, snowDisplayOptionChanged);
+ starSetSnowSizeNotify (d, snowDisplayOptionChanged);
+ starSetSnowUpdateDelayNotify (d, snowDisplayOptionChanged);
+ starSetSnowTexturesNotify (d, snowDisplayOptionChanged);
+
+ texOpt = starGetSnowTexturesOption (d);
+ sd->snowTexFiles = texOpt->value.list.value;
+ sd->snowTexNFiles = texOpt->value.list.nValue;
+
+ d->base.privates[displayPrivateIndex].ptr = sd;
+
+ return TRUE;
+}
+
+static void
+snowFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ SNOW_DISPLAY (d);
+
+ freeScreenPrivateIndex (d, sd->screenPrivateIndex);
+ free (sd);
+}
+
+static CompBool
+snowInitObject (CompPlugin *p,
+ CompObject *o)
+{
+ static InitPluginObjectProc dispTab[] = {
+ (InitPluginObjectProc) 0, /* InitCore */
+ (InitPluginObjectProc) snowInitDisplay,
+ (InitPluginObjectProc) snowInitScreen
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
+}
+
+static void
+snowFiniObject (CompPlugin *p,
+ CompObject *o)
+{
+ static FiniPluginObjectProc dispTab[] = {
+ (FiniPluginObjectProc) 0, /* FiniCore */
+ (FiniPluginObjectProc) snowFiniDisplay,
+ (FiniPluginObjectProc) snowFiniScreen
+ };
+
+ DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
+}
+
+static Bool
+snowInit (CompPlugin *p)
+{
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+snowFini (CompPlugin *p)
+{
+ freeDisplayPrivateIndex (displayPrivateIndex);
+}
+
+CompPluginVTable snowVTable = {
+ "star",
+ 0,
+ snowInit,
+ snowFini,
+ snowInitObject,
+ snowFiniObject,
+ 0,
+ 0
+};
+
+CompPluginVTable*
+getCompPluginInfo (void)
+{
+ return &snowVTable;
+}
diff --git a/star.xml.in b/star.xml.in
new file mode 100644
index 0000000..ce1dad8
--- /dev/null
+++ b/star.xml.in
@@ -0,0 +1,130 @@
+<?xml version="1.0"?>
+<compiz>
+ <plugin name="star" useBcop="true">
+ <_short>Stars</_short>
+ <_long>Stars for Compiz</_long>
+ <category>Extras</category>
+ <deps>
+ <relation type="after">
+ <plugin>png</plugin>
+ <plugin>svg</plugin>
+ <plugin>jpeg</plugin>
+ </relation>
+ </deps>
+ <display>
+ <group>
+ <_short>Settings</_short>
+ <option name="num_snowflakes" type="int">
+ <_short>Number Of Stars</_short>
+ <_long>Maximum number of stars</_long>
+ <default>100</default>
+ <min>0</min>
+ <max>10000</max>
+ </option>
+ <option name="snow_size" type="float">
+ <_short>Size Of Stars</_short>
+ <_long>Size of stars</_long>
+ <default>5.0</default>
+ <min>0.0</min>
+ <max>50.0</max>
+ <precision>0.1</precision>
+ </option>
+ <option name="snow_speed" type="int">
+ <_short>Star Speed</_short>
+ <_long>Speed of travelling stars</_long>
+ <default>85</default>
+ <min>0</min>
+ <max>100</max>
+ </option>
+ <option name="snow_update_delay" type="int">
+ <_short>Update Delay</_short>
+ <_long>Delay (in ms) between screen updates. Decreasing this value may make snow fall more smoothly, but will also increase CPU usage.</_long>
+ <default>40</default>
+ <min>10</min>
+ <max>200</max>
+ </option>
+ <option name="screen_boxing" type="int">
+ <_short>Screen Boxing</_short>
+ <_long>How far outside the screen resolution stars can be before being removed. Needed because of FOV.</_long>
+ <default>400</default>
+ <min>-2000</min>
+ <max>2000</max>
+ </option>
+ <option name="screen_depth" type="int">
+ <_short>Screen Depth</_short>
+ <_long>How deep into the screen stars can be drawn before being removed</_long>
+ <default>1000</default>
+ <min>0</min>
+ <max>2000</max>
+ </option>
+ <option name="snow_over_windows" type="bool">
+ <_short>Stars Over Windows</_short>
+ <_long>Stars are drawn above windows</_long>
+ <default>false</default>
+ </option>
+ <option name="snow_rotation" type="bool">
+ <_short>Rotate Flakes. Redundant</_short>
+ <_long>Flakes rotate if checked.</_long>
+ <default>true</default>
+ </option>
+ <option name="snow_direction" type="int">
+ <_short>Snow Direction. Redundant</_short>
+ <_long>Select snow flake movement direction</_long>
+ <default>0</default>
+ <min>0</min>
+ <max>3</max>
+ <desc>
+ <value>0</value>
+ <_name>Top to Bottom</_name>
+ </desc>
+ <desc>
+ <value>1</value>
+ <_name>Bottom to Top</_name>
+ </desc>
+ <desc>
+ <value>2</value>
+ <_name>Right to Left</_name>
+ </desc>
+ <desc>
+ <value>3</value>
+ <_name>Left to Right</_name>
+ </desc>
+ </option>
+ </group>
+ <group>
+ <_short>Textures</_short>
+ <option name="snow_textures" type="list">
+ <_short>Stars Textures</_short>
+ <_long>Images to use as 'stars'</_long>
+ <hints>file;image;</hints>
+ <type>string</type>
+ <default>
+ <value>star.png</value>
+ </default>
+ </option>
+ </group>
+ <group>
+ <_short>Debug</_short>
+ <option name="use_blending" type="bool">
+ <_short>Enable Blending</_short>
+ <_long>Enables alpha blending of snowflakes.</_long>
+ <default>true</default>
+ </option>
+ <option name="use_textures" type="bool">
+ <_short>Enable Textures</_short>
+ <_long>Enables textures snowflakes. If not selected, color gradients are used.</_long>
+ <default>true</default>
+ </option>
+ </group>
+ <group>
+ <_short>Key Bindings</_short>
+ <option name="toggle_key" type="key">
+ <_short>Stars Toggle</_short>
+ <_long>Stars toggle key</_long>
+ <default>&lt;Super&gt;F3</default>
+ </option>
+ </group>
+ </display>
+ </plugin>
+</compiz>
+