summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-07-23 13:43:37 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-07-23 13:43:37 +0800
commit32a5e3b5c743d836d0b96752353c8df20b69d539 (patch)
treedd43fd4bd23431da2912ddae30976d1a653a974a
parente5add1cb3346070f89f13e885b0220bb0ee07b29 (diff)
downloadscreensaver-32a5e3b5c743d836d0b96752353c8df20b69d539.tar.gz
screensaver-32a5e3b5c743d836d0b96752353c8df20b69d539.tar.bz2
Initial C++ port. Currently supports "rotating cube" mode. Screen Saver mode
untested
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--effect.cpp57
-rw-r--r--effect.h41
-rw-r--r--flyingwindows.cpp380
-rw-r--r--flyingwindows.h87
-rw-r--r--matrix.cpp57
-rw-r--r--matrix.h59
-rw-r--r--plugin.info3
-rw-r--r--rotatingcube.cpp109
-rw-r--r--rotatingcube.h27
-rw-r--r--screensaver.cpp450
-rw-r--r--screensaver.xml.in8
-rw-r--r--screensaver_internal.h124
-rw-r--r--vector.cpp14
-rw-r--r--vector.h159
-rw-r--r--wrapper.cpp89
-rw-r--r--wrapper.h55
18 files changed, 6 insertions, 2252 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c682493..da86b2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
-compiz_fusion_plugin (screensaver PKGDEPS xscrnsaver)
+include (CompizPlugin)
+
+compiz_plugin (screensaver PLUGINDEPS composite opengl cube PKGDEPS xscrnsaver)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 543c5f8..0000000
--- a/Makefile
+++ /dev/null
@@ -1,533 +0,0 @@
-##
-#
-# Compiz plugin Makefile
-#
-# Copyright : (C) 2007 by Dennis Kasprzyk
-# E-mail : onestone@deltatauchi.de
-#
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-##
-
-# plugin.info file contents
-#
-# PLUGIN = foo
-# PKG_DEP = pango
-# LDFLAGS_ADD = -lGLU
-# CFLAGS_ADD = -I/usr/include/foo
-# CHK_HEADERS = compiz-cube.h
-#
-
-#load config file
-
-ECHO = `which echo`
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-ifeq ($(shell if [ -f plugin.info ]; then $(ECHO) -n "found"; fi ),found)
-include plugin.info
-else
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\033[1;31m[ERROR]\033[0m \"plugin.info\" file not found"; \
- else \
- $(ECHO) "[ERROR] \"plugin.info\" file not found"; \
- fi;))
-endif
-
-ifneq ($(shell if pkg-config --exists compiz; then $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m Compiz not installed"; \
- else \
- $(ECHO) -n "[ERROR] Compiz not installed"; \
- fi))
-endif
-
-
-ifneq ($(shell if [ -n "$(PKG_DEP)" ]; then if pkg-config --exists $(PKG_DEP); then $(ECHO) -n "found"; fi; \
- else $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m "; \
- else \
- $(ECHO) -n "[ERROR] "; \
- fi; \
- pkg-config --print-errors --short-errors --errors-to-stdout $(PKG_DEP); ))
-endif
-
-
-ifeq ($(BUILD_GLOBAL),true)
- PREFIX = $(shell pkg-config --variable=prefix compiz)
- CLIBDIR = $(shell pkg-config --variable=libdir compiz)
- CINCDIR = $(shell pkg-config --variable=includedir compiz)
- PKGDIR = $(CLIBDIR)/pkgconfig
- DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz
- XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
-else
- DESTDIR = $(HOME)/.compiz/plugins
- XMLDIR = $(HOME)/.compiz/metadata
- IMAGEDIR = $(HOME)/.compiz/images
- DATADIR = $(HOME)/.compiz/data
-endif
-
-BUILDDIR = build
-
-CC = gcc
-CPP = g++
-LIBTOOL = libtool
-INSTALL = install
-
-BCOP = `pkg-config --variable=bin bcop`
-
-CFLAGS = -g -Wall -Wpointer-arith -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); \
- 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; \
- 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"; \
- 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; \
- FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- 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 "$(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/effect.cpp b/effect.cpp
deleted file mode 100644
index a06fcf8..0000000
--- a/effect.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "effect.h"
-
-
-#define sigmoid(x) (1.0f/(1.0f+exp(-5.5f*2*((x)-0.5))))
-#define sigmoidProgress(x) ((sigmoid(x) - sigmoid(0)) / \
- (sigmoid(1) - sigmoid(0)))
-
-DisplayEffect::DisplayEffect( CompDisplay* w ) :
- DisplayWrapper(w),
- cleanEffect(false),
- loadEffect(false)
-{}
-
-bool ScreenEffect::enable()
-{
- progress = 0.0;
- return true;
-}
-
-void ScreenEffect::preparePaintScreen( int msSinceLastPaint )
-{
- SCREENSAVER_DISPLAY( s->display );
- if( sd->state.running )
- {
- if( sd->state.fadingIn )
- {
- float fadeDuration = screensaverGetFadeInDuration(s->display)*1000.0;
- progress = sigmoidProgress(((float)ss->time)/fadeDuration);
- ss->time += msSinceLastPaint;
- if( ss->time >= fadeDuration )
- {
- if( screensaverGetStartAutomatically(s->display) )
- XActivateScreenSaver(s->display->display);
- sd->state.fadingIn = FALSE;
- ss->time = 0;
- }
- }
-
- else if( sd->state.fadingOut )
- {
- float fadeDuration = screensaverGetFadeOutDuration(s->display)*1000.0;
- progress = sigmoidProgress( ((float)ss->time)/fadeDuration );
- ss->time += msSinceLastPaint;
- if( ss->time >= fadeDuration )
- {
- clean();
- sd->effect->cleanEffect = true;
- sd->state.running = FALSE;
- damageScreen(s);
- }
- }
-
- else progress = 1.0;
- }
-
- ScreenWrapper::preparePaintScreen( msSinceLastPaint );
-}
diff --git a/effect.h b/effect.h
deleted file mode 100644
index f7999b9..0000000
--- a/effect.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef EFFECT_H
-#define EFFECT_H
-
-#include "screensaver_internal.h"
-
-class DisplayEffect : public DisplayWrapper
-{
-public:
- DisplayEffect( CompDisplay* w );
- virtual ~DisplayEffect() {}
-
- bool cleanEffect;
- bool loadEffect;
-};
-
-class ScreenEffect : public ScreenWrapper
-{
-public:
- ScreenEffect( CompScreen* s ) : ScreenWrapper(s), progress(0) {}
- virtual ~ScreenEffect() {}
- float getProgress() { return progress; }
-
- virtual bool enable();
- virtual void disable() {}
- virtual void preparePaintScreen( int msSinceLastPaint );
-
-protected:
- virtual void clean() {}
-
-private:
- float progress;
-};
-
-class WindowEffect : public WindowWrapper
-{
-public:
- WindowEffect( CompWindow* w ) : WindowWrapper(w) {}
- virtual ~WindowEffect() {}
-};
-
-#endif
diff --git a/flyingwindows.cpp b/flyingwindows.cpp
deleted file mode 100644
index bc18b3a..0000000
--- a/flyingwindows.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-#include "flyingwindows.h"
-
-
-#define NE 0
-#define NO 1
-#define SE 2
-#define SO 3
-#define C 4
-
-void DisplayFlyingWindows::handleEvent( XEvent *event )
-{
- DisplayEffect::handleEvent( event );
- if( event->type == MapNotify )
- {
- CompWindow* w = findWindowAtDisplay( d, event->xmap.window );
- if(w)
- WindowFlyingWindows::getInstance(w).initWindow();
- }
-}
-
-bool ScreenFlyingWindows::enable()
-{
- ss->angleCam = 0.0;
- ss->screenCenter = Vector( 0.0, screensaverGetBounce(s->display) ? 0.2 : 0.0,\
- -screensaverGetAttractionDepth(s->display) );
- ss->camera = Matrix::identity;
- ss->desktopOpacity = OPAQUE;
-
- for( CompWindow* w = s->windows; w; w=w->next )
- WindowFlyingWindows::getInstance(w).initWindow();
-
- return ScreenEffect::enable();
-}
-
-void ScreenFlyingWindows::disable()
-{
- for( CompWindow* w = s->windows; w; w=w->next )
- {
- WindowFlyingWindows& sw = WindowFlyingWindows::getInstance(w);
- if( sw.active )
- sw.transformFadeOut = ss->cameraMat * sw.transform;
-
- else sw.opacityFadeOut = sw.opacity;
- }
- ss->cameraMat = Matrix::identity;
- ScreenEffect::disable();
-}
-
-void ScreenFlyingWindows::addForce( const Point& p1, const Point& p2, const Point& center, Vector& resultante, Vector& couple, float w, Bool attract )
-{
- Vector u = p2 - p1;
- float d = u.norm();
- u.normalize();
-
- if( d < 1e-5 ) d = 1e-5;
-
- Vector force = attract ? w*u*d*d : -w*u/(d*d);
- resultante += force;
-
- couple += ( center - p1 ) ^ force;
-}
-
-void ScreenFlyingWindows::preparePaintScreen( int msSinceLastPaint )
-{
- ScreenEffect::preparePaintScreen( msSinceLastPaint );
-
- float ratio = screensaverGetAttractionRepulsionRatio(s->display)/100.0;
- float wAt = ratio;
- float wRt = 1-ratio;
-
- SCREENSAVER_DISPLAY(s->display);
-
- if( sd->state.fadingIn )
- {
- wAt *= getProgress();
- wRt *= getProgress();
-
- ss->desktopOpacity = (GLushort)( OPAQUE * ( 1.0 - getProgress() ));
- }
-
- if( sd->state.fadingOut )
- {
- ss->desktopOpacity = (GLushort)(OPAQUE * getProgress());
- }
-
- if( !sd->state.fadingOut )
- {
- ss->angleCam += ((float)msSinceLastPaint)/100000.0;
- if( ss->angleCam > 0.03 ) ss->angleCam=0.03;
-
- ss->camera.rotate( ss->angleCam*msSinceLastPaint, 0.0, 1.0, 0.0 );
-
- Matrix centerTrans = Matrix::identity;
- Matrix centerTransInv = Matrix::identity;
-
- Vector screenCenterTranslated = ss->screenCenter.toCoordsSpace(s);
- screenCenterTranslated[z] *= s->width;
-
- centerTrans.scale( 1.0, 1.0, 1.0 / s->width);
- centerTrans.translate( screenCenterTranslated );
- centerTransInv.translate( -screenCenterTranslated );
- centerTransInv.scale( 1.0, 1.0, 1.0 * s->width);
-
- ss->cameraMat = centerTrans * ss->camera * centerTransInv;
- }
-
- for ( CompWindow* w = s->windows; w; w = w->next)
- {
- WindowFlyingWindows& sw = WindowFlyingWindows::getInstance(w);
-
- if( sw.active )
- {
- if( sd->state.fadingOut )
- sw.transform = interpolate( sw.transformFadeOut, Matrix::identity, getProgress() );
-
- else
- {
- int collisionVertex = -1;
- int collisionIteration = 1;
- Vector a, p, o, omega;
- do
- {
- Vector resultante, couple, resultanteA, coupleA;
- resultante = couple = resultanteA = coupleA = Vector::null;
- Vector windowcenter = sw.vertex[C];
- float mass = sqrt(((float)(WIN_W(w)*WIN_H(w)))/(w->screen->width*w->screen->height));
-
- float wR = 1e-8/mass*wRt;
- float wA = 1e-8/mass*wAt;
-
- int numPoint = 0;
- for( int i = 0; i<5; i++)
- {
- for( CompWindow* w2 = w->screen->windows; w2; w2=w2->next )
- {
- WindowFlyingWindows& sw2 = WindowFlyingWindows::getInstance(w2);
- if( w2 != w && sw2.active )
- {
- numPoint++;
- for( int j = 0; j<5; j++)
- addForce( sw.vertex[i], sw2.vertex[j], windowcenter, resultante, couple, wR, FALSE );
- }
- }
- addForce( sw.vertex[i], ss->screenCenter, windowcenter, resultanteA, coupleA, wA, TRUE );
- }
-
- if( numPoint < 1 )
- numPoint = 1;
-
- resultante += resultanteA*numPoint;
- couple += coupleA*numPoint;
-
- if( collisionVertex != -1 )
- {
- float wb = sw.vertex[collisionVertex][y]/msSinceLastPaint*5e-4;
- resultante[y] = -wb;
- float tmp = couple[z];
- couple = (sw.vertex[collisionVertex]-windowcenter) ^ Vector( 0.0, -wb, 0.0 );
- couple[z] = tmp;
- sw.speed[y] = 0;
- }
-
- a = resultante - 5e-4*mass*sw.speed;
- omega = couple*1000 - 5e-3*mass*sw.speedrot;
-
- p = msSinceLastPaint*msSinceLastPaint*a+msSinceLastPaint*sw.speed;
- sw.speed += msSinceLastPaint*a;
-
- o = msSinceLastPaint*msSinceLastPaint*omega+msSinceLastPaint*sw.speedrot;
- sw.speedrot += msSinceLastPaint*omega;
-
- sw.transformTrans.translate( p[x]*s->width, -p[y]*s->height, p[z] );
- sw.transformRot.rotate( o.norm(), o );
-
- sw.transform = sw.transformTrans * sw.centerTrans * sw.transformRot * sw.centerTransInv;
-
- sw.recalcVertices();
-
- if ( screensaverGetBounce(s->display) )
- {
- for( int i = 0; i < 4; i++ )
- if( sw.vertex[i][y] < -0.5 )
- collisionVertex = i;
- }
-
- } while ( collisionVertex != -1 && collisionIteration-- );
- }
- }
- else
- {
- if( sd->state.fadingOut )
- {
- sw.opacity = (GLushort)( sw.opacityOld*getProgress() + sw.opacityFadeOut*(1-getProgress()) );
- }
- else
- sw.steps = (int)( (msSinceLastPaint * OPAQUE) / (screensaverGetFadeInDuration(s->display)*1000.0) );
- }
- }
-}
-
-void ScreenFlyingWindows::donePaintScreen()
-{
- damageScreen(s);
- ScreenEffect::donePaintScreen();
-}
-
-void ScreenFlyingWindows::paintScreen (CompOutput *outputs,
- int numOutputs,
- unsigned int mask)
-{
- outputs = &s->fullscreenOutput;
- numOutputs = 1;
-
- ScreenEffect::paintScreen (outputs, numOutputs, mask);
-}
-
-Bool ScreenFlyingWindows::paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask)
-{
- clearTargetOutput (s->display, GL_COLOR_BUFFER_BIT);
- return ScreenEffect::paintOutput( sAttrib, transform, region, output, mask | PAINT_SCREEN_TRANSFORMED_MASK );
-}
-
-void ScreenFlyingWindows::paintTransformedOutput( const ScreenPaintAttrib* sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput *output, unsigned int mask )
-{
- Bool wasCulled = glIsEnabled (GL_CULL_FACE);
- if (wasCulled)
- glDisable (GL_CULL_FACE);
-
- int oldFilter = s->display->textureFilter;
- if( screensaverGetMipmaps(s->display) )
- s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
-
-
- mask &= ~PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
-
- GLboolean bTwoSite;
- glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &bTwoSite );
- glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, s->lighting);
-
- ScreenEffect::paintTransformedOutput ( sAttrib, transform, &s->region,
- output, mask );
-
- glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, bTwoSite);
-
- s->filter[SCREEN_TRANS_FILTER] = oldFilter;
- s->display->textureFilter = oldFilter;
-
- if (wasCulled)
- glEnable (GL_CULL_FACE);
-}
-
-WindowFlyingWindows::WindowFlyingWindows( CompWindow* w ) :
- WindowEffect(w),
- active( FALSE ),
- opacity( w->paint.opacity ),
- opacityFadeOut( 0 ),
- opacityOld( 0 ),
- steps(0)
-{
-
-}
-
-// Returns true if w is a flying window
-bool WindowFlyingWindows::isActiveWin()
-{
- return !w->attrib.override_redirect && \
- w->mapNum && \
- w->attrib.map_state == IsViewable && \
- !( w->wmType & ( CompWindowTypeDockMask | CompWindowTypeDesktopMask )) && \
- /* !( w->state & ( CompWindowStateSkipPagerMask | CompWindowStateShadedMask )) && \*/
- matchEval (screensaverGetWindowMatch (w->screen->display), w);
-}
-
-// Initialize window transformation matrices and vertices
-void WindowFlyingWindows::initWindow()
-{
- CompScreen* s = this->w->screen;
-
- active = isActiveWin();
- if( active )
- {
- float x = WIN_X(this->w);
- float y = WIN_Y(this->w);
- float w = WIN_W(this->w);
- float h = WIN_H(this->w);
-
- transform = transformRot = transformTrans = Matrix::identity;
- centerTrans = centerTransInv = Matrix::identity;
-
- centerTrans.scale( 1.0, 1.0, 1.0/s->width );
- centerTrans.translate( x + w/2.0, y + h/2.0, 0.0 );
- centerTransInv.translate( -(x + w/2.0), -(y + h/2.0), 0.0);
- centerTransInv.scale( 1.0f, 1.0f, 1.0f*s->width );
-
- recalcVertices();
- speed = speedrot = Vector::null;
- }
- else opacityOld = opacity;
-}
-
-// Update window vertices
-void WindowFlyingWindows::recalcVertices()
-{
- float x = WIN_X(this->w);
- float y = WIN_Y(this->w);
- float w = WIN_W(this->w);
- float h = WIN_H(this->w);
-
- vertex[NO] = Point( x, y, 0.0 );
- vertex[NE] = Point( x + w, y, 0.0 );
- vertex[SO] = Point( x, y + h, 0.0 );
- vertex[SE] = Point( x + w, y + h, 0.0 );
- vertex[C] = Point( x + w/2.0, y + h/2.0, 0.0 );
-
- // Apply the window transformation and normalize
- for( int i = 0; i < 5; i++ )
- vertex[i] = ( transform * vertex[i] ).toScreenSpace(this->w->screen);
-}
-
-Bool WindowFlyingWindows::paintWindow( const WindowPaintAttrib* attrib, \
- const CompTransform* transform, Region region, unsigned int mask)
-{
- WindowPaintAttrib sAttrib = *attrib;
- Matrix wTransform;
-
- if( !active )
- {
- SCREENSAVER_DISPLAY(w->screen->display);
-
- if( opacity && steps && !sd->state.fadingOut )
- {
- if( opacity < steps )
- opacity = 0;
- else opacity -= steps;
- steps = 0;
- }
-
- sAttrib.opacity = opacity;
- wTransform = transform;
- }
- else
- {
- SCREENSAVER_SCREEN( w->screen );
- wTransform = transform * ss->cameraMat * this->transform;
- mask |= PAINT_WINDOW_TRANSFORMED_MASK;
-
- if( w->state & CompWindowStateSkipPagerMask )
- return WindowEffect::paintWindow( attrib, (CompTransform*)wTransform.m, region, mask );
- }
-
- if (w->alpha || sAttrib.opacity != OPAQUE)
- mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
-
- // from paint.c
- if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
- {
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- return FALSE;
- if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
- return FALSE;
- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
- return FALSE;
- if (w->shaded)
- return FALSE;
- return TRUE;
- }
-
- FragmentAttrib fragment;
- initFragmentAttrib (&fragment, &sAttrib);
-
- glPushMatrix();
- glLoadMatrixf( wTransform.m );
- bool status = w->screen->drawWindow( w, (CompTransform*)wTransform.m, &fragment, region, mask );
- glPopMatrix();
- return status;
-}
diff --git a/flyingwindows.h b/flyingwindows.h
deleted file mode 100644
index de6ac0c..0000000
--- a/flyingwindows.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef FLYINGWINDOWS_H
-#define FLYINGWINDOWS_H
-
-#include "screensaver_internal.h"
-
-class DisplayFlyingWindows : public DisplayEffect
-{
-public:
- DisplayFlyingWindows( CompDisplay* d ) : DisplayEffect(d) {}
- virtual ~DisplayFlyingWindows() {}
-
- virtual void handleEvent( XEvent *event );
-};
-
-class ScreenFlyingWindows : public ScreenEffect
-{
-public:
- ScreenFlyingWindows( CompScreen* s ) : ScreenEffect(s) {}
- virtual ~ScreenFlyingWindows() {}
-
- virtual bool enable();
- virtual void disable();
- virtual void preparePaintScreen( int msSinceLastPaint );
- virtual void donePaintScreen();
- virtual void paintScreen (CompOutput *outputs,
- int numOutputs,
- unsigned int mask);
- virtual Bool paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask);
- virtual void paintTransformedOutput( const ScreenPaintAttrib* sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput *output, unsigned int mask);
-private:
- void initWindow( CompWindow* _w );
- void recalcVertices( CompWindow* _w );
- void addForce( const Point& p1, const Point& p2, const Point& center, Vector& resultante, Vector& couple, float w, Bool attract );
-};
-
-class WindowFlyingWindows : public WindowEffect
-{
- friend class ScreenFlyingWindows;
-
-public:
- WindowFlyingWindows( CompWindow* w );
- virtual ~WindowFlyingWindows() {}
- void initWindow();
- virtual Bool paintWindow( const WindowPaintAttrib* attrib, \
- const CompTransform* transform, Region region, unsigned int mask);
- void recalcVertices();
-
- static WindowFlyingWindows& getInstance( CompWindow* w )
- { SCREENSAVER_WINDOW(w); return ( WindowFlyingWindows& )( *sw->effect ); }
-
-private:
- bool isActiveWin();
-
- // isScreenSaverWin()
- bool active;
-
- // used for non-active window like the desktop
- GLushort opacity;
- GLushort opacityFadeOut;
- GLushort opacityOld;
- int steps;
-
- // used for active window
- // translate matrix
- Matrix transformTrans;
-
- // rotation matrix
- Matrix centerTrans, transformRot, centerTransInv;
-
- // precomputed transform matrix
- Matrix transform;
-
- Matrix transformFadeOut;
-
- // 5 normalized vertices are stored, the four corners and the center
- Point vertex[5];
-
- // normalized speed vectors
- Vector speed;
- Vector speedrot;
-};
-
-#endif
diff --git a/matrix.cpp b/matrix.cpp
deleted file mode 100644
index d660967..0000000
--- a/matrix.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "matrix.h"
-
-static const float _identity[16] = {
- 1.0, 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0
-};
-
-const Matrix Matrix::identity = _identity;
-
-Matrix operator*( const Matrix& lhs, const Matrix& rhs )
-{
- Matrix res;
- res[0] = lhs[0] * rhs[0] + lhs[4] * rhs[1] + lhs[8] * rhs[2] + lhs[12] * rhs[3];
- res[1] = lhs[1] * rhs[0] + lhs[5] * rhs[1] + lhs[9] * rhs[2] + lhs[13] * rhs[3];
- res[2] = lhs[2] * rhs[0] + lhs[6] * rhs[1] + lhs[10] * rhs[2] + lhs[14] * rhs[3];
- res[3] = lhs[3] * rhs[0] + lhs[7] * rhs[1] + lhs[11] * rhs[2] + lhs[15] * rhs[3];
- res[4] = lhs[0] * rhs[4] + lhs[4] * rhs[5] + lhs[8] * rhs[6] + lhs[12] * rhs[7];
- res[5] = lhs[1] * rhs[4] + lhs[5] * rhs[5] + lhs[9] * rhs[6] + lhs[13] * rhs[7];
- res[6] = lhs[2] * rhs[4] + lhs[6] * rhs[5] + lhs[10] * rhs[6] + lhs[14] * rhs[7];
- res[7] = lhs[3] * rhs[4] + lhs[7] * rhs[5] + lhs[11] * rhs[6] + lhs[15] * rhs[7];
- res[8] = lhs[0] * rhs[8] + lhs[4] * rhs[9] + lhs[8] * rhs[10] + lhs[12] * rhs[11];
- res[9] = lhs[1] * rhs[8] + lhs[5] * rhs[9] + lhs[9] * rhs[10] + lhs[13] * rhs[11];
- res[10] = lhs[2] * rhs[8] + lhs[6] * rhs[9] + lhs[10] * rhs[10] + lhs[14] * rhs[11];
- res[11] = lhs[3] * rhs[8] + lhs[7] * rhs[9] + lhs[11] * rhs[10] + lhs[15] * rhs[11];
- res[12] = lhs[0] * rhs[12] + lhs[4] * rhs[13] + lhs[8] * rhs[14] + lhs[12] * rhs[15];
- res[13] = lhs[1] * rhs[12] + lhs[5] * rhs[13] + lhs[9] * rhs[14] + lhs[13] * rhs[15];
- res[14] = lhs[2] * rhs[12] + lhs[6] * rhs[13] + lhs[10] * rhs[14] + lhs[14] * rhs[15];
- res[15] = lhs[3] * rhs[12] + lhs[7] * rhs[13] + lhs[11] * rhs[14] + lhs[15] * rhs[15];
-
- return res;
-}
-
-Vector operator*( const Matrix& mat, const Vector& vect )
-{
- Vector res;
-
- res[0] = mat[0] * vect[0] + mat[4] * vect[1] + mat[8] * vect[2] + mat[12];
- res[1] = mat[1] * vect[0] + mat[5] * vect[1] + mat[9] * vect[2] + mat[13];
- res[2] = mat[2] * vect[0] + mat[6] * vect[1] + mat[10] * vect[2] + mat[14];
- float w = mat[3] * vect[0] + mat[7] * vect[1] + mat[11] * vect[2] + mat[15];
-
- res[0] /= w;
- res[1] /= w;
- res[2] /= w;
-
- return res;
-}
-
-Matrix interpolate( const Matrix& from, const Matrix& to, float position )
-{
- Matrix res;
- for( int i = 0; i < 16; i++ )
- res[i] = from[i] * (1 - position) + to[i] * position;
- return res;
-}
diff --git a/matrix.h b/matrix.h
deleted file mode 100644
index 183f6d9..0000000
--- a/matrix.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef MATRIX_H
-#define MATRIX_H
-
-#include <string.h>
-#include <compiz-core.h>
-#include "vector.h"
-
-class Matrix
-{
-public:
- static const Matrix identity;
-
- Matrix() {
- for (int i=0; i<16;i++) {
- m[i] = 0;
- }
- }
-
- Matrix( const CompTransform* mat ) { memcpy( m, mat->m, sizeof(m) ); }
- Matrix( const Matrix& mat ) { memcpy( m, mat.m, sizeof(m) ); }
- Matrix( const float* mat ) { memcpy( m, mat, sizeof(m) ); }
-
- const float& operator[]( int i ) const { return m[i]; }
- float& operator[]( int i ) { return m[i]; }
-
- Matrix& operator*=( const Matrix& rhs ) { Matrix res; *this = *this * rhs; return *this; }
- friend Matrix operator*( const Matrix& lhs, const Matrix& rhs );
- friend Vector operator*( const Matrix& mat, const Vector& vect );
-
- friend Matrix interpolate( const Matrix& from, const Matrix& to, float position );
-
- Matrix& rotate( float angle, float x, float y, float z )
- {
- matrixRotate( (CompTransform*)m, angle, x, y, z );
- return *this;
- }
-
- Matrix& rotate( float angle, const Vector& vect ) { return rotate( angle, vect[x], vect[y], vect[z] ); }
-
- Matrix& scale( float x, float y, float z )
- {
- matrixScale( (CompTransform*)m, x, y, z );
- return *this;
- }
-
- Matrix& scale( const Vector& vect ) { return scale( vect[x], vect[y], vect[z] ); }
-
- Matrix& translate( float x, float y, float z )
- {
- matrixTranslate( (CompTransform*)m, x, y, z );
- return *this;
- }
-
- Matrix& translate( const Vector& vect ) { return translate( vect[x], vect[y], vect[z] ); }
-
- float m[16];
-};
-
-#endif
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index ac04db3..0000000
--- a/plugin.info
+++ /dev/null
@@ -1,3 +0,0 @@
-PKG_DEP = xscrnsaver
-PLUGIN = screensaver
-LDFLAGS_ADD = -lstdc++
diff --git a/rotatingcube.cpp b/rotatingcube.cpp
deleted file mode 100644
index 9ba891a..0000000
--- a/rotatingcube.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "rotatingcube.h"
-
-bool ScreenRotatingCube::loadCubePlugin()
-{
- CompDisplay* d = s->display;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return false;
-
- if (!checkPluginABI ("cube", CUBE_ABIVERSION))
- return false;
-
- if (!getPluginDisplayIndex (d, "cube", &cubeDisplayPrivateIndex))
- return false;
-
- return cubeDisplayPrivateIndex >= 0;
-}
-
-bool ScreenRotatingCube::enable()
-{
- if( !loadCubePlugin() )
- return false;
-
- CUBE_SCREEN(s);
-
- ss->zCamera = 0.0;
- ss->cubeRotX = 0.0;
- ss->cubeRotV = 0.0;
- cs->rotationState = RotationManual;
- WRAP( ss, cs, getRotation, screenSaverGetRotation );
-
- return ScreenEffect::enable();
-}
-
-void ScreenRotatingCube::disable()
-{
- ss->zCameraFadeOut = ss->zCamera;
- ss->cubeRotXFadeOut = ss->cubeRotX;
- ss->cubeRotVFadeOut = ss->cubeRotV;
-
- ScreenEffect::disable();
-}
-
-void ScreenRotatingCube::clean()
-{
- CUBE_SCREEN(s);
- cs->rotationState = RotationNone;
- UNWRAP (ss, cs, getRotation);
-}
-
-void ScreenRotatingCube::getRotation( float* x, float* v, float *progress )
-{
- ScreenEffect::getRotation( x, v, progress );
-
- *x += ss->cubeRotX;
- *v += ss->cubeRotV;
- *progress = MAX (*progress, ss->cubeProgress);
-}
-
-void ScreenRotatingCube::preparePaintScreen( int msSinceLastPaint )
-{
-
- ScreenEffect::preparePaintScreen( msSinceLastPaint );
-
- float rotX = screensaverGetCubeRotationSpeed(s->display)/100.0;
- float rotV = 0.0;
-
- SCREENSAVER_DISPLAY(s->display);
-
- if( sd->state.fadingIn )
- {
- rotX *= getProgress();
- ss->zCamera = -screensaverGetCubeZoom(s->display) * getProgress();
- ss->cubeProgress = getProgress();
- }
- else if( sd->state.fadingOut )
- {
- ss->zCamera = ss->zCameraFadeOut * (1-getProgress());
- ss->cubeRotX = ss->cubeRotXFadeOut * (1-getProgress());
- ss->cubeRotV = ss->cubeRotVFadeOut * (1-getProgress());
- ss->cubeProgress = 1 - getProgress();
- }
-
- if( !sd->state.fadingOut )
- {
- ss->cubeRotX += rotX * msSinceLastPaint;
- ss->cubeRotV += rotV * msSinceLastPaint;
- }
- if( ss->cubeRotX > 180.0 ) ss->cubeRotX -= 360.0;
- if( ss->cubeRotX < -180.0 ) ss->cubeRotX += 360.0;
-}
-
-void ScreenRotatingCube::donePaintScreen()
-{
- damageScreen(s);
- ScreenEffect::donePaintScreen();
-}
-
-Bool ScreenRotatingCube::paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask)
-{
- ScreenPaintAttrib sA = *sAttrib;
- sA.zCamera += ss->zCamera;
-
- mask &= ~PAINT_SCREEN_REGION_MASK;
- mask |= PAINT_SCREEN_TRANSFORMED_MASK;
- return ScreenEffect::paintOutput( &sA, transform, region, output, mask );
-}
diff --git a/rotatingcube.h b/rotatingcube.h
deleted file mode 100644
index 82c34c4..0000000
--- a/rotatingcube.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef ROTATINGCUBE_H
-#define ROTATINGCUBE_H
-
-#include "screensaver_internal.h"
-
-class ScreenRotatingCube : public ScreenEffect
-{
-public:
- ScreenRotatingCube( CompScreen* s ) : ScreenEffect(s) {}
- virtual ~ScreenRotatingCube() {}
-
- virtual bool enable();
- virtual void disable();
- virtual void getRotation( float* x, float* v, float *progress );
- virtual void preparePaintScreen( int msSinceLastPaint );
- virtual void donePaintScreen();
- virtual Bool paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask);
-protected:
- virtual void clean();
-
-private:
- bool loadCubePlugin();
-};
-
-#endif
diff --git a/screensaver.cpp b/screensaver.cpp
deleted file mode 100644
index bbd2f29..0000000
--- a/screensaver.cpp
+++ /dev/null
@@ -1,450 +0,0 @@
-/**
- *
- * Compiz screensaver plugin
- *
- * screensaver.cpp
- *
- * Copyright (c) 2007 Nicolas Viennot <nicolas@viennot.biz>
- *
- * 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 <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <X11/extensions/scrnsaver.h>
-
-#include "screensaver_internal.h"
-#include "flyingwindows.h"
-#include "rotatingcube.h"
-
-int displayPrivateIndex;
-int cubeDisplayPrivateIndex;
-
-template< typename _DisplayEffect, typename _ScreenEffect, typename _WindowEffect >
-static void screenSaverEffectInstance( CompDisplay* d )
-{
- SCREENSAVER_DISPLAY(d);
- delete sd->effect;
- sd->effect = new _DisplayEffect(d);
-
- for ( CompScreen* s = d->screens; s; s = s->next)
- {
- SCREENSAVER_SCREEN(s);
-
- delete ss->effect;
- ss->effect = new _ScreenEffect(s);
-
- for( CompWindow* w = s->windows; w; w = w->next )
- {
- SCREENSAVER_WINDOW(w);
- delete sw->effect;
- sw->effect = new _WindowEffect(w);
- }
- }
-}
-
-static void screenSaverEnableEffect( CompDisplay* d )
-{
- SCREENSAVER_DISPLAY(d);
- ScreensaverModeEnum mode = (ScreensaverModeEnum)screensaverGetMode(d);
-
- if( mode == ModeFlyingWindows )
- screenSaverEffectInstance< DisplayFlyingWindows, ScreenFlyingWindows, WindowFlyingWindows >(d);
- else if( mode == ModeRotatingCube )
- screenSaverEffectInstance< DisplayEffect, ScreenRotatingCube, WindowEffect >(d);
-
- for ( CompScreen* s = d->screens; s; s = s->next)
- {
- SCREENSAVER_SCREEN(s);
- ss->time = 0;
- if( !ss->effect->enable() )
- {
- screenSaverEffectInstance< DisplayEffect, ScreenEffect, WindowEffect >(d);
- return;
- }
- }
- sd->state.fadingOut = False;
- sd->state.fadingIn = True;
- sd->state.running = True;
-}
-
-static void screenSaverDisableEffect( CompDisplay* d )
-{
- SCREENSAVER_DISPLAY(d);
- for ( CompScreen* s = d->screens; s; s = s->next)
- {
- SCREENSAVER_SCREEN(s);
- ss->effect->disable();
- ss->time = 0;
- }
-
- sd->state.fadingOut = True;
- sd->state.fadingIn = False;
-}
-
-static void screenSaverCleanEffect( CompDisplay* d )
-{
- screenSaverEffectInstance< DisplayEffect, ScreenEffect, WindowEffect >(d);
-}
-
-static void
-screenSaverSetState( CompDisplay *d, Bool enable )
-{
- SCREENSAVER_DISPLAY(d);
-
- if( !sd->state.running && enable )
- sd->effect->loadEffect = true;
-
- if( sd->state.running && !sd->state.fadingOut && !enable )
- screenSaverDisableEffect(d);
-}
-
-static Bool
-screenSaverInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- SCREENSAVER_DISPLAY(d);
- screenSaverSetState(d, !sd->state.running );
- return TRUE;
-}
-
-void screenSaverGetRotation( CompScreen *s, float *x, float *v, float *progress )
-{
- SCREENSAVER_SCREEN (s);
- ss->effect->getRotation( x, v, progress );
-}
-
-Bool screenSaverPaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
-{
- SCREENSAVER_WINDOW(w);
- return sw->effect->paintWindow( attrib, transform, region, mask );
-}
-
-Bool screenSaverPaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- SCREENSAVER_SCREEN(s);
- return ss->effect->paintOutput( sAttrib, transform, region, output, mask );
-}
-
-void screenSaverPreparePaintScreen (CompScreen *s,
- int msSinceLastPaint)
-{
- SCREENSAVER_SCREEN (s);
- ss->effect->preparePaintScreen( msSinceLastPaint );
-}
-
-void screenSaverPaintTransformedOutput(CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- const CompTransform *transform,
- Region region, CompOutput *output,
- unsigned int mask)
-{
- SCREENSAVER_SCREEN(s);
- ss->effect->paintTransformedOutput( sAttrib, transform, region, output, mask);
-}
-
-void screenSaverDonePaintScreen( CompScreen* s )
-{
- SCREENSAVER_SCREEN (s);
- ss->effect->donePaintScreen();
-}
-
-void screenSaverHandleEvent( CompDisplay *d, XEvent *event )
-{
- XScreenSaverNotifyEvent* XSSevent;
- SCREENSAVER_DISPLAY (d);
-
- sd->effect->handleEvent( event );
-
- switch( (event->type & 0x7F) - sd->XSScontext.first_event )
- {
- case ScreenSaverNotify:
- XSSevent = (XScreenSaverNotifyEvent*) event;
- screenSaverSetState( d, XSSevent->state );
- break;
- }
-
- if( sd->effect->loadEffect )
- {
- sd->effect->loadEffect = false;
- screenSaverEnableEffect(d);
- }
- else if( sd->effect->cleanEffect )
- {
- sd->effect->cleanEffect = false;
- screenSaverCleanEffect(d);
- }
-}
-
-void screenSaverPaintScreen (CompScreen *s,
- CompOutput *outputs,
- int numOutputs,
- unsigned int mask)
-{
- SCREENSAVER_SCREEN (s);
- ss->effect->paintScreen (outputs, numOutputs, mask);
-}
-
-static void screenSaverSetXScreenSaver( CompDisplay *d, Bool enable )
-{
- SCREENSAVER_DISPLAY(d);
-
- if( enable && !sd->XSScontext.init )
- {
-
- int dummy;
- if( !XScreenSaverQueryExtension(d->display, &sd->XSScontext.first_event, &dummy ) )
- {
- compLogMessage ("screensaver", CompLogLevelWarn,
- "XScreenSaver Extension not available");
- return;
- }
- sd->XSScontext.init = True;
-
- XGetScreenSaver( d->display, &sd->XSScontext.timeout, &sd->XSScontext.interval, \
- &sd->XSScontext.prefer_blanking, &sd->XSScontext.allow_exposures);
- XSetScreenSaver( d->display, (int)(screensaverGetAfter(d)*60.0), sd->XSScontext.interval, 0, AllowExposures);
-
- Window root = DefaultRootWindow (d->display);
- XSetWindowAttributes attr;
- int mask = 0;
- XScreenSaverSetAttributes( d->display,root, -100,-100,1,1,0 ,CopyFromParent,CopyFromParent,CopyFromParent,mask,&attr);
- XScreenSaverSelectInput( d->display, root, ScreenSaverNotifyMask );
-
- }
- if( !enable && sd->XSScontext.init )
- {
- sd->XSScontext.init = False;
-
- XSetScreenSaver( d->display, sd->XSScontext.timeout, sd->XSScontext.interval, \
- sd->XSScontext.prefer_blanking, sd->XSScontext.allow_exposures);
-
- Window root = DefaultRootWindow (d->display);
- XScreenSaverSelectInput( d->display, root, 0 );
- XScreenSaverUnsetAttributes( d->display, root );
- }
-}
-
-static void screenSaverSetXScreenSaverNotify( CompDisplay *d, CompOption *opt, ScreensaverDisplayOptions num )
-{
- screenSaverSetXScreenSaver( d, False );
- screenSaverSetXScreenSaver( d, screensaverGetStartAutomatically(d) );
-}
-
-static Bool
-screenSaverInitWindow (CompPlugin *p,
- CompWindow *w)
-{
- ScreenSaverWindow *sw;
-
- SCREENSAVER_SCREEN (w->screen);
-
- sw = (ScreenSaverWindow*)malloc (sizeof (ScreenSaverWindow));
- if (!sw)
- return FALSE;
-
- w->base.privates[ss->windowPrivateIndex].ptr = sw;
- SCREENSAVER_DISPLAY(w->screen->display);
- if( sd->state.running && (ScreensaverModeEnum)screensaverGetMode(w->screen->display) == ModeFlyingWindows )
- sw->effect = new WindowFlyingWindows(w);
- else sw->effect = new WindowEffect(w);
-
- return TRUE;
-}
-
-static void
-screenSaverFiniWindow (CompPlugin *p,
- CompWindow *w)
-{
- SCREENSAVER_WINDOW (w);
- delete sw->effect;
- free (sw);
-}
-
-static Bool
-screenSaverInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- ScreenSaverScreen *ss;
-
- SCREENSAVER_DISPLAY (s->display);
-
- ss = (ScreenSaverScreen*)malloc (sizeof (ScreenSaverScreen));
- if (!ss)
- return FALSE;
-
- ss->windowPrivateIndex = allocateWindowPrivateIndex (s);
- if (ss->windowPrivateIndex < 0)
- {
- free (ss);
- return FALSE;
- }
-
- s->base.privates[sd->screenPrivateIndex].ptr = ss;
- ss->effect = new ScreenEffect(s);
- ss->desktopOpacity = OPAQUE;
-
- WRAP (ss, s, preparePaintScreen, screenSaverPreparePaintScreen);
- WRAP (ss, s, donePaintScreen, screenSaverDonePaintScreen);
- WRAP (ss, s, paintOutput, screenSaverPaintOutput);
- WRAP (ss, s, paintWindow, screenSaverPaintWindow);
- WRAP (ss, s, paintTransformedOutput, screenSaverPaintTransformedOutput);
- WRAP (ss, s, paintScreen, screenSaverPaintScreen);
-
- return TRUE;
-}
-
-static void
-screenSaverFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- SCREENSAVER_SCREEN (s);
-
- UNWRAP (ss, s, preparePaintScreen);
- UNWRAP (ss, s, donePaintScreen);
- UNWRAP (ss, s, paintOutput);
- UNWRAP (ss, s, paintWindow);
- UNWRAP (ss, s, paintTransformedOutput);
- UNWRAP (ss, s, paintScreen);
-
- delete ss->effect;
- freeWindowPrivateIndex(s, ss->windowPrivateIndex);
- free (ss);
-}
-
-static Bool
-screenSaverInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- ScreenSaverDisplay *sd;
-
- sd = (ScreenSaverDisplay*)malloc (sizeof (ScreenSaverDisplay));
- if (!sd) return FALSE;
-
- sd->state.running = False;
- sd->state.fadingOut = False;
- sd->state.fadingIn = False;
-
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (sd->screenPrivateIndex < 0)
- {
- free (sd);
- return FALSE;
- }
- d->base.privates[displayPrivateIndex].ptr = sd;
- sd->effect = new DisplayEffect(d);
-
- screensaverSetInitiateKeyInitiate(d,screenSaverInitiate);
- screensaverSetInitiateButtonInitiate(d,screenSaverInitiate);
- screensaverSetInitiateEdgeInitiate(d,screenSaverInitiate);
- screensaverSetStartAutomaticallyNotify( d, screenSaverSetXScreenSaverNotify);
- screensaverSetAfterNotify( d, screenSaverSetXScreenSaverNotify);
-
- sd->XSScontext.init = False;
- screenSaverSetXScreenSaver(d,screensaverGetStartAutomatically(d));
-
- WRAP (sd, d, handleEvent, screenSaverHandleEvent);
- return TRUE;
-}
-
-static void
-screenSaverFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- SCREENSAVER_DISPLAY (d);
-
- screenSaverSetXScreenSaver(d,FALSE);
-
- UNWRAP (sd, d, handleEvent);
- delete sd->effect;
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
- free (sd);
-}
-
-static CompBool
-screenSaverInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) screenSaverInitDisplay,
- (InitPluginObjectProc) screenSaverInitScreen,
- (InitPluginObjectProc) screenSaverInitWindow
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-screenSaverFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) screenSaverFiniDisplay,
- (FiniPluginObjectProc) screenSaverFiniScreen,
- (FiniPluginObjectProc) screenSaverFiniWindow
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static Bool
-screenSaverInit (CompPlugin *p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-screenSaverFini (CompPlugin *p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-static CompPluginVTable testplugVTable = {
- "screensaver",
- 0,
- screenSaverInit,
- screenSaverFini,
- screenSaverInitObject,
- screenSaverFiniObject,
- 0, /* GetScreenOptions */
- 0, /* SetScreenOption */
-};
-
-extern "C" {
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &testplugVTable;
-}
-}
diff --git a/screensaver.xml.in b/screensaver.xml.in
index a5ecc66..7904e74 100644
--- a/screensaver.xml.in
+++ b/screensaver.xml.in
@@ -9,7 +9,7 @@
</relation>
</deps>
<category>Extras</category>
- <display>
+ <options>
<group>
<_short>Bindings</_short>
<option name="initiate_key" type="key">
@@ -34,10 +34,6 @@
<max>1</max>
<desc>
<value>0</value>
- <name>Flying windows</name>
- </desc>
- <desc>
- <value>1</value>
<name>Rotating cube</name>
</desc>
</option>
@@ -123,6 +119,6 @@
<precision>0.1</precision>
</option>
</group>
- </display>
+ </options>
</plugin>
</compiz>
diff --git a/screensaver_internal.h b/screensaver_internal.h
deleted file mode 100644
index a4cd427..0000000
--- a/screensaver_internal.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef SCREENSAVER_INTERNAL_H
-#define SCREENSAVER_INTERNAL_H
-
-#include <compiz-core.h>
-#include <compiz-cube.h>
-
-#include "matrix.h"
-#include "vector.h"
-#include "screensaver_options.h"
-
-#define GET_SCREENSAVER_DISPLAY(d) \
- ((ScreenSaverDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define SCREENSAVER_DISPLAY(d) \
- ScreenSaverDisplay *sd = GET_SCREENSAVER_DISPLAY (d)
-
-#define GET_SCREENSAVER_SCREEN(s, hd) \
- ((ScreenSaverScreen *) (s)->base.privates[(hd)->screenPrivateIndex].ptr)
-
-#define SCREENSAVER_SCREEN(s) \
- ScreenSaverScreen *ss = GET_SCREENSAVER_SCREEN (s, \
- GET_SCREENSAVER_DISPLAY (s->display))
-
-#define GET_SCREENSAVER_WINDOW(w, ss) \
- ((ScreenSaverWindow *) (w)->base.privates[(ss)->windowPrivateIndex].ptr)
-
-#define SCREENSAVER_WINDOW(w) \
- ScreenSaverWindow *sw = GET_SCREENSAVER_WINDOW (w, \
- GET_SCREENSAVER_SCREEN (w->screen, \
- GET_SCREENSAVER_DISPLAY (w->screen->display)))
-
-#define WIN_X(w) ( (w)->attrib.x - (w)->input.left )
-#define WIN_Y(w) ( (w)->attrib.y - (w)->input.top )
-#define WIN_W(w) ( (w)->width + (w)->input.left + (w)->input.right )
-#define WIN_H(w) ( (w)->height + (w)->input.top + (w)->input.bottom )
-
-extern int displayPrivateIndex;
-extern int cubeDisplayPrivateIndex;
-
-typedef struct _ScreenSaverState {
- // when the screensaver is enabled, running and fadingIn are set to true
- // then, after fadingInDuration, fadingIn is set to false
- // when the screensaver is requested to stop, fadingOut is set to true
- // after fadingOutDuration, running is set to false
- Bool running;
- Bool fadingOut;
- Bool fadingIn;
-} ScreenSaverState;
-
-typedef struct _ScreenSaverXSSContext {
- int timeout, interval, prefer_blanking, allow_exposures;
- int first_event;
- Bool init;
-} ScreenSaverXSSContext;
-
-class DisplayEffect;
-class ScreenEffect;
-class WindowEffect;
-
-typedef struct _ScreenSaverDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
-
- ScreenSaverState state;
- ScreenSaverXSSContext XSScontext;
-
- DisplayEffect* effect;
-} ScreenSaverDisplay;
-
-typedef struct _ScreenSaverScreen {
- int windowPrivateIndex;
- CubeGetRotationProc getRotation;
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
- PaintWindowProc paintWindow;
- PaintTransformedOutputProc paintTransformedOutput;
- PaintScreenProc paintScreen;
-
- // time is stored to calculate progress when fadingIn or fadingOut
- int time;
-
- float cubeRotX, cubeRotV, cubeProgress, zCamera;
- // FadeOut values are the initial value used to calculate the interpolation when fadingOut
- float cubeRotXFadeOut, cubeRotVFadeOut, zCameraFadeOut;
-
- // Used with flying windows mode
- // screenCenter is the attraction point
- Point screenCenter;
- Matrix camera, cameraMat;
- float angleCam;
-
- ScreenEffect* effect;
- GLushort desktopOpacity;
-
-} ScreenSaverScreen;
-
-typedef struct _ScreenSaverWindow {
- WindowEffect* effect;
-} ScreenSaverWindow;
-
-void screenSaverHandleEvent( CompDisplay *d, XEvent *event );
-void screenSaverGetRotation( CompScreen *s, float *x, float *v, float *progress );
-void screenSaverPreparePaintScreen( CompScreen* s, int msSinceLastPaint );
-void screenSaverDonePaintScreen( CompScreen* s );
-void screenSaverPaintTransformedOutput( CompScreen* s, const ScreenPaintAttrib* sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput *output, unsigned int mask);
-
-Bool screenSaverPaintOutput( CompScreen* s, const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask);
-
-Bool screenSaverPaintWindow( CompWindow* w, const WindowPaintAttrib* attrib, \
- const CompTransform* transform, Region region, unsigned int mask);
-
-void screenSaverPaintBackground( CompScreen* s, Region region, unsigned int mask );
-
-void screenSaverPaintScreen (CompScreen *s, CompOutput *outputs, int numOutputs, unsigned int mask);
-
-#include "wrapper.h"
-#include "effect.h"
-
-#endif
diff --git a/vector.cpp b/vector.cpp
deleted file mode 100644
index d1bed04..0000000
--- a/vector.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "vector.h"
-
-const Vector Vector::null( 0.0, 0.0, 0.0 );
-
-Vector operator^( const Vector& lhs, const Vector& rhs )
-{
- Vector res;
-
- res[0] = lhs[1]*rhs[2] - lhs[2]*rhs[1];
- res[1] = lhs[2]*rhs[0] - lhs[0]*rhs[2];
- res[2] = lhs[0]*rhs[1] - lhs[1]*rhs[0];
-
- return res;
-}
diff --git a/vector.h b/vector.h
deleted file mode 100644
index 2c602eb..0000000
--- a/vector.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef VECTOR_H
-#define VECTOR_H
-
-#include <math.h>
-#include <compiz-core.h>
-
-typedef enum
-{
- x,
- y,
- z
-} VectorCoordsEnum;
-
-class Vector
-{
-public:
- static const Vector null;
-
- Vector()
- {
- for(int i = 0; i<3; i++) {
- v[i] = 0;
- }
- }
- Vector( float x, float y, float z ) { v[0] = x; v[1] = y; v[2] = z; }
- Vector( const float* vect ) { v[0] = vect[0]; v[1] = vect[1]; v[2] = vect[2]; }
- Vector( const Vector& vect ) { v[0] = vect[0]; v[1] = vect[1]; v[2] = vect[2]; }
-
- float norm() { return sqrt( (*this) * (*this) ); }
- Vector& normalize()
- {
- float n = norm();
- if( n == 0.0 )
- v[x] = v[y] = v[z] = 1.0;
- else *this /= n;
- return *this;
- }
-
- Vector toScreenSpace( CompScreen* s ) const
- {
- Vector res;
- res[0] = v[0]/s->width - 0.5;
- res[1] = 0.5 - v[1]/s->height;
- res[2] = v[2];
- return res;
- }
-
- Vector toCoordsSpace( CompScreen *s ) const
- {
- Vector res;
- res[0] = ( v[0] + 0.5 )*s->width;
- res[1] = ( 0.5 - v[1] )*s->height;
- res[2] = v[2];
- return res;
- }
-
- float& operator[]( int i ) { return v[i]; }
- const float& operator[]( int i ) const { return v[i]; }
- float& operator[]( VectorCoordsEnum c ) { return v[(int)c]; }
- const float& operator[]( VectorCoordsEnum c ) const { return v[(int)c]; }
-
- Vector& operator+=( const Vector& rhs )
- {
- v[0] += rhs[0];
- v[1] += rhs[1];
- v[2] += rhs[2];
- return *this;
- }
-
- friend Vector operator+( const Vector& lhs, const Vector& rhs )
- {
- Vector res;
- res[0] = lhs[0] + rhs[0];
- res[1] = lhs[1] + rhs[1];
- res[2] = lhs[2] + rhs[2];
- return res;
- }
-
- Vector& operator-=( const Vector& rhs )
- {
- v[0] -= rhs[0];
- v[1] -= rhs[1];
- v[2] -= rhs[2];
- return *this;
- }
-
- friend Vector operator-( const Vector& lhs, const Vector& rhs )
- {
- Vector res;
- res[0] = lhs[0] - rhs[0];
- res[1] = lhs[1] - rhs[1];
- res[2] = lhs[2] - rhs[2];
- return res;
- }
-
- friend Vector operator-( const Vector& vect )
- {
- Vector res;
- res[0] = -vect[0];
- res[1] = -vect[1];
- res[2] = -vect[2];
- return res;
- }
-
- Vector& operator*=( const float k )
- {
- v[0] *= k;
- v[1] *= k;
- v[2] *= k;
- return *this;
- }
-
- friend float operator*( const Vector& lhs, const Vector& rhs )
- {
- return lhs[0] * rhs[0] + lhs[1] * rhs[1] + lhs[2] * rhs[2];
- }
-
- friend Vector operator*( const float k, const Vector& vect )
- {
- Vector res;
- res[0] = k * vect[0];
- res[1] = k * vect[1];
- res[2] = k * vect[2];
- return res;
- }
-
- friend Vector operator*( const Vector& v, const float k ) { return k*v; }
-
- Vector& operator/=( const float k )
- {
- v[0] /= k;
- v[1] /= k;
- v[2] /= k;
- return *this;
- }
-
- friend Vector operator/( const Vector& vect, const float k )
- {
- Vector res;
- res[0] = vect[0] / k;
- res[1] = vect[1] / k;
- res[2] = vect[2] / k;
- return res;
- }
-
- Vector& operator^=( const Vector& vect )
- {
- *this = *this ^ vect;
- return *this;
- }
-
- friend Vector operator^( const Vector& lhs, const Vector& rhs );
-
- float v[3];
-};
-
-typedef Vector Point;
-
-#endif
diff --git a/wrapper.cpp b/wrapper.cpp
deleted file mode 100644
index 66c4ce9..0000000
--- a/wrapper.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "screensaver_internal.h"
-
-DisplayWrapper::DisplayWrapper( CompDisplay* d )
-{
- SCREENSAVER_DISPLAY(d);
- this->d = d;
- this->sd = sd;
-}
-
-void DisplayWrapper::handleEvent( XEvent *event )
-{
- UNWRAP (sd, d, handleEvent);
- d->handleEvent(d, event);
- WRAP (sd, d, handleEvent, screenSaverHandleEvent);
-}
-
-ScreenWrapper::ScreenWrapper( CompScreen* s )
-{
- SCREENSAVER_SCREEN(s);
- this->s = s;
- this->ss = ss;
-}
-
-void ScreenWrapper::getRotation( float* x, float* v, float *progress )
-{
- CUBE_SCREEN(s);
- UNWRAP( ss, cs, getRotation );
- cs->getRotation( s, x, v, progress );
- WRAP( ss, cs, getRotation, screenSaverGetRotation );
-}
-
-void ScreenWrapper::preparePaintScreen( int msSinceLastPaint )
-{
- UNWRAP (ss, s, preparePaintScreen);
- s->preparePaintScreen(s, msSinceLastPaint);
- WRAP (ss, s, preparePaintScreen, screenSaverPreparePaintScreen);
-}
-
-void ScreenWrapper::donePaintScreen()
-{
- UNWRAP (ss, s, donePaintScreen);
- s->donePaintScreen(s);
- WRAP (ss, s, donePaintScreen, screenSaverDonePaintScreen);
-}
-
-void ScreenWrapper::paintTransformedOutput( const ScreenPaintAttrib* sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput *output, unsigned int mask)
-{
- UNWRAP(ss, s, paintTransformedOutput);
- s->paintTransformedOutput(s, sAttrib, transform, region, output, mask);
- WRAP( ss, s, paintTransformedOutput, screenSaverPaintTransformedOutput );
-}
-
-Bool ScreenWrapper::paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask)
-{
- UNWRAP (ss, s, paintOutput);
- Bool status = s->paintOutput(s, sAttrib, transform, region, output, mask);
- WRAP (ss, s, paintOutput, screenSaverPaintOutput);
- return status;
-}
-
-void ScreenWrapper::paintScreen (CompOutput *outputs, int numOutputs, unsigned int mask)
-{
- UNWRAP (ss, s, paintScreen);
- (*s->paintScreen) (s, outputs, numOutputs, mask);
- WRAP (ss, s, paintScreen, screenSaverPaintScreen);
-}
-
-WindowWrapper::WindowWrapper( CompWindow* w )
-{
- SCREENSAVER_WINDOW(w);
- this->w = w;
- this->sw = sw;
-}
-
-Bool WindowWrapper::paintWindow( const WindowPaintAttrib* attrib, \
- const CompTransform* transform, Region region, unsigned int mask)
-{
- CompScreen* s = w->screen;
- SCREENSAVER_SCREEN(s);
-
- UNWRAP (ss, s, paintWindow);
- Bool status = s->paintWindow(w, attrib, transform, region, mask);
- WRAP (ss, s, paintWindow, screenSaverPaintWindow);
- return status;
-}
diff --git a/wrapper.h b/wrapper.h
deleted file mode 100644
index fadf4bf..0000000
--- a/wrapper.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef WRAPPER_H
-#define WRAPPER_H
-
-#include "screensaver_internal.h"
-
-class DisplayWrapper
-{
-public:
- DisplayWrapper( CompDisplay* d );
- virtual ~DisplayWrapper() {}
-
- virtual void handleEvent( XEvent *event );
-
-protected:
- CompDisplay* d;
- ScreenSaverDisplay* sd;
-};
-
-class ScreenWrapper
-{
-public:
- ScreenWrapper( CompScreen* s );
- virtual ~ScreenWrapper() {}
-
- virtual void getRotation( float* x, float* v, float *progress );
- virtual void preparePaintScreen( int msSinceLastPaint );
- virtual void donePaintScreen();
- virtual void paintTransformedOutput( const ScreenPaintAttrib* sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput *output, unsigned int mask);
- virtual Bool paintOutput( const ScreenPaintAttrib *sAttrib, \
- const CompTransform* transform, Region region, \
- CompOutput* output, unsigned int mask);
- virtual void paintScreen (CompOutput *outputs,
- int numOutputs,
- unsigned int mask);
-
-protected:
- CompScreen* s;
- ScreenSaverScreen* ss;
-};
-
-class WindowWrapper
-{
-public:
- WindowWrapper( CompWindow* w );
- virtual ~WindowWrapper() {}
- virtual Bool paintWindow( const WindowPaintAttrib* attrib, \
- const CompTransform* transform, Region region, unsigned int mask);
-protected:
- CompWindow* w;
- ScreenSaverWindow* sw;
-};
-
-#endif