summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <SmSpillaz@gmail.com>2010-05-11 19:58:43 +0800
committerSam Spilsbury <SmSpillaz@gmail.com>2010-05-11 19:58:43 +0800
commitc15d19b46ae0124d71221afc67342f7a755581ca (patch)
tree3476825999ee1538a3d7e22932defbc5b82d1ddd
parentc1616f9b42c23a8f57e1b3384b460111a00652d9 (diff)
downloadstatic-c15d19b46ae0124d71221afc67342f7a755581ca.tar.gz
static-c15d19b46ae0124d71221afc67342f7a755581ca.tar.bz2
C++ port of the static plugin
-rw-r--r--CMakeLists.txt5
-rw-r--r--Makefile463
-rw-r--r--plugin.info1
-rw-r--r--src/static.cpp187
-rw-r--r--src/static.h125
-rw-r--r--static.c333
-rw-r--r--static.xml.in16
7 files changed, 327 insertions, 803 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..96f9f98
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,5 @@
+find_package (Compiz REQUIRED)
+
+include (CompizPlugin)
+
+compiz_plugin (static PLUGINDEPS composite opengl)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index e1835ab..0000000
--- a/Makefile
+++ /dev/null
@@ -1,463 +0,0 @@
-##
-#
-# Compiz plugin Makefile
-#
-# Copyright : (C) 2007 by Dennis Kasprzyk
-# E-mail : onestone@deltatauchi.de
-#
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-##
-
-# plugin.info file contents
-#
-# PLUGIN = foo
-# PKG_DEP = pango
-# LDFLAGS_ADD = -lGLU
-# CFLAGS_ADD = -I/usr/include/foo
-#
-
-#load config file
-include plugin.info
-
-
-ifeq ($(BUILD_GLOBAL),true)
- PREFIX = $(shell pkg-config --variable=prefix compiz)
- CLIBDIR = $(shell pkg-config --variable=libdir compiz)
- CINCDIR = $(shell pkg-config --variable=includedir compiz)
- PKGDIR = $(CLIBDIR)/pkgconfig
- DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz
- XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
- DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz
-else
- DESTDIR = $(HOME)/.compiz/plugins
- XMLDIR = $(HOME)/.compiz/metadata
- IMAGEDIR = $(HOME)/.compiz/images
- DATADIR = $(HOME)/.compiz/data
-endif
-
-BUILDDIR = build
-
-ECHO = `which echo`
-
-CC = gcc
-CPP = g++
-LIBTOOL = libtool
-INSTALL = install
-
-BCOP = `pkg-config --variable=bin bcop`
-
-CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD)
-LDFLAGS = `pkg-config --libs $(PKG_DEP) compiz ` $(LDFLAGS_ADD)
-
-DEFINES = -DIMAGEDIR=$(IMAGEDIR) -DDATADIR=$(DATADIR)
-
-POFILEDIR = $(shell if [ -n "$(PODIR)" ]; then $(ECHO) $(PODIR); else $(ECHO) ./po;fi )
-
-is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in | grep "useBcop=\"true\""; \
- else if [ -e $(PLUGIN).xml ]; then cat $(PLUGIN).xml | grep "useBcop=\"true\""; fi; fi)
-
-trans-target := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml;fi )
-
-bcop-target := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-bcop-target-src := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.c; fi )
-bcop-target-hdr := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.h; fi )
-
-gen-schemas := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml -a -n "`pkg-config --variable=xsltdir compiz-gconf`" ]; then $(ECHO) true; fi )
-schema-target := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi )
-schema-output := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/compiz-$(PLUGIN).schema; fi )
-
-ifeq ($(BUILD_GLOBAL),true)
- pkg-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" ]; then $(ECHO) "$(BUILDDIR)/compiz-$(PLUGIN).pc"; fi )
- hdr-install-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" -a -e $(PLUGIN).h ]; then $(ECHO) "$(PLUGIN).h"; fi )
-endif
-
-# find all the object files
-
-c-objs := $(patsubst %.c,%.lo,$(shell find -name '*.c' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs += $(patsubst %.cxx,%.lo,$(shell find -name '*.cxx' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///'))
-c-objs := $(filter-out $(bcop-target-src:.c=.lo),$(c-objs))
-
-h-files := $(shell find -name '*.h' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')
-h-files += $(bcop-target-hdr)
-h-files += $(shell pkg-config --variable=includedir compiz)/compiz/compiz.h
-
-all-c-objs := $(addprefix $(BUILDDIR)/,$(c-objs))
-all-c-objs += $(bcop-target-src:.c=.lo)
-
-# additional files
-
-data-files := $(shell find data/ -name '*' -type f 2> /dev/null | sed -e 's/data\///')
-image-files := $(shell find images/ -name '*' -type f 2> /dev/null | sed -e 's/images\///')
-
-# system include path parameter, -isystem doesn't work on old gcc's
-inc-path-param = $(shell if [ -z "`gcc --version | head -n 1 | grep ' 3'`" ]; then $(ECHO) "-isystem"; else $(ECHO) "-I"; fi)
-
-# default color settings
-color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi)
-
-#
-# Do it.
-#
-
-.PHONY: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-all: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin
-
-trans-build: $(trans-target)
-
-bcop-build: $(bcop-target-hdr) $(bcop-target-src)
-
-schema-creation: $(schema-output)
-
-c-build-objs: $(all-c-objs)
-
-c-link-plugin: $(BUILDDIR)/lib$(PLUGIN).la
-
-pkg-creation: $(pkg-target)
-
-#
-# Create build directory
-#
-
-$(BUILDDIR) :
- @mkdir -p $(BUILDDIR)
-
-$(DESTDIR) :
- @mkdir -p $(DESTDIR)
-
-#
-# fallback if xml.in doesn't exists
-#
-$(BUILDDIR)/%.xml: %.xml
- @cp $< $@
-
-#
-# Translating
-#
-$(BUILDDIR)/%.xml: %.xml.in
- @if [ -d $(POFILEDIR) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mtranslate \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "translate $< -> $@"; \
- fi; \
- intltool-merge -x -u $(POFILEDIR) $< $@ > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mtranslate : \033[34m$< -> $@\033[0m"; \
- fi; \
- else \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mconvert \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "convert $< -> $@"; \
- fi; \
- cat $< | sed -e 's;<_;<;g' -e 's;</_;</;g' > $@; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mconvert : \033[34m$< -> $@\033[0m"; \
- fi; \
- fi
-
-#
-# BCOP'ing
-
-$(BUILDDIR)/%_options.h: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --header=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%_options.c: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "bcop'ing $< -> $@"; \
- fi
- @$(BCOP) --source=$@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Schema generation
-
-$(BUILDDIR)/compiz-%.schema: $(BUILDDIR)/%.xml
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mschema'ing\033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "schema'ing $< -> $@"; \
- fi
- @xsltproc `pkg-config --variable=xsltdir compiz-gconf`/schemas.xslt $< > $@
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mschema : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# pkg config file generation
-
-$(BUILDDIR)/compiz-%.pc: compiz-%.pc.in
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mpkgconfig \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "pkgconfig $< -> $@"; \
- fi
- @COMPIZREQUIRES=`cat $(PKGDIR)/compiz.pc | grep Requires | sed -e 's;Requires: ;;g'`; \
- COMPIZCFLAGS=`cat $(PKGDIR)/compiz.pc | grep Cflags | sed -e 's;Cflags: ;;g'`; \
- sed -e 's;@prefix@;$(PREFIX);g' -e 's;\@libdir@;$(CLIBDIR);g' \
- -e 's;@includedir@;$(CINCDIR);g' -e 's;\@VERSION@;0.0.1;g' \
- -e "s;@COMPIZ_REQUIRES@;$$COMPIZREQUIRES;g" \
- -e "s;@COMPIZ_CFLAGS@;$$COMPIZCFLAGS;g" $< > $@;
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mpkgconfig : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Compiling
-#
-
-$(BUILDDIR)/%.lo: %.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: $(BUILDDIR)/%.c $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cpp $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-$(BUILDDIR)/%.lo: %.cxx $(h-files)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "compiling $< -> $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $<
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \
- fi
-
-#
-# Linking
-#
-
-cxx-rpath-prefix := -Wl,-rpath,
-
-$(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mlinking \033[0m: \033[0;31m$@\033[0m"; \
- else \
- $(ECHO) "linking : $@"; \
- fi
- @$(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mlinking : \033[34m$@\033[0m"; \
- fi
-
-
-clean:
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e -n "\033[0;1;5mremoving \033[0m: \033[0;31m./$(BUILDDIR)\033[0m"; \
- else \
- $(ECHO) "removing : ./$(BUILDDIR)"; \
- fi
- @rm -rf $(BUILDDIR)
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0mremoving : \033[34m./$(BUILDDIR)\033[0m"; \
- fi
-
-
-install: $(DESTDIR) all
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "install : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi
- @mkdir -p $(DESTDIR)
- @$(INSTALL) $(BUILDDIR)/.libs/lib$(PLUGIN).so $(DESTDIR)/lib$(PLUGIN).so
- @if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi
- @if [ -e $(BUILDDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "install : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- mkdir -p $(XMLDIR); \
- cp $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- cp $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- cp $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
- else \
- $(ECHO) "install : $(schema-output)"; \
- fi; \
- gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- mkdir -p $(DATADIR); \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(DATADIR)/$$FILE"; \
- fi; \
- cp data/$$FILE $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- mkdir -p $(IMAGEDIR); \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \
- fi; \
- cp images/$$FILE $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
-
-uninstall:
- @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \
- fi; \
- rm -f $(DESTDIR)/lib$(PLUGIN).so; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
- fi; \
- fi
- @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- else \
- $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \
- fi; \
- rm -f $(XMLDIR)/$(PLUGIN).xml; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
- fi; \
- fi
- @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- else \
- $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \
- fi; \
- rm -f $(CINCDIR)/compiz/$(hdr-install-target); \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
- fi; \
- fi
- @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- else \
- $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
- fi; \
- rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
- fi; \
- fi
- @if [ -n "$(data-files)" ]; then \
- for FILE in $(data-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \
- fi; \
- rm -f $(DATADIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
- @if [ -n "$(image-files)" ]; then \
- for FILE in $(image-files); do \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
- else \
- $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \
- fi; \
- rm -f $(IMAGEDIR)/$$FILE; \
- if [ '$(color)' != 'no' ]; then \
- $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
- fi; \
- done \
- fi
diff --git a/plugin.info b/plugin.info
deleted file mode 100644
index 684dd63..0000000
--- a/plugin.info
+++ /dev/null
@@ -1 +0,0 @@
-PLUGIN = static
diff --git a/src/static.cpp b/src/static.cpp
new file mode 100644
index 0000000..aa088b4
--- /dev/null
+++ b/src/static.cpp
@@ -0,0 +1,187 @@
+/*
+ * Compiz Static Windows plugin
+ *
+ * static.c
+ *
+ * Copyright : (C) 2008 by Mark Thomas
+ * E-mail : markbt@efaref.net
+ *
+ *
+ * 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 "static.h"
+
+COMPIZ_PLUGIN_20090315 (static, StaticPluginVTable);
+
+bool
+StaticWindow::isStatic ()
+{
+ return StaticScreen::get (screen)->optionGetWindowMatch ().evaluate (window);
+}
+
+void
+StaticScreen::preparePaint (int msSinceLastPaint)
+{
+ /* Initially we are painting all windows.
+ * This may change if we switch to transformed mode.
+ */
+ mStaticMode = STATIC_ALL;
+
+ cScreen->preparePaint (msSinceLastPaint);
+}
+
+void
+StaticScreen::glPaintTransformedOutput (const GLScreenPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ /* We are now painting in transformed mode.
+ * Start painting only normal windows.
+ */
+ mStaticMode = STATIC_NORMAL;
+
+ gScreen->glPaintTransformedOutput (attrib, transform, region, output, mask);
+}
+
+void
+StaticScreen::glApplyTransform (const GLScreenPaintAttrib &attrib,
+ CompOutput *output,
+ GLMatrix *transform)
+{
+ if (mStaticMode == STATIC_STATIC)
+ {
+ //int oldNumber = gScreen->glApplyTransformGetCurrentIndex ();
+ //gScreen->glApplyTransformSetCurrentIndex (MAXSHORT);
+ gScreen->glApplyTransform (attrib, output, transform);
+ //gScreen->glApplyTransformSetCurrentIndex (oldNumber);
+ }
+ else
+ {
+ gScreen->glApplyTransform (attrib, output, transform);
+ }
+}
+
+bool
+StaticScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ bool status;
+
+ status = gScreen->glPaintOutput (attrib, transform, region, output, mask);
+
+ if (mStaticMode == STATIC_NORMAL)
+ {
+ GLMatrix sTransform (transform);
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+ /* We switched to Transformed mode somewhere along the line.
+ * Now paint the dock windows untransformed by bypassing
+ * the virtual table.
+ */
+ //mask &= ~PAINT_SCREEN_CLEAR_MASK;
+
+ mStaticMode = STATIC_STATIC;
+
+ foreach (CompWindow *w, screen->windows ())
+ {
+ STATIC_WINDOW (w);
+
+ if (!sw->isStatic ())
+ continue;
+
+ if (!output->contains (w->inputRect ()))
+ continue;
+
+ GLMatrix wMatrix;
+ GLFragment::Attrib fragment (sw->gWindow->paintAttrib ());
+
+ wMatrix.toScreenSpace (&screen->currentOutputDev (), -DEFAULT_Z_CAMERA);
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+
+ int oldIndex = sw->gWindow->glAddGeometryGetCurrentIndex ();
+ glPushMatrix ();
+ glLoadMatrixf (wMatrix.getMatrix ());
+ sw->gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
+ status = sw->gWindow->glDraw (wMatrix, fragment, infiniteRegion, mask);
+ sw->gWindow->glAddGeometrySetCurrentIndex (oldIndex);
+ glPopMatrix ();
+
+ mStaticMode = STATIC_NORMAL;
+ }
+ }
+
+ return status;
+}
+
+
+bool
+StaticWindow::glPaint (const GLWindowPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ unsigned int mask)
+{
+ bool status = TRUE;
+ STATIC_SCREEN (screen);
+
+ if (ss->mStaticMode == STATIC_STATIC && isStatic ())
+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
+
+ status = gWindow->glPaint (attrib, transform, region, mask);
+
+ return status;
+}
+
+
+StaticScreen::StaticScreen (CompScreen *screen) :
+ PluginClassHandler <StaticScreen, CompScreen> (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ mStaticMode (STATIC_ALL)
+{
+ CompositeScreenInterface::setHandler (cScreen);
+ GLScreenInterface::setHandler (gScreen);
+}
+
+StaticScreen::~StaticScreen ()
+{
+}
+
+StaticWindow::StaticWindow (CompWindow *window) :
+ PluginClassHandler <StaticWindow, CompWindow> (window),
+ window (window),
+ cWindow (CompositeWindow::get (window)),
+ gWindow (GLWindow::get (window))
+{
+ GLWindowInterface::setHandler (gWindow);
+}
+
+StaticWindow::~StaticWindow ()
+{
+}
+
+bool
+StaticPluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ return false;
+ else
+ return true;
+}
diff --git a/src/static.h b/src/static.h
new file mode 100644
index 0000000..d17c02b
--- /dev/null
+++ b/src/static.h
@@ -0,0 +1,125 @@
+/*
+ * Compiz Static Windows plugin
+ *
+ * static.h
+ *
+ * Copyright : (C) 2008 by Mark Thomas
+ * E-mail : markbt@efaref.net
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <core/core.h>
+#include <core/pluginclasshandler.h>
+#include <opengl/opengl.h>
+#include <composite/composite.h>
+
+#include "static_options.h"
+
+typedef enum _StaticMode
+{
+ STATIC_ALL,
+ STATIC_NORMAL,
+ STATIC_STATIC
+}
+StaticMode;
+
+class StaticScreen :
+ public PluginClassHandler <StaticScreen, CompScreen>,
+ public GLScreenInterface,
+ public CompositeScreenInterface,
+ public StaticOptions
+{
+ public:
+
+ StaticScreen (CompScreen *);
+ ~StaticScreen ();
+
+ public:
+
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+
+ public:
+
+ bool
+ glPaintOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &,
+ const CompRegion &,
+ CompOutput *,
+ unsigned int );
+
+ void
+ glApplyTransform (const GLScreenPaintAttrib &,
+ CompOutput *,
+ GLMatrix *);
+
+ void
+ glPaintTransformedOutput (const GLScreenPaintAttrib &,
+ const GLMatrix &,
+ const CompRegion &,
+ CompOutput *,
+ unsigned int );
+
+ void
+ preparePaint (int);
+
+ public:
+
+ StaticMode mStaticMode;
+ bool mPaintingStatic;
+};
+
+#define STATIC_SCREEN(s) \
+ StaticScreen *ss = StaticScreen::get (s);
+
+class StaticWindow :
+ public PluginClassHandler <StaticWindow, CompWindow>,
+ public GLWindowInterface
+{
+ public:
+
+ StaticWindow (CompWindow *);
+ ~StaticWindow ();
+
+ public:
+
+ CompWindow *window;
+ CompositeWindow *cWindow;
+ GLWindow *gWindow;
+
+ public:
+
+ bool
+ glPaint (const GLWindowPaintAttrib &,
+ const GLMatrix &,
+ const CompRegion &,
+ unsigned int );
+
+ public:
+
+ bool
+ isStatic ();
+
+};
+
+#define STATIC_WINDOW(w) \
+ StaticWindow *sw = StaticWindow::get (w)
+
+class StaticPluginVTable :
+ public CompPlugin::VTableForScreenAndWindow <StaticScreen, StaticWindow>
+{
+ public:
+
+ bool init ();
+};
diff --git a/static.c b/static.c
deleted file mode 100644
index 0275438..0000000
--- a/static.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Compiz Static Windows plugin
- *
- * static.c
- *
- * Copyright : (C) 2008 by Mark Thomas
- * E-mail : markbt@efaref.net
- *
- *
- * 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 <compiz-core.h>
-
-#include "static_options.h"
-
-static int displayPrivateIndex;
-
-typedef struct _StaticDisplay
-{
- int screenPrivateIndex;
-}
-StaticDisplay;
-
-typedef enum _StaticMode
-{
- STATIC_ALL,
- STATIC_NORMAL,
- STATIC_STATIC
-}
-StaticMode;
-
-typedef struct _StaticScreen
-{
- PaintWindowProc paintWindow;
- PaintOutputProc paintOutput;
- ApplyScreenTransformProc applyScreenTransform;
- PaintTransformedOutputProc paintTransformedOutput;
- PreparePaintScreenProc preparePaintScreen;
-
- StaticMode staticMode;
-}
-StaticScreen;
-
-#define GET_STATIC_DISPLAY(d) \
- ((StaticDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-#define STATIC_DISPLAY(d) \
- StaticDisplay *sd = GET_STATIC_DISPLAY(d);
-
-#define GET_STATIC_SCREEN(s, sd) \
- ((StaticScreen *) (s)->base.privates[(sd)->screenPrivateIndex].ptr)
-#define STATIC_SCREEN(s) \
- StaticScreen *ss = GET_STATIC_SCREEN(s, GET_STATIC_DISPLAY(s->display))
-
-static Bool
-isStatic(CompWindow *w)
-{
- return matchEval(staticGetWindowMatch(w->screen), w);
-}
-
-static void
-staticPreparePaintScreen (CompScreen *s,
- int msSinceLastPaint)
-{
- STATIC_SCREEN(s);
-
- /* Initially we are painting all windows.
- * This may change if we switch to transformed mode.
- */
- ss->staticMode = STATIC_ALL;
-
- UNWRAP (ss, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, msSinceLastPaint);
- WRAP (ss, s, preparePaintScreen, staticPreparePaintScreen);
-}
-
-static void
-staticPaintTransformedOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- STATIC_SCREEN(s);
-
- /* We are now painting in transformed mode.
- * Start painting only normal windows.
- */
- ss->staticMode = STATIC_NORMAL;
-
- UNWRAP (ss, s, paintTransformedOutput);
- (*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (ss, s, paintTransformedOutput, staticPaintTransformedOutput);
-}
-
-static void
-staticApplyScreenTransform (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- CompOutput *output,
- CompTransform *transform)
-{
- STATIC_SCREEN(s);
-
- if (ss->staticMode == STATIC_STATIC)
- {
- applyScreenTransform (s, sAttrib, output, transform);
- }
- else
- {
- UNWRAP (ss, s, applyScreenTransform);
- (*s->applyScreenTransform) (s, sAttrib, output, transform);
- WRAP (ss, s, applyScreenTransform, staticApplyScreenTransform);
- }
-}
-
-static Bool
-staticPaintOutput(CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- Bool status;
-
- STATIC_SCREEN (s);
-
- UNWRAP (ss, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region,
- output, mask);
- WRAP (ss, s, paintOutput, staticPaintOutput);
-
- if ( ss->staticMode == STATIC_NORMAL )
- {
- CompTransform sTransform;
-
- /* We switched to Transformed mode somewhere along the line.
- * Now paint the dock windows untransformed by bypassing
- * the virtual table.
- */
- mask &= ~PAINT_SCREEN_CLEAR_MASK;
-
- ss->staticMode = STATIC_STATIC;
-
- matrixGetIdentity (&sTransform);
-
- paintTransformedOutput (s, sAttrib, &sTransform, &s->region,
- output, mask);
-
- ss->staticMode = STATIC_NORMAL;
- }
-
- return status;
-}
-
-
-static Bool
-staticPaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
-{
- CompScreen *s = w->screen;
- Bool status = TRUE;
- STATIC_SCREEN (s);
-
- if (ss->staticMode == STATIC_STATIC && !isStatic(w))
- {
- /* We are not painting normal windows */
- return FALSE;
- }
-
- if (ss->staticMode == STATIC_NORMAL && isStatic(w))
- {
- /* We are not painting static windows */
- return FALSE;
- }
-
- UNWRAP (ss, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, transform, region, mask);
- WRAP (ss, s, paintWindow, staticPaintWindow);
-
- return status;
-}
-
-
-static Bool
-staticInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- StaticScreen *ss;
-
- STATIC_DISPLAY (s->display);
-
- ss = calloc (1, sizeof (StaticScreen) );
-
- if (!ss)
- return FALSE;
-
- WRAP (ss, s, paintWindow, staticPaintWindow);
- WRAP (ss, s, paintOutput, staticPaintOutput);
- WRAP (ss, s, applyScreenTransform, staticApplyScreenTransform);
- WRAP (ss, s, paintTransformedOutput, staticPaintTransformedOutput);
- WRAP (ss, s, preparePaintScreen, staticPreparePaintScreen);
-
- s->base.privates[sd->screenPrivateIndex].ptr = ss;
-
- return TRUE;
-}
-
-static void
-staticFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- STATIC_SCREEN (s);
-
- UNWRAP (ss, s, preparePaintScreen);
- UNWRAP (ss, s, paintTransformedOutput);
- UNWRAP (ss, s, applyScreenTransform);
- UNWRAP (ss, s, paintOutput);
- UNWRAP (ss, s, paintWindow);
-
- free (ss);
-}
-
-static Bool
-staticInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- StaticDisplay *sd;
-
- sd = malloc (sizeof (StaticDisplay) );
-
- if (!sd)
- return FALSE;
-
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
-
- if (sd->screenPrivateIndex < 0)
- {
- free (sd);
- return FALSE;
- }
-
- d->base.privates[displayPrivateIndex].ptr = sd;
-
- return TRUE;
-}
-
-static void
-staticFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- STATIC_DISPLAY (d);
-
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
-
- free (sd);
-}
-
-static Bool
-staticInit (CompPlugin *p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex();
-
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-staticFini (CompPlugin *p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-static CompBool
-staticInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) staticInitDisplay,
- (InitPluginObjectProc) staticInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-staticFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) staticFiniDisplay,
- (FiniPluginObjectProc) staticFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static CompPluginVTable staticVTable = {
- "static",
- 0,
- staticInit,
- staticFini,
- staticInitObject,
- staticFiniObject,
- 0,
- 0
-};
-
-
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &staticVTable;
-}
diff --git a/static.xml.in b/static.xml.in
index b5c9aa8..5c58a7a 100644
--- a/static.xml.in
+++ b/static.xml.in
@@ -5,18 +5,22 @@
<_long>Keep windows such as dock or panels static</_long>
<category>Desktop</category>
<deps>
+ <requirement>
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
+ </requirement>
<relation type="after">
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
<plugin>3d</plugin>
- </relation>
- <relation type="before">
<plugin>expo</plugin>
<plugin>zoom</plugin>
<plugin>ezoom</plugin>
</relation>
+ <relation type="before">
+ </relation>
</deps>
- <display>
- </display>
- <screen>
+ <options>
<group>
<_short>General</_short>
<option name="window_match" type="match">
@@ -25,6 +29,6 @@
<default>Dock</default>
</option>
</group>
- </screen>
+ </options>
</plugin>
</compiz>