summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-08-08 15:44:44 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-08-08 15:44:44 +0800
commit683fabc8835c514d654d71294c52ce56bc248ac7 (patch)
treea4648aba862ede0e30e390c6742d409aefb934be
parent8db10abe5afd975e46476a2ccb604d641b9d7023 (diff)
downloadanaglyph-683fabc8835c514d654d71294c52ce56bc248ac7.tar.gz
anaglyph-683fabc8835c514d654d71294c52ce56bc248ac7.tar.bz2
C++ port of the anaglyph plugin
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--anaglyph.c620
-rw-r--r--anaglyph.xml.in10
-rw-r--r--plugin.info1
-rw-r--r--src/anaglyph.cpp302
-rw-r--r--src/anaglyph.h110
7 files changed, 422 insertions, 1160 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e678da1..7e79b7d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
-compiz_fusion_plugin (anaglyph)
+include (CompizPlugin)
+
+compiz_plugin (anaglyph PLUGINDEPS composite opengl)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d9a07cf..0000000
--- a/Makefile
+++ /dev/null
@@ -1,533 +0,0 @@
-##
-#
-# Compiz plugin Makefile
-#
-# Copyright : (C) 2007 by Dennis Kasprzyk
-# E-mail : onestone@deltatauchi.de
-#
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-##
-
-# plugin.info file contents
-#
-# PLUGIN = foo
-# PKG_DEP = pango
-# LDFLAGS_ADD = -lGLU
-# CFLAGS_ADD = -I/usr/include/foo
-# CHK_HEADERS = compiz-cube.h
-#
-
-#load config file
-
-ECHO = `which echo`
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-ifeq ($(shell if [ -f plugin.info ]; then $(ECHO) -n "found"; fi ),found)
-include plugin.info
-else
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\033[1;31m[ERROR]\033[0m \"plugin.info\" file not found"; \
- else \
- $(ECHO) "[ERROR] \"plugin.info\" file not found"; \
- fi;))
-endif
-
-ifneq ($(shell if pkg-config --exists compiz; then $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m Compiz not installed"; \
- else \
- $(ECHO) -n "[ERROR] Compiz not installed"; \
- fi))
-endif
-
-
-ifneq ($(shell if [ -n "$(PKG_DEP)" ]; then if pkg-config --exists $(PKG_DEP); then $(ECHO) -n "found"; fi; \
- else $(ECHO) -n "found"; fi ),found)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m "; \
- else \
- $(ECHO) -n "[ERROR] "; \
- fi; \
- pkg-config --print-errors --short-errors --errors-to-stdout $(PKG_DEP); ))
-endif
-
-
-ifeq ($(BUILD_GLOBAL),true)
- PREFIX = $(shell pkg-config --variable=prefix compiz)
- CLIBDIR = $(shell pkg-config --variable=libdir compiz)
- CINCDIR = $(shell pkg-config --variable=includedir compiz)
- PKGDIR = $(CLIBDIR)/pkgconfig
- DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz
- XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
-else
- DESTDIR = $(HOME)/.compiz/plugins
- XMLDIR = $(HOME)/.compiz/metadata
- IMAGEDIR = $(HOME)/.compiz/images
- DATADIR = $(HOME)/.compiz/data
-endif
-
-BUILDDIR = build
-
-CC = gcc
-CPP = g++
-LIBTOOL = libtool
-INSTALL = install
-
-BCOP = `pkg-config --variable=bin bcop`
-
-CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD)
-LDFLAGS = `pkg-config --libs $(PKG_DEP) compiz ` $(LDFLAGS_ADD)
-
-DEFINES = -DIMAGEDIR=\"$(IMAGEDIR)\" -DDATADIR=\"$(DATADIR)\"
-
-POFILEDIR = $(shell if [ -n "$(PODIR)" ]; then $(ECHO) $(PODIR); else $(ECHO) ./po;fi )
-
-COMPIZ_HEADERS = compiz.h compiz-core.h
-COMPIZ_INC = $(shell pkg-config --variable=includedir compiz)/compiz/
-
-is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in | grep "useBcop=\"true\""; \
- else if [ -e $(PLUGIN).xml ]; then cat $(PLUGIN).xml | grep "useBcop=\"true\""; fi; fi)
-
-trans-target := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml;fi )
-
-bcop-target := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-bcop-target-src := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.c; fi )
-bcop-target-hdr := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.h; fi )
-
-gen-schemas := $(shell if [ \( -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml \) -a -n "`pkg-config --variable=xsltdir compiz-gconf`" ]; then $(ECHO) true; fi )
-schema-target := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-schema-output := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/compiz-$(PLUGIN).schema; fi )
-
-ifeq ($(BUILD_GLOBAL),true)
- pkg-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" ]; then $(ECHO) "$(BUILDDIR)/compiz-$(PLUGIN).pc"; fi )
- hdr-install-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" -a -e compiz-$(PLUGIN).h ]; then $(ECHO) "compiz-$(PLUGIN).h"; fi )
-endif
-
-# find all the object files
-
-c-objs := $(patsubst %.c,%.lo,$(shell find -name '*.c' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cxx,%.lo,$(shell find -name '*.cxx' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs := $(filter-out $(bcop-target-src:.c=.lo),$(c-objs))
-
-h-files := $(shell find -name '*.h' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')
-h-files += $(bcop-target-hdr)
-h-files += $(foreach file,$(COMPIZ_HEADERS) $(CHK_HEADERS),$(shell $(ECHO) -n "$(COMPIZ_INC)$(file)"))
-
-all-c-objs := $(addprefix $(BUILDDIR)/,$(c-objs))
-all-c-objs += $(bcop-target-src:.c=.lo)
-
-# additional files
-
-data-files := $(shell find data/ -name '*' -type f 2> /dev/null | sed -e 's/data\///')
-image-files := $(shell find images/ -name '*' -type f 2> /dev/null | sed -e 's/images\///')
-
-# system include path parameter, -isystem doesn't work on old gcc's
-inc-path-param = $(shell if [ -z "`gcc --version | head -n 1 | grep ' 3'`" ]; then $(ECHO) "-isystem"; else $(ECHO) "-I"; fi)
-
-# Tests
-ifeq ($(shell if [ -n "$(is-bcop-target)" -a -z "$(BCOP)" ]; then $(ECHO) -n "error"; fi ),error)
-$(error $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m BCOP not installed but is needed to build plugin"; \
- else \
- $(ECHO) -n "[ERROR] BCOP not installed but is needed to build plugin"; \
- fi))
-endif
-
-ifeq ($(shell if [ "x$(BUILD_GLOBAL)" != "xtrue" -a -e compiz-$(PLUGIN).pc.in ]; then $(ECHO) -n "warn"; fi ),warn)
-$(warning $(shell if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[1;31m[WARNING]\033[0m This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\" "; \
- else \
- $(ECHO) -n "[WARNING] This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\""; \
- fi))
-endif
-
-#
-# Do it.
-#
-
-.PHONY: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-all: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-trans-build: $(trans-target)
-
-bcop-build: $(bcop-target-hdr) $(bcop-target-src)
-
-schema-creation: $(schema-output)
-
-c-build-objs: $(all-c-objs)
-
-c-link-plugin: $(BUILDDIR)/lib$(PLUGIN).la
-
-pkg-creation: $(pkg-target)
-
-#
-# Create build directory
-#
-
-$(BUILDDIR) :
- @mkdir -p $(BUILDDIR)
-
-$(DESTDIR) :
- @mkdir -p $(DESTDIR)
-
-#
-# fallback if xml.in doesn't exists
-#
-$(BUILDDIR)/%.xml: %.xml
- @cp $< $@
-
-#
-# Translating
-#
-$(BUILDDIR)/%.xml: %.xml.in
- @if [ -d $(POFILEDIR) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mtranslate \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "translate $< -> $@"; \
- fi; \
- intltool-merge -x -u $(POFILEDIR) $< $@ > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mtranslate : \033[34m$< -> $@\033[0m"; \
- fi; \
- else \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mconvert \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "convert $< -> $@"; \
- fi; \
- cat $< | sed -e 's;<_;<;g' -e 's;</_;</;g' > $@; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mconvert : \033[34m$< -> $@\033[0m"; \
- fi; \
- fi
-
-#
-# BCOP'ing
-
-$(BUILDDIR)/%_options.h: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --header=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%_options.c: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --source=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Schema generation
-
-$(BUILDDIR)/compiz-%.schema: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mschema'ing\033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "schema'ing $< -> $@"; \
- fi
- @xsltproc `pkg-config --variable=xsltdir compiz-gconf`/schemas.xslt $< > $@
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mschema : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# pkg config file generation
-
-$(BUILDDIR)/compiz-%.pc: compiz-%.pc.in
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mpkgconfig \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "pkgconfig $< -> $@"; \
- fi
- @COMPIZREQUIRES=`cat $(PKGDIR)/compiz.pc | grep Requires | sed -e 's;Requires: ;;g'`; \
- COMPIZCFLAGS=`cat $(PKGDIR)/compiz.pc | grep Cflags | sed -e 's;Cflags: ;;g'`; \
- sed -e 's;@prefix@;$(PREFIX);g' -e 's;\@libdir@;$(CLIBDIR);g' \
- -e 's;@includedir@;$(CINCDIR);g' -e 's;\@VERSION@;0.0.1;g' \
- -e "s;@COMPIZ_REQUIRES@;$$COMPIZREQUIRES;g" \
- -e "s;@COMPIZ_CFLAGS@;$$COMPIZCFLAGS;g" $< > $@;
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mpkgconfig : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Compiling
-#
-
-$(BUILDDIR)/%.lo: %.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: $(BUILDDIR)/%.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cpp $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cxx $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Linking
-#
-
-cxx-rpath-prefix := -Wl,-rpath,
-
-$(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mlinking \033[0m: \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "linking : $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mlinking : \033[34m$@\033[0m"; \
- fi
-
-
-clean:
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mremoving \033[0m: \033[0;31m./$(BUILDDIR)\033[0m"; \
- else \
- $(ECHO) "removing : ./$(BUILDDIR)"; \
- fi
- @rm -rf $(BUILDDIR)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mremoving : \033[34m./$(BUILDDIR)\033[0m"; \
- fi
-
-
-install: $(DESTDIR) all
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "install : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi
- @mkdir -p $(DESTDIR)
- @$(INSTALL) $(BUILDDIR)/.libs/lib$(PLUGIN).so $(DESTDIR)/lib$(PLUGIN).so
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi
- @if [ -e $(BUILDDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "install : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- mkdir -p $(XMLDIR); \
- $(INSTALL) $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- $(INSTALL) --mode=u=rw,go=r,a-s $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "install : $(schema-output)"; \
- fi; \
- if [ "x$(USER)" = "xroot" ]; then \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-install-rule $(schema-output) > /dev/null; \
- else \
- gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
- fi; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- mkdir -p $(DATADIR); \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(DATADIR)/$$FILE"; \
- fi; \
- FILEDIR="$(DATADIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s data/$$FILE $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- mkdir -p $(IMAGEDIR); \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \
- fi; \
- FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \
- mkdir -p "$$FILEDIR"; \
- $(INSTALL) --mode=u=rw,go=r,a-s images/$$FILE $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
-
-uninstall:
- @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi; \
- rm -f $(DESTDIR)/lib$(PLUGIN).so; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi; \
- fi
- @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- rm -f $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- rm -f $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" -a 'x$(USER)' = 'xroot' ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(schema-output)"; \
- fi; \
- GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
- gconftool-2 --makefile-uninstall-rule $(schema-output) > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \
- fi; \
- rm -f $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \
- fi; \
- rm -f $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
diff --git a/anaglyph.c b/anaglyph.c
deleted file mode 100644
index ac38673..0000000
--- a/anaglyph.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/**
- * Compiz Anaglyph plugin
- *
- * anaglyph.c
- * Copyright (c) 2007 Patryk Kowalczyk <wodor@wodor.org>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Author: Patryk Kowalczyk <wodor@wodor.org>
- **/
-
-#include <compiz-core.h>
-#include "anaglyph_options.h"
-
-
-#define GET_ANAGLYPH_CORE(c) \
- ((AnaglyphCore *) (c)->base.privates[corePrivateIndex].ptr)
-
-#define ANAGLYPH_CORE(c) \
- AnaglyphCore *ac = GET_ANAGLYPH_CORE (c)
-
-#define GET_ANAGLYPH_DISPLAY(d) \
- ((AnaglyphDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define ANAGLYPH_DISPLAY(d) \
- AnaglyphDisplay *ad = GET_ANAGLYPH_DISPLAY (d)
-
-#define GET_ANAGLYPH_SCREEN(s, ad) \
- ((AnaglyphScreen *) (s)->base.privates[(ad)->screenPrivateIndex].ptr)
-
-#define ANAGLYPH_SCREEN(s) \
- AnaglyphScreen *as = GET_ANAGLYPH_SCREEN (s, GET_ANAGLYPH_DISPLAY (s->display))
-
-#define GET_ANAGLYPH_WINDOW(w, as) \
- ((AnaglyphWindow *) (w)->base.privates[(as)->windowPrivateIndex].ptr)
-
-#define ANAGLYPH_WINDOW(w) \
- AnaglyphWindow *aw = GET_ANAGLYPH_WINDOW (w, \
- GET_ANAGLYPH_SCREEN (w->screen, \
- GET_ANAGLYPH_DISPLAY (w->screen->display)))
-
-
-#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-
-/*
- * pointer to display list
- *
- */
-static int displayPrivateIndex;
-static int corePrivateIndex;
-
-
-typedef struct _AnaglyphCore {
- ObjectAddProc objectAdd;
-} AnaglyphCore;
-
-typedef struct _AnaglyphDisplay {
- int screenPrivateIndex;
-} AnaglyphDisplay;
-
-typedef struct _AnaglyphScreen {
- int windowPrivateIndex;
- PaintWindowProc paintWindow;
-// PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
-// PaintTransformedOutputProc paintTransformedOutput;
- DamageWindowRectProc damageWindowRect;
- Bool isAnaglyph;
- Bool isDamage;
-} AnaglyphScreen;
-
-typedef struct _AnaglyphWindow {
- Bool isAnaglyph;
-} AnaglyphWindow;
-
-
-static void
-toggleAnaglyphWindow (CompWindow *w)
-{
-
- ANAGLYPH_WINDOW(w);
-
- aw->isAnaglyph = !aw->isAnaglyph;
-
- if (matchEval (anaglyphGetExcludeMatch(w->screen), w))
- aw->isAnaglyph = FALSE;
-
- if(w->redirected && !aw->isAnaglyph)
- damageScreen(w->screen);
-
- addWindowDamage(w);
-}
-
-
-static void
-toggleAnaglyphScreen (CompScreen *s)
-{
- CompWindow *w;
-
- ANAGLYPH_SCREEN(s);
- // compLogMessage (s->display, "anaglyph", CompLogLevelInfo, "info");
- as->isAnaglyph = !as->isAnaglyph;
-
- for (w = s->windows; w; w = w->next)
- if (w)
- toggleAnaglyphWindow (w);
-
-}
-
-
-static Bool
-anaglyphAnaglyphWindow (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompWindow *w;
- Window xid;
-
- xid = getIntOptionNamed(option, nOption, "window", 0);
-
- w = findWindowAtDisplay(d, xid);
-
-
- if (w){
- if (w->attrib.override_redirect)
- return FALSE;
-
- toggleAnaglyphWindow(w);
- }
- return FALSE;
-}
-
-static Bool
-anaglyphAnaglyphScreen (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){
- toggleAnaglyphScreen (s);
- return TRUE;
- }
- return FALSE;
-}
-
-//----------------------------------------------------------------------- MASTER FUNCTION
-
-static Bool anaglyphDrawWindow(CompWindow * w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
-{
- Bool status;
- CompScreen* s = w->screen;
- ANAGLYPH_SCREEN(s);
- ANAGLYPH_WINDOW(w);
-
- //if (((aw->isAnaglyph != as->isAnaglyph) || (as->isAnaglyph && aw->isNew)) && w->texture->pixmap)
- if(aw->isAnaglyph && w->texture->pixmap)
- {
- //if (as->isAnaglyph)
- // aw->isAnaglyph = FALSE;
-
- int oldFilter = s->display->textureFilter;
-
- if (anaglyphGetMipmaps (s))
- s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
-
- mask |= PAINT_WINDOW_TRANSFORMED_MASK;
-
- CompTransform sTransform = *transform;
- WindowPaintAttrib wa = *attrib;
-
- //Window xid;
- //CompWindow *activeWindow;
- //xid = getActiveWindow(s->display, s->root);
- //activeWindow=findWindowAtScreen(s, xid);
-
- float offset = anaglyphGetOffset (s);
- float desktopOffset = anaglyphGetDesktopOffset (s);
-
- if (anaglyphGetDesaturate (s))
- wa.saturation = 0.0f;
-
- UNWRAP(as, s, paintWindow);
-
- //BLUE and ...
- glColorMask(GL_FALSE,GL_TRUE,GL_TRUE,GL_FALSE);
- if (w->type & CompWindowTypeDesktopMask) //desktop
- matrixTranslate (&sTransform, offset*desktopOffset, 0.0f, 0.0f);
- else if (w->state & CompWindowStateShadedMask)
- matrixTranslate (&sTransform, 0.0f, 0.0f, 0.0f);
- else if ((w->state & CompWindowStateMaximizedHorzMask) || (w->state & CompWindowStateMaximizedVertMask ))
- matrixTranslate (&sTransform, -offset*3.5, 0.0f, 0.0f);
- else if (w->type & CompWindowTypeDockMask) // dock
- matrixTranslate (&sTransform, 0.0f, 0.0f, 0.0f);
- else if (w->state & CompWindowStateStickyMask) // sticky
- matrixTranslate (&sTransform, offset*desktopOffset, 0.0f, 0.0f);
- else if (w->state & CompWindowStateBelowMask) //below
- matrixTranslate (&sTransform, offset, 0.0f, 0.0f);
- else if (w->state & CompWindowStateAboveMask) // above
- matrixTranslate (&sTransform, -offset*4.0, 0.0f, 0.0f);
- else if (w->id == w->screen->display->activeWindow) // active window
- matrixTranslate (&sTransform, -offset*3.0, 0.0f, 0.0f);
- else //other windows
- matrixTranslate (&sTransform, -offset, 0.0f, 0.0f);
-
- status = (*s->paintWindow) (w, &wa, &sTransform, region, mask);
-
- //RED
- glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_FALSE);
- if (w->type & CompWindowTypeDesktopMask) //desktop
- matrixTranslate (&sTransform, -offset*2.0*desktopOffset, 0.0f, 0.0f);
- else if (w->state & CompWindowStateShadedMask)
- matrixTranslate (&sTransform, 0.0f, 0.0f, 0.0f);
- else if ((w->state & CompWindowStateMaximizedHorzMask) || (w->state & CompWindowStateMaximizedVertMask ))
- matrixTranslate (&sTransform, offset*3.5, 0.0f, 0.0f);
- else if (w->type & CompWindowTypeDockMask)// dock
- matrixTranslate (&sTransform, 0.0f, 0.0f, 0.0f);
- else if (w->state & CompWindowStateStickyMask) // sticky
- matrixTranslate (&sTransform, -offset*2.0*desktopOffset, 0.0f, 0.0f);
- else if (w->state & CompWindowStateBelowMask) //below
- matrixTranslate (&sTransform, -offset*2.0, 0.0f, 0.0f);
- else if (w->state & CompWindowStateAboveMask) //above
- matrixTranslate (&sTransform, offset*4.0, 0.0f, 0.0f);
- else if (w->id == w->screen->display->activeWindow) // active window
- matrixTranslate (&sTransform, offset*3.0, 0.0f, 0.0f);
- else //other windows
- matrixTranslate (&sTransform, offset*2.0, 0.0f, 0.0f);
-
- status = (*s->paintWindow) (w, &wa, &sTransform, region, mask);
-
- WRAP(as, s, paintWindow, anaglyphDrawWindow);
-
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
- s->display->textureFilter = oldFilter;
- }
- else
- {
- UNWRAP(as, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, transform, region, mask);
- WRAP(as, s, paintWindow, anaglyphDrawWindow);
- }
- return status;
-}
-
-//------------------------------------------------------------------------------DAMAGE FUNCTION
-
-static Bool anaglyphDamageWindowRect(CompWindow *w,
- Bool initial,
- BoxPtr rect){
-
- Bool status = FALSE;
-
- ANAGLYPH_SCREEN(w->screen);
- ANAGLYPH_WINDOW(w);
-
-/* if (initial){
- damageScreen(w->screen);
- status = TRUE;
- }
- else*/ if (aw->isAnaglyph || as->isAnaglyph || as->isDamage)
- {
- as->isDamage = TRUE;
- if (!aw->isAnaglyph && !as->isAnaglyph)
- as->isDamage = FALSE;
-
- damageScreen(w->screen);
- status = TRUE;
- }
-
- UNWRAP(as, w->screen, damageWindowRect);
- status |= (*w->screen->damageWindowRect)(w, initial, rect);
- WRAP(as, w->screen, damageWindowRect, anaglyphDamageWindowRect);
-
- return status;
-}
-
-//----------------------------------------------------------------------------------- PAINT OUTPUT
-
-static Bool anaglyphPaintOutput(CompScreen *s, const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform, Region region, CompOutput *output, unsigned int mask){
-
- Bool status;
-
- ANAGLYPH_SCREEN(s);
-
- mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
-
- UNWRAP(as, s, paintOutput);
- status = (*s->paintOutput)(s, sAttrib, transform, region, output, mask);
- WRAP(as, s, paintOutput, anaglyphPaintOutput);
-
- return status;
-}
-
-//-------------------------------------------------------------------------------
-
-static void
-anaglyphWindowAdd (CompScreen *s,
- CompWindow *w)
-{
- ANAGLYPH_SCREEN (s);
-
- if (as->isAnaglyph && matchEval (anaglyphGetAnaglyphMatch (s), w))
- toggleAnaglyphWindow (w);
-}
-
-static void
-anaglyphScreenOptionChanged (CompScreen *s,
- CompOption *opt,
- AnaglyphScreenOptions num)
-{
- switch (num)
- {
- case AnaglyphScreenOptionAnaglyphMatch:
- case AnaglyphScreenOptionExcludeMatch:
- {
- CompWindow *w;
- ANAGLYPH_SCREEN (s);
-
- for (w = s->windows; w; w = w->next)
- {
- Bool isAnaglyph;
- ANAGLYPH_WINDOW (w);
-
- isAnaglyph = matchEval (anaglyphGetAnaglyphMatch (s), w);
- isAnaglyph = isAnaglyph && !matchEval (anaglyphGetExcludeMatch (s), w);
-
- if (isAnaglyph && as->isAnaglyph && !aw->isAnaglyph)
- toggleAnaglyphWindow (w);
- else if (!isAnaglyph && aw->isAnaglyph)
- toggleAnaglyphWindow (w);
- }
- }
- break;
- default:
- break;
- }
-}
-
-// ------------------------------------------------------------------------------- OBJECT ADD
-
-static void
-anaglyphObjectAdd (CompObject *parent,
- CompObject *object)
-{
- static ObjectAddProc dispTab[] = {
- (ObjectAddProc) 0, /* CoreAdd */
- (ObjectAddProc) 0, /* DisplayAdd */
- (ObjectAddProc) 0, /* ScreenAdd */
- (ObjectAddProc) anaglyphWindowAdd
- };
-
- ANAGLYPH_CORE (&core);
-
- UNWRAP (ac, &core, objectAdd);
- (*core.objectAdd) (parent, object);
- WRAP (ac, &core, objectAdd, anaglyphObjectAdd);
-
- DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), (parent, object));
-}
-
-// ------------------------------------------------------------------------------- CORE
-
-static Bool
-anaglyphInitCore (CompPlugin *p,
- CompCore *c)
-{
- AnaglyphCore *ac;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- ac = malloc (sizeof (AnaglyphCore));
- if (!ac)
- return FALSE;
-
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- {
- free (ac);
- return FALSE;
- }
-
- WRAP (ac, c, objectAdd, anaglyphObjectAdd);
-
- c->base.privates[corePrivateIndex].ptr = ac;
-
- return TRUE;
-}
-
-
-static void
-anaglyphFiniCore (CompPlugin *p,
- CompCore *c)
-{
- ANAGLYPH_CORE (c);
-
- freeDisplayPrivateIndex (displayPrivateIndex);
-
- UNWRAP (ac, c, objectAdd);
-
- free (ac);
-}
-
-// ------------------------------------------------------------------------------- DISPLAY
-
-static Bool
-anaglyphInitDisplay (CompPlugin *p, CompDisplay *d)
-{
- AnaglyphDisplay *ad;
-
- ad = malloc (sizeof (AnaglyphDisplay));
- if (!ad)
- return FALSE;
-
-
- ad->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (ad->screenPrivateIndex < 0)
- {
- free (ad);
- return FALSE;
- }
-
- anaglyphSetWindowToggleKeyInitiate (d, anaglyphAnaglyphWindow);
- anaglyphSetScreenToggleKeyInitiate (d, anaglyphAnaglyphScreen);
- anaglyphSetWindowToggleButtonInitiate (d, anaglyphAnaglyphWindow);
- anaglyphSetScreenToggleButtonInitiate (d, anaglyphAnaglyphScreen);
-
- d->base.privates[displayPrivateIndex].ptr = ad;
-
- return TRUE;
-}
-
-static void
-anaglyphFiniDisplay (CompPlugin *p, CompDisplay *d)
-{
- ANAGLYPH_DISPLAY (d);
-
- freeScreenPrivateIndex (d, ad->screenPrivateIndex);
-
- free (ad);
-}
-
-// ------------------------------------------------------------------------------- SCREEN
-
-static Bool
-anaglyphInitScreen (CompPlugin *p, CompScreen *s)
-{
- AnaglyphScreen *as;
-
- ANAGLYPH_DISPLAY (s->display);
-
- as = malloc (sizeof (AnaglyphScreen));
- if (!as)
- return FALSE;
-
- as->windowPrivateIndex = allocateWindowPrivateIndex(s);
- if (as->windowPrivateIndex < 0)
- {
- free(as);
- return FALSE;
- }
-
- as->isAnaglyph = FALSE;
- as->isDamage = FALSE;
-
- anaglyphSetAnaglyphMatchNotify (s, anaglyphScreenOptionChanged);
- anaglyphSetExcludeMatchNotify (s, anaglyphScreenOptionChanged);
-
- WRAP(as, s, paintOutput, anaglyphPaintOutput);
- WRAP(as, s, paintWindow, anaglyphDrawWindow);
- WRAP(as, s, damageWindowRect, anaglyphDamageWindowRect);
-
- s->base.privates[ad->screenPrivateIndex].ptr = as;
-
- return TRUE;
-}
-
-static void
-anaglyphFiniScreen (CompPlugin *p, CompScreen *s)
-{
- ANAGLYPH_SCREEN (s);
-
- freeWindowPrivateIndex (s, as->windowPrivateIndex);
-
- UNWRAP(as, s, paintOutput);
- UNWRAP(as, s, paintWindow);
- UNWRAP(as, s, damageWindowRect);
-
- free (as);
-}
-
-// ------------------------------------------------------------------------------- WINDOW
-
-static Bool anaglyphInitWindow(CompPlugin * p, CompWindow * w)
-{
- AnaglyphWindow *aw;
-
- ANAGLYPH_SCREEN(w->screen);
-
- aw = malloc(sizeof(AnaglyphWindow));
- if (!aw)
- return FALSE;
-
- aw->isAnaglyph = FALSE;
-
- w->base.privates[as->windowPrivateIndex].ptr = aw;
-
- return TRUE;
-}
-
-static void anaglyphFiniWindow(CompPlugin * p, CompWindow * w)
-{
- ANAGLYPH_WINDOW(w);
-
- free(aw);
-}
-
-// ------------------------------------------------------------------------------- INITFINI
-
-/*
- * anaglyphInit
- *
- */
-
-static Bool
-anaglyphInit (CompPlugin *p)
-{
- corePrivateIndex = allocateCorePrivateIndex ();
- if (corePrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * anaglyphFini
- *
- */
-
-static void
-anaglyphFini (CompPlugin *p)
-{
-
- if (corePrivateIndex >= 0)
- freeCorePrivateIndex (corePrivateIndex);
-
-}
-
-// ------------------------------------------------------------------------------- OBJECTS
-
-static CompBool
-anaglyphInitObjects(CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) anaglyphInitCore,
- (InitPluginObjectProc) anaglyphInitDisplay,
- (InitPluginObjectProc) anaglyphInitScreen,
- (InitPluginObjectProc) anaglyphInitWindow
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-
-}
-
-static void
-anaglyphFiniObjects(CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) anaglyphFiniCore,
- (FiniPluginObjectProc) anaglyphFiniDisplay,
- (FiniPluginObjectProc) anaglyphFiniScreen,
- (FiniPluginObjectProc) anaglyphFiniWindow
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static CompPluginVTable anaglyphVTable = {
- "anaglyph",
- 0,
- anaglyphInit,
- anaglyphFini,
- anaglyphInitObjects,
- anaglyphFiniObjects,
- 0,
- 0
-};
-
-CompPluginVTable*
-getCompPluginInfo(void)
-{
- return &anaglyphVTable;
-}
diff --git a/anaglyph.xml.in b/anaglyph.xml.in
index 50f2870..f1acbc2 100644
--- a/anaglyph.xml.in
+++ b/anaglyph.xml.in
@@ -10,8 +10,12 @@
<plugin>shift</plugin>
<plugin>scale</plugin>
</relation>
+ <requirement>
+ <plugin>opengl</plugin>
+ <plugin>composite</plugin>
+ </requirement>
</deps>
- <display>
+ <options>
<option name="window_toggle_key" type="key">
<_short>Initiate Window</_short>
<_long>Start anaglyph window</_long>
@@ -28,8 +32,6 @@
<_short>Initiate Screen Button</_short>
<_long>Start anaglyph screen</_long>
</option>
- </display>
- <screen>
<option name="anaglyph_match" type="match">
<_short>Anaglyph Windows</_short>
<_long>Windows to be anaglyph by default</_long>
@@ -66,6 +68,6 @@
<_long>Mipmaps</_long>
<default>false</default>
</option>
- </screen>
+ </options>
</plugin>
</compiz>
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 9fb1c39..0000000
--- a/plugin.info
+++ /dev/null
@@ -1 +0,0 @@
-PLUGIN = anaglyph
diff --git a/src/anaglyph.cpp b/src/anaglyph.cpp
new file mode 100644
index 0000000..cd471a6
--- /dev/null
+++ b/src/anaglyph.cpp
@@ -0,0 +1,302 @@
+/**
+ * Compiz Anaglyph plugin
+ *
+ * anaglyph.cpp
+ * Copyright (c) 2007 Patryk Kowalczyk <wodor@wodor.org>
+ * Ported to Compiz 0.9.x
+ * Copyright (c) 2010 Sam Spilsbury <smspillaz@gmail.com>
+ * Copyright (c) 2010 Scott Moreau
+ *
+ *
+ * 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.
+ *
+ * Author: Patryk Kowalczyk <wodor@wodor.org>
+ **/
+
+#include "anaglyph.h"
+
+COMPIZ_PLUGIN_20090315 (anaglyph, AnaglyphPluginVTable);
+
+void
+AnaglyphWindow::toggle ()
+{
+ ANAGLYPH_SCREEN (screen);
+ mIsAnaglyph = !mIsAnaglyph;
+
+ if (as->optionGetExcludeMatch ().evaluate (window) ||
+ window->overrideRedirect ())
+ {
+ mIsAnaglyph = false;
+ }
+}
+
+void
+AnaglyphScreen::toggle ()
+{
+ mIsAnaglyph = !mIsAnaglyph;
+
+ foreach (CompWindow *w, screen->windows ())
+ {
+ AnaglyphWindow::get (w)->toggle ();
+ }
+}
+
+bool
+AnaglyphScreen::anaglyphWindow (CompOption::Vector options)
+{
+ CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (options,
+ "window",
+ 0));
+ if (w)
+ AnaglyphWindow::get (w)->toggle ();
+
+ return true;
+}
+
+bool
+AnaglyphScreen::anaglyphScreen ()
+{
+ toggle ();
+
+ return true;
+}
+
+//------------------------------------------ MASTER FUNCTION
+
+bool
+AnaglyphWindow::glPaint (const GLWindowPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ unsigned int mask)
+{
+ bool status;
+ ANAGLYPH_SCREEN(screen);
+
+ if (mIsAnaglyph && gWindow->textures ().size ())
+ {
+ //if (as->isAnaglyph)
+ // aw->isAnaglyph = FALSE;
+
+ GLuint oldFilter = as->gScreen->textureFilter ();
+
+ if (as->optionGetMipmaps ())
+ as->gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
+
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+
+ GLMatrix sTransform (transform);
+ GLWindowPaintAttrib wAttrib (attrib);
+
+ float offset = as->optionGetOffset ();
+ float desktopOffset = as->optionGetDesktopOffset ();
+
+ if (as->optionGetDesaturate ())
+ wAttrib.saturation = 0.0f;
+
+ gWindow->glPaintSetEnabled (this, false);
+
+ //BLUE and ...
+ glColorMask(GL_FALSE,GL_TRUE,GL_TRUE,GL_FALSE);
+ if (window->type () & CompWindowTypeDesktopMask) //desktop
+ sTransform.translate (offset * desktopOffset, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateShadedMask)
+ sTransform.translate (0.0f, 0.0f, 0.0f);
+ else if ((window->state () & CompWindowStateMaximizedHorzMask) ||
+ (window->state () & CompWindowStateMaximizedVertMask ))
+ sTransform.translate (-offset * 3.5, 0.0f, 0.0f);
+ else if (window->type () & CompWindowTypeDockMask) // dock
+ sTransform.translate (0.0f, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateStickyMask) // sticky
+ sTransform.translate (offset * desktopOffset, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateBelowMask) //below
+ sTransform.translate (offset, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateAboveMask) // above
+ sTransform.translate (-offset * 4.0, 0.0f, 0.0f);
+ else if (window->id () == screen->activeWindow ()) // active window
+ sTransform.translate (-offset * 3.0, 0.0f, 0.0f);
+ else //other windows
+ sTransform.translate (-offset, 0.0f, 0.0f);
+
+ status = gWindow->glPaint (wAttrib, sTransform, region, mask);
+
+ //RED
+ glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_FALSE);
+ if (window->type () & CompWindowTypeDesktopMask) //desktop
+ sTransform.translate (-offset * 2.0 * desktopOffset, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateShadedMask)
+ sTransform.translate (0.0f, 0.0f, 0.0f);
+ else if ((window->state () & CompWindowStateMaximizedHorzMask) ||
+ (window->state () & CompWindowStateMaximizedVertMask ))
+ sTransform.translate (offset *3.5, 0.0f, 0.0f);
+ else if (window->type () & CompWindowTypeDockMask)// dock
+ sTransform.translate (0.0f, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateStickyMask) // sticky
+ sTransform.translate (-offset * 2.0 * desktopOffset, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateBelowMask) //below
+ sTransform.translate (-offset * 2.0, 0.0f, 0.0f);
+ else if (window->state () & CompWindowStateAboveMask) //above
+ sTransform.translate (offset * 4.0, 0.0f, 0.0f);
+ else if (window->id () == screen->activeWindow ()) // active window
+ sTransform.translate (offset * 3.0, 0.0f, 0.0f);
+ else //other windows
+ sTransform.translate (offset * 2.0, 0.0f, 0.0f);
+
+ status = gWindow->glPaint (wAttrib, sTransform, region, mask);
+
+ gWindow->glPaintSetEnabled (this, true);
+
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+
+ as->gScreen->setTextureFilter (oldFilter);
+ }
+ else
+ {
+ status = gWindow->glPaint (attrib, transform, region, mask);
+ }
+ return status;
+}
+
+//------------------------------------------------------------------------------DAMAGE FUNCTION
+
+bool
+AnaglyphWindow::damageRect (bool initial,
+ const CompRect &rect)
+{
+ bool status = false;
+
+ ANAGLYPH_SCREEN(screen);
+
+ if (mIsAnaglyph || as->mIsAnaglyph || as->mIsDamage)
+ {
+ as->mIsDamage = TRUE;
+ if (!mIsAnaglyph && !mIsAnaglyph)
+ as->mIsDamage = FALSE;
+
+ as->cScreen->damageScreen ();
+ status = TRUE;
+ }
+
+ status |= cWindow->damageRect (initial, rect);
+
+ return status;
+}
+
+//----------------------------------------------------------------------------------- PAINT OUTPUT
+
+bool
+AnaglyphScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+
+ return gScreen->glPaintOutput (attrib, transform, region, output, mask);
+}
+
+//------------------------------------------------------------------------------
+
+void
+AnaglyphScreen::optionChanged (CompOption *option,
+ Options num)
+{
+ switch (num)
+ {
+ case AnaglyphOptions::AnaglyphMatch:
+ case AnaglyphOptions::ExcludeMatch:
+ {
+ foreach (CompWindow *w, screen->windows ())
+ {
+ bool isAnaglyph;
+
+ ANAGLYPH_WINDOW (w);
+
+ isAnaglyph = optionGetAnaglyphMatch ().evaluate (w);
+ isAnaglyph = isAnaglyph &&
+ !optionGetExcludeMatch ().evaluate (w);
+
+ if (isAnaglyph && mIsAnaglyph && !aw->mIsAnaglyph)
+ aw->toggle ();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+//----------------------------------------------------------------------- SCREEN
+
+AnaglyphScreen::AnaglyphScreen (CompScreen *s) :
+ PluginClassHandler <AnaglyphScreen, CompScreen> (s),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ mIsAnaglyph (false),
+ mIsDamage (false)
+{
+ CompositeScreenInterface::setHandler (cScreen);
+ GLScreenInterface::setHandler (gScreen);
+
+ optionSetWindowToggleKeyInitiate (boost::bind
+ (&AnaglyphScreen::anaglyphWindow, this,
+ _3));
+ optionSetScreenToggleKeyInitiate (boost::bind
+ (&AnaglyphScreen::anaglyphScreen, this));
+ optionSetWindowToggleKeyInitiate (boost::bind
+ (&AnaglyphScreen::anaglyphWindow, this,
+ _3));
+ optionSetScreenToggleKeyInitiate (boost::bind
+ (&AnaglyphScreen::anaglyphScreen, this));
+
+ optionSetAnaglyphMatchNotify (boost::bind (&AnaglyphScreen::optionChanged,
+ this, _1, _2));
+ optionSetExcludeMatchNotify (boost::bind (&AnaglyphScreen::optionChanged,
+ this, _1, _2));
+}
+
+AnaglyphScreen::~AnaglyphScreen ()
+{
+}
+
+//----------------------------------------------------------------------- WINDOW
+
+AnaglyphWindow::AnaglyphWindow (CompWindow *w) :
+ PluginClassHandler <AnaglyphWindow, CompWindow> (w),
+ window (w),
+ gWindow (GLWindow::get (w)),
+ cWindow (CompositeWindow::get (w)),
+ mIsAnaglyph (false)
+{
+ ANAGLYPH_SCREEN (screen);
+
+ CompositeWindowInterface::setHandler (cWindow);
+ GLWindowInterface::setHandler (gWindow);
+
+ if (as->mIsAnaglyph && as->optionGetAnaglyphMatch ().evaluate (w))
+ toggle ();
+}
+
+AnaglyphWindow::~AnaglyphWindow ()
+{
+}
+
+bool
+AnaglyphPluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ return false;
+
+ return true;
+}
diff --git a/src/anaglyph.h b/src/anaglyph.h
new file mode 100644
index 0000000..7aa6f14
--- /dev/null
+++ b/src/anaglyph.h
@@ -0,0 +1,110 @@
+
+ /**
+ * Compiz Anaglyph plugin
+ *
+ * anaglyph.cpp
+ * Copyright (c) 2007 Patryk Kowalczyk <wodor@wodor.org>
+ * Ported to Compiz 0.9.x
+ * Copyright (c) 2010 Sam Spilsbury <smspillaz@gmail.com>
+ * Copyright (c) 2010 Scott Moreau
+ *
+ *
+ * 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.
+ *
+ * Author: Patryk Kowalczyk <wodor@wodor.org>
+ **/
+
+#include <core/core.h>
+#include <composite/composite.h>
+#include <opengl/opengl.h>
+
+#include "anaglyph_options.h"
+
+class AnaglyphScreen :
+ public PluginClassHandler <AnaglyphScreen, CompScreen>,
+ public CompositeScreenInterface,
+ public GLScreenInterface,
+ public AnaglyphOptions
+{
+ public:
+
+ AnaglyphScreen (CompScreen *);
+ ~AnaglyphScreen ();
+
+ public:
+
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+
+ bool mIsAnaglyph;
+ bool mIsDamage;
+
+ void toggle ();
+
+ bool anaglyphWindow (CompOption::Vector options);
+ bool anaglyphScreen ();
+
+ void
+ optionChanged (CompOption *, Options);
+
+ bool
+ glPaintOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &,
+ const CompRegion &,
+ CompOutput *,
+ unsigned int);
+};
+
+#define ANAGLYPH_SCREEN(s) \
+ AnaglyphScreen *as = AnaglyphScreen::get (s);
+
+
+class AnaglyphWindow :
+ public PluginClassHandler <AnaglyphWindow, CompWindow>,
+ public CompositeWindowInterface,
+ public GLWindowInterface
+{
+ public:
+
+ AnaglyphWindow (CompWindow *w);
+ ~AnaglyphWindow ();
+
+ public:
+
+ CompWindow *window;
+ GLWindow *gWindow;
+ CompositeWindow *cWindow;
+
+ bool mIsAnaglyph;
+
+ void toggle ();
+
+ bool
+ glPaint (const GLWindowPaintAttrib &,
+ const GLMatrix &,
+ const CompRegion &,
+ unsigned int );
+
+ bool
+ damageRect (bool, const CompRect &);
+
+};
+
+#define ANAGLYPH_WINDOW(w) \
+ AnaglyphWindow *aw = AnaglyphWindow::get (w);
+
+class AnaglyphPluginVTable :
+ public CompPlugin::VTableForScreenAndWindow <AnaglyphScreen, AnaglyphWindow>
+{
+ public:
+
+ bool init ();
+}; \ No newline at end of file