summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2009-05-27 14:25:58 +0800
committerSam Spilsbury <Sam@XPS-SUSE.site>2009-05-27 14:25:58 +0800
commit18f7a54238342d5db0578f3386d3697c4f4bb29d (patch)
tree3dff52fe5736f1f95ca818ed85ffc62ecf2bfb9a
parent46485724a0cc8c27b9c79fbf2320a78611438d3b (diff)
downloadwinrules-18f7a54238342d5db0578f3386d3697c4f4bb29d.tar.gz
winrules-18f7a54238342d5db0578f3386d3697c4f4bb29d.tar.bz2
Initial C++ Port
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--plugin.info1
-rw-r--r--winrules.c864
-rw-r--r--winrules.xml.in2
5 files changed, 5 insertions, 1401 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e0d31d..c84217d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
-compiz_fusion_plugin (winrules)
+include (CompizPlugin)
+
+compiz_plugin (winrules PLUGINDEPS composite)
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/plugin.info b/plugin.info
deleted file mode 100644
index a96094f..0000000
--- a/plugin.info
+++ /dev/null
@@ -1 +0,0 @@
-PLUGIN = winrules
diff --git a/winrules.c b/winrules.c
deleted file mode 100644
index 65ef417..0000000
--- a/winrules.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/*
- * winrules plugin for compiz
- *
- * Copyright (C) 2007 Bellegarde Cedric (gnumdk (at) gmail.com)
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <compiz-core.h>
-
-#include <X11/Xatom.h>
-
-#define WINRULES_SCREEN_OPTION_SKIPTASKBAR_MATCH 0
-#define WINRULES_SCREEN_OPTION_SKIPPAGER_MATCH 1
-#define WINRULES_SCREEN_OPTION_ABOVE_MATCH 2
-#define WINRULES_SCREEN_OPTION_BELOW_MATCH 3
-#define WINRULES_SCREEN_OPTION_STICKY_MATCH 4
-#define WINRULES_SCREEN_OPTION_FULLSCREEN_MATCH 5
-#define WINRULES_SCREEN_OPTION_MAXIMIZE_MATCH 6
-#define WINRULES_SCREEN_OPTION_NOARGB_MATCH 7
-#define WINRULES_SCREEN_OPTION_NOMOVE_MATCH 8
-#define WINRULES_SCREEN_OPTION_NORESIZE_MATCH 9
-#define WINRULES_SCREEN_OPTION_NOMINIMIZE_MATCH 10
-#define WINRULES_SCREEN_OPTION_NOMAXIMIZE_MATCH 11
-#define WINRULES_SCREEN_OPTION_NOCLOSE_MATCH 12
-#define WINRULES_SCREEN_OPTION_NOFOCUS_MATCH 13
-#define WINRULES_SCREEN_OPTION_SIZE_MATCHES 14
-#define WINRULES_SCREEN_OPTION_SIZE_WIDTH_VALUES 15
-#define WINRULES_SCREEN_OPTION_SIZE_HEIGHT_VALUES 16
-#define WINRULES_SCREEN_OPTION_NUM 17
-
-static CompMetadata winrulesMetadata;
-
-static int displayPrivateIndex;
-
-typedef struct _WinrulesWindow {
- unsigned int allowedActions;
- unsigned int stateSetMask;
- unsigned int protocolSetMask;
-
- Bool oldInputHint;
- Bool hasAlpha;
-} WinrulesWindow;
-
-typedef struct _WinrulesDisplay {
- int screenPrivateIndex;
-
- HandleEventProc handleEvent;
- MatchExpHandlerChangedProc matchExpHandlerChanged;
- MatchPropertyChangedProc matchPropertyChanged;
-} WinrulesDisplay;
-
-typedef struct _WinrulesScreen {
- int windowPrivateIndex;
- GetAllowedActionsForWindowProc getAllowedActionsForWindow;
- CompOption opt[WINRULES_SCREEN_OPTION_NUM];
-} WinrulesScreen;
-
-#define GET_WINRULES_DISPLAY(d) \
- ((WinrulesDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define WINRULES_DISPLAY(d) \
- WinrulesDisplay *wd = GET_WINRULES_DISPLAY (d)
-
-#define GET_WINRULES_SCREEN(s, wd) \
- ((WinrulesScreen *) (s)->base.privates[(wd)->screenPrivateIndex].ptr)
-
-#define WINRULES_SCREEN(s) \
- WinrulesScreen *ws = GET_WINRULES_SCREEN (s, \
- GET_WINRULES_DISPLAY (s->display))
-
-#define GET_WINRULES_WINDOW(w, ws) \
- ((WinrulesWindow *) (w)->base.privates[(ws)->windowPrivateIndex].ptr)
-
-#define WINRULES_WINDOW(w) \
- WinrulesWindow *ww = GET_WINRULES_WINDOW (w, \
- GET_WINRULES_SCREEN (w->screen, \
- GET_WINRULES_DISPLAY (w->screen->display)))
-
-#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-
-static void
-winrulesSetProtocols (CompDisplay *display,
- unsigned int protocols,
- Window id)
-{
- Atom protocol[4];
- int count = 0;
-
- if (protocols & CompWindowProtocolDeleteMask)
- protocol[count++] = display->wmDeleteWindowAtom;
- if (protocols & CompWindowProtocolTakeFocusMask)
- protocol[count++] = display->wmTakeFocusAtom;
- if (protocols & CompWindowProtocolPingMask)
- protocol[count++] = display->wmPingAtom;
- if (protocols & CompWindowProtocolSyncRequestMask)
- protocol[count++] = display->wmSyncRequestAtom;
-
- XSetWMProtocols (display->display, id, protocol, count);
-}
-
-static Bool
-isWinrulesWindow (CompWindow *w)
-{
- if (w->attrib.override_redirect)
- return FALSE;
-
- if (w->wmType & CompWindowTypeDesktopMask)
- return FALSE;
-
- return TRUE;
-}
-
-/* FIXME? Directly set inputHint, not a problem for now */
-static void
-winrulesSetNoFocus (CompWindow *w,
- int optNum)
-{
- unsigned int newProtocol = w->protocols;
-
- WINRULES_SCREEN (w->screen);
- WINRULES_WINDOW (w);
-
- if (!isWinrulesWindow (w))
- return;
-
- if (matchEval (&ws->opt[optNum].value.match, w))
- {
- if (w->protocols & CompWindowProtocolTakeFocusMask)
- {
- ww->protocolSetMask |= (w->protocols &
- CompWindowProtocolTakeFocusMask);
- newProtocol = w->protocols & ~CompWindowProtocolTakeFocusMask;
- }
- ww->oldInputHint = w->inputHint;
- w->inputHint = FALSE;
- }
- else if (ww->oldInputHint ||
- (ww->protocolSetMask & CompWindowProtocolTakeFocusMask))
- {
- newProtocol = w->protocols |
- (ww->protocolSetMask & CompWindowProtocolTakeFocusMask);
- ww->protocolSetMask &= ~CompWindowProtocolTakeFocusMask;
- w->inputHint = ww->oldInputHint;
- }
-
- if (newProtocol != w->protocols)
- {
- winrulesSetProtocols (w->screen->display, newProtocol, w->id);
- w->protocols = newProtocol;
- }
-}
-
-static void
-winrulesSetNoAlpha (CompWindow *w,
- int optNum)
-{
- WINRULES_SCREEN (w->screen);
- WINRULES_WINDOW (w);
-
- if (!isWinrulesWindow (w))
- return;
-
- if (matchEval (&ws->opt[optNum].value.match, w))
- {
- ww->hasAlpha = w->alpha;
- w->alpha = FALSE;
- }
- else
- {
- w->alpha = ww->hasAlpha;
- }
-}
-
-static void
-winrulesUpdateState (CompWindow *w,
- int optNum,
- int mask)
-{
- unsigned int newState = w->state;
-
- WINRULES_SCREEN (w->screen);
- WINRULES_WINDOW (w);
-
- if (!isWinrulesWindow (w))
- return;
-
- if (matchEval (&ws->opt[optNum].value.match, w))
- {
- newState |= mask;
- newState = constrainWindowState (newState, w->actions);
- ww->stateSetMask |= (newState & mask);
- }
- else if (ww->stateSetMask & mask)
- {
- newState &= ~mask;
- ww->stateSetMask &= ~mask;
- }
-
- if (newState != w->state)
- {
- changeWindowState (w, newState);
-
- if (mask & (CompWindowStateFullscreenMask |
- CompWindowStateAboveMask |
- CompWindowStateBelowMask ))
- updateWindowAttributes (w, CompStackingUpdateModeNormal);
- else
- updateWindowAttributes (w, CompStackingUpdateModeNone);
- }
-}
-
-static void
-winrulesSetAllowedActions (CompWindow *w,
- int optNum,
- int action)
-{
- WINRULES_SCREEN (w->screen);
- WINRULES_WINDOW (w);
-
- if (!isWinrulesWindow (w))
- return;
-
- if (matchEval (&ws->opt[optNum].value.match, w))
- ww->allowedActions &= ~action;
- else if (!(ww->allowedActions & action))
- ww->allowedActions |= action;
-
- recalcWindowActions (w);
-}
-
-static Bool
-winrulesMatchSizeValue (CompWindow *w,
- CompOption *matches,
- CompOption *widthValues,
- CompOption *heightValues,
- int *width,
- int *height)
-{
- int i, min;
-
- if (!isWinrulesWindow (w))
- return FALSE;
-
- if (w->type & CompWindowTypeDesktopMask)
- return FALSE;
-
- min = MIN (matches->value.list.nValue, widthValues->value.list.nValue);
- min = MIN (min, heightValues->value.list.nValue);
-
- for (i = 0; i < min; i++)
- {
- if (matchEval (&matches->value.list.value[i].match, w))
- {
- *width = widthValues->value.list.value[i].i;
- *height = heightValues->value.list.value[i].i;
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static Bool
-winrulesMatchSize (CompWindow *w,
- int *width,
- int *height)
-{
- WINRULES_SCREEN (w->screen);
-
- return winrulesMatchSizeValue (w,
- &ws->opt[WINRULES_SCREEN_OPTION_SIZE_MATCHES],
- &ws->opt[WINRULES_SCREEN_OPTION_SIZE_WIDTH_VALUES],
- &ws->opt[WINRULES_SCREEN_OPTION_SIZE_HEIGHT_VALUES],
- width, height);
-}
-
-static void
-winrulesUpdateWindowSize (CompWindow *w,
- int width,
- int height)
-{
- XWindowChanges xwc;
- unsigned int xwcm = 0;
-
- if (width != w->serverWidth)
- xwcm |= CWWidth;
- if (height != w->serverHeight)
- xwcm |= CWHeight;
-
- xwc.width = width;
- xwc.height = height;
-
- if (w->mapNum && xwcm)
- sendSyncRequest (w);
-
- configureXWindow (w, xwcm, &xwc);
-}
-
-static CompOption *
-winrulesGetScreenOptions (CompPlugin *plugin,
- CompScreen *screen,
- int *count)
-{
- WINRULES_SCREEN (screen);
-
- *count = NUM_OPTIONS (ws);
- return ws->opt;
-}
-
-static Bool
-winrulesSetScreenOption (CompPlugin *plugin,
- CompScreen *screen,
- const char *name,
- CompOptionValue *value)
-{
- CompOption *o;
- int index;
- unsigned int updateStateMask = 0, updateActionsMask = 0;
-
- WINRULES_SCREEN (screen);
-
- o = compFindOption (ws->opt, NUM_OPTIONS (ws), name, &index);
- if (!o)
- return FALSE;
-
- switch (index)
- {
- case WINRULES_SCREEN_OPTION_SKIPTASKBAR_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateSkipTaskbarMask;
- break;
-
- case WINRULES_SCREEN_OPTION_SKIPPAGER_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateSkipPagerMask;
- break;
-
- case WINRULES_SCREEN_OPTION_ABOVE_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateAboveMask;
- break;
-
- case WINRULES_SCREEN_OPTION_BELOW_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateBelowMask;
- break;
-
- case WINRULES_SCREEN_OPTION_STICKY_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateStickyMask;
- break;
-
- case WINRULES_SCREEN_OPTION_FULLSCREEN_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateFullscreenMask;
- break;
-
- case WINRULES_SCREEN_OPTION_MAXIMIZE_MATCH:
- if (compSetMatchOption (o, value))
- updateStateMask = CompWindowStateMaximizedHorzMask |
- CompWindowStateMaximizedVertMask;
- break;
-
- case WINRULES_SCREEN_OPTION_NOMOVE_MATCH:
- if (compSetMatchOption (o, value))
- updateActionsMask = CompWindowActionMoveMask;
- break;
-
- case WINRULES_SCREEN_OPTION_NORESIZE_MATCH:
- if (compSetMatchOption (o, value))
- updateActionsMask = CompWindowActionResizeMask;
- break;
-
- case WINRULES_SCREEN_OPTION_NOMINIMIZE_MATCH:
- if (compSetMatchOption (o, value))
- updateActionsMask = CompWindowActionMinimizeMask;
- break;
-
- case WINRULES_SCREEN_OPTION_NOMAXIMIZE_MATCH:
- if (compSetMatchOption (o, value))
- updateActionsMask = CompWindowActionMaximizeVertMask |
- CompWindowActionMaximizeHorzMask;
- break;
-
- case WINRULES_SCREEN_OPTION_NOCLOSE_MATCH:
- if (compSetMatchOption (o, value))
- updateActionsMask = CompWindowActionCloseMask;
- break;
- case WINRULES_SCREEN_OPTION_NOARGB_MATCH:
- if (compSetMatchOption (o, value))
- {
- CompWindow *w;
-
- for (w = screen->windows; w; w = w->next)
- winrulesSetNoAlpha (w, WINRULES_SCREEN_OPTION_NOARGB_MATCH);
-
- return TRUE;
- }
- break;
- case WINRULES_SCREEN_OPTION_NOFOCUS_MATCH:
- if (compSetMatchOption (o, value))
- {
- CompWindow *w;
-
- for (w = screen->windows; w; w = w->next)
- winrulesSetNoFocus (w, WINRULES_SCREEN_OPTION_NOFOCUS_MATCH);
-
- return TRUE;
- }
- break;
- case WINRULES_SCREEN_OPTION_SIZE_MATCHES:
- if (compSetOptionList (o, value))
- {
- int i;
-
- for (i = 0; i < o->value.list.nValue; i++)
- matchUpdate (screen->display, &o->value.list.value[i].match);
-
- return TRUE;
- }
- break;
- default:
- if (compSetOption (o, value))
- return TRUE;
- break;
- }
-
- if (updateStateMask)
- {
- CompWindow *w;
-
- for (w = screen->windows; w; w = w->next)
- winrulesUpdateState (w, index, updateStateMask);
-
- return TRUE;
- }
-
- if (updateActionsMask)
- {
- CompWindow *w;
-
- for (w = screen->windows; w; w = w->next)
- winrulesSetAllowedActions (w, index, updateActionsMask);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-winrulesApplyRules (void *closure)
-{
- CompWindow *w = (CompWindow *) closure;
- int width, height;
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_SKIPTASKBAR_MATCH,
- CompWindowStateSkipTaskbarMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_SKIPPAGER_MATCH,
- CompWindowStateSkipPagerMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_ABOVE_MATCH,
- CompWindowStateAboveMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_BELOW_MATCH,
- CompWindowStateBelowMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_STICKY_MATCH,
- CompWindowStateStickyMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_FULLSCREEN_MATCH,
- CompWindowStateFullscreenMask);
-
- winrulesUpdateState (w,
- WINRULES_SCREEN_OPTION_MAXIMIZE_MATCH,
- CompWindowStateMaximizedHorzMask |
- CompWindowStateMaximizedVertMask);
-
- winrulesSetAllowedActions (w,
- WINRULES_SCREEN_OPTION_NOMOVE_MATCH,
- CompWindowActionMoveMask);
-
- winrulesSetAllowedActions (w,
- WINRULES_SCREEN_OPTION_NORESIZE_MATCH,
- CompWindowActionResizeMask);
-
- winrulesSetAllowedActions (w,
- WINRULES_SCREEN_OPTION_NOMINIMIZE_MATCH,
- CompWindowActionMinimizeMask);
-
- winrulesSetAllowedActions (w,
- WINRULES_SCREEN_OPTION_NOMAXIMIZE_MATCH,
- CompWindowActionMaximizeVertMask |
- CompWindowActionMaximizeHorzMask);
-
- winrulesSetAllowedActions (w,
- WINRULES_SCREEN_OPTION_NOCLOSE_MATCH,
- CompWindowActionCloseMask);
-
- winrulesSetNoAlpha (w, WINRULES_SCREEN_OPTION_NOARGB_MATCH);
-
- if (winrulesMatchSize (w, &width, &height))
- winrulesUpdateWindowSize (w, width, height);
-
- return FALSE;
-}
-
-static void
-winrulesHandleEvent (CompDisplay *d,
- XEvent *event)
-{
- CompWindow *w;
-
- WINRULES_DISPLAY (d);
-
- if (event->type == MapRequest)
- {
- w = findWindowAtDisplay (d, event->xmap.window);
- if (w)
- {
- winrulesSetNoFocus (w, WINRULES_SCREEN_OPTION_NOFOCUS_MATCH);
- winrulesApplyRules (w);
- }
- }
-
- UNWRAP (wd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (wd, d, handleEvent, winrulesHandleEvent);
-}
-
-static void
-winrulesGetAllowedActionsForWindow (CompWindow *w,
- unsigned int *setActions,
- unsigned int *clearActions)
-{
- WINRULES_SCREEN (w->screen);
- WINRULES_WINDOW (w);
-
- UNWRAP (ws, w->screen, getAllowedActionsForWindow);
- (*w->screen->getAllowedActionsForWindow) (w, setActions, clearActions);
- WRAP (ws, w->screen, getAllowedActionsForWindow,
- winrulesGetAllowedActionsForWindow);
-
- *clearActions |= ~ww->allowedActions;
-}
-
-static void
-winrulesMatchExpHandlerChanged (CompDisplay *d)
-{
- CompScreen *s;
- CompWindow *w;
-
- WINRULES_DISPLAY (d);
-
- UNWRAP (wd, d, matchExpHandlerChanged);
- (*d->matchExpHandlerChanged) (d);
- WRAP (wd, d, matchExpHandlerChanged, winrulesMatchExpHandlerChanged);
-
- /* match options are up to date after the call to matchExpHandlerChanged */
- for (s = d->screens; s; s = s->next)
- for (w = s->windows; w; w = w->next)
- winrulesApplyRules (w);
-}
-
-static void
-winrulesMatchPropertyChanged (CompDisplay *d,
- CompWindow *w)
-{
- WINRULES_DISPLAY (d);
-
- winrulesApplyRules (w);
-
- UNWRAP (wd, d, matchPropertyChanged);
- (*d->matchPropertyChanged) (d, w);
- WRAP (wd, d, matchPropertyChanged, winrulesMatchPropertyChanged);
-}
-
-static Bool
-winrulesInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- WinrulesDisplay *wd;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- wd = malloc (sizeof (WinrulesDisplay));
- if (!wd)
- return FALSE;
-
- wd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (wd->screenPrivateIndex < 0)
- {
- free (wd);
- return FALSE;
- }
-
- WRAP (wd, d, handleEvent, winrulesHandleEvent);
- WRAP (wd, d, matchExpHandlerChanged, winrulesMatchExpHandlerChanged);
- WRAP (wd, d, matchPropertyChanged, winrulesMatchPropertyChanged);
-
- d->base.privates[displayPrivateIndex].ptr = wd;
-
- return TRUE;
-}
-
-static void
-winrulesFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- WINRULES_DISPLAY (d);
-
- freeScreenPrivateIndex (d, wd->screenPrivateIndex);
-
- UNWRAP (wd, d, handleEvent);
- UNWRAP (wd, d, matchExpHandlerChanged);
- UNWRAP (wd, d, matchPropertyChanged);
-
- free (wd);
-}
-
-static const CompMetadataOptionInfo winrulesScreenOptionInfo[] = {
- { "skiptaskbar_match", "match", 0, 0, 0 },
- { "skippager_match", "match", 0, 0, 0 },
- { "above_match", "match", 0, 0, 0 },
- { "below_match", "match", 0, 0, 0 },
- { "sticky_match", "match", 0, 0, 0 },
- { "fullscreen_match", "match", 0, 0, 0 },
- { "maximize_match", "match", 0, 0, 0 },
- { "no_argb_match", "match", 0, 0, 0 },
- { "no_move_match", "match", 0, 0, 0 },
- { "no_resize_match", "match", 0, 0, 0 },
- { "no_minimize_match", "match", 0, 0, 0 },
- { "no_maximize_match", "match", 0, 0, 0 },
- { "no_close_match", "match", 0, 0, 0 },
- { "no_focus_match", "match", 0, 0, 0 },
- { "size_matches", "list", "<type>match</type>", 0, 0 },
- { "size_width_values", "list", "<type>int</type>", 0, 0 },
- { "size_height_values", "list", "<type>int</type>", 0, 0 }
-};
-
-static Bool
-winrulesInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- WinrulesScreen *ws;
-
- WINRULES_DISPLAY (s->display);
-
- ws = malloc (sizeof (WinrulesScreen));
- if (!ws)
- return FALSE;
-
- if (!compInitScreenOptionsFromMetadata (s,
- &winrulesMetadata,
- winrulesScreenOptionInfo,
- ws->opt,
- WINRULES_SCREEN_OPTION_NUM))
- {
- free (ws);
- return FALSE;
- }
-
- ws->windowPrivateIndex = allocateWindowPrivateIndex(s);
- if (ws->windowPrivateIndex < 0)
- {
- compFiniScreenOptions (s, ws->opt, WINRULES_SCREEN_OPTION_NUM);
- free (ws);
- return FALSE;
- }
-
- WRAP (ws, s, getAllowedActionsForWindow,
- winrulesGetAllowedActionsForWindow);
-
- s->base.privates[wd->screenPrivateIndex].ptr = ws;
-
- return TRUE;
-}
-
-static void
-winrulesFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- WINRULES_SCREEN (s);
-
- UNWRAP (ws, s, getAllowedActionsForWindow);
-
- freeWindowPrivateIndex(s, ws->windowPrivateIndex);
-
- compFiniScreenOptions (s, ws->opt, WINRULES_SCREEN_OPTION_NUM);
-
- free (ws);
-}
-
-static Bool
-winrulesInitWindow (CompPlugin *p,
- CompWindow *w)
-{
- WinrulesWindow *ww;
-
- WINRULES_SCREEN (w->screen);
-
- ww = malloc (sizeof (WinrulesWindow));
- if (!ww)
- return FALSE;
-
- ww->stateSetMask = 0;
- ww->protocolSetMask = 0;
-
- ww->allowedActions = ~0;
-
- ww->hasAlpha = w->alpha;
- ww->oldInputHint = w->inputHint;
-
- w->base.privates[ws->windowPrivateIndex].ptr = ww;
-
- compAddTimeout (0, 0, winrulesApplyRules, w);
-
- return TRUE;
-}
-
-static void
-winrulesFiniWindow (CompPlugin *p,
- CompWindow *w)
-{
- WINRULES_WINDOW (w);
-
- free (ww);
-}
-
-static CompBool
-winrulesInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) winrulesInitDisplay,
- (InitPluginObjectProc) winrulesInitScreen,
- (InitPluginObjectProc) winrulesInitWindow
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-winrulesFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) winrulesFiniDisplay,
- (FiniPluginObjectProc) winrulesFiniScreen,
- (FiniPluginObjectProc) winrulesFiniWindow
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static CompOption *
-winrulesGetObjectOptions (CompPlugin *plugin,
- CompObject *object,
- int *count)
-{
- static GetPluginObjectOptionsProc dispTab[] = {
- (GetPluginObjectOptionsProc) 0, /* GetCoreOptions */
- (GetPluginObjectOptionsProc) 0, /* GetDisplayOptions */
- (GetPluginObjectOptionsProc) winrulesGetScreenOptions
- };
-
- *count = 0;
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab),
- (void *) count, (plugin, object, count));
-}
-
-static CompBool
-winrulesSetObjectOption (CompPlugin *plugin,
- CompObject *object,
- const char *name,
- CompOptionValue *value)
-{
- static SetPluginObjectOptionProc dispTab[] = {
- (SetPluginObjectOptionProc) 0, /* SetCoreOption */
- (SetPluginObjectOptionProc) 0, /* SetDisplayOption */
- (SetPluginObjectOptionProc) winrulesSetScreenOption
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), FALSE,
- (plugin, object, name, value));
-}
-
-static Bool
-winrulesInit (CompPlugin *p)
-{
- if (!compInitPluginMetadataFromInfo (&winrulesMetadata,
- p->vTable->name,
- 0, 0,
- winrulesScreenOptionInfo,
- WINRULES_SCREEN_OPTION_NUM))
- return FALSE;
-
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- {
- compFiniMetadata (&winrulesMetadata);
- return FALSE;
- }
-
- compAddMetadataFromFile (&winrulesMetadata, p->vTable->name);
-
- return TRUE;
-}
-
-static void
-winrulesFini (CompPlugin *p)
-{
- freeDisplayPrivateIndex (displayPrivateIndex);
-
- compFiniMetadata (&winrulesMetadata);
-}
-
-static CompMetadata *
-winrulesGetMetadata (CompPlugin *plugin)
-{
- return &winrulesMetadata;
-}
-
-static CompPluginVTable winrulesVTable = {
- "winrules",
- winrulesGetMetadata,
- winrulesInit,
- winrulesFini,
- winrulesInitObject,
- winrulesFiniObject,
- winrulesGetObjectOptions,
- winrulesSetObjectOption,
-};
-
-CompPluginVTable *
-getCompPluginInfo20070830 (void)
-{
- return &winrulesVTable;
-}
diff --git a/winrules.xml.in b/winrules.xml.in
index 89f3dc7..17c6f23 100644
--- a/winrules.xml.in
+++ b/winrules.xml.in
@@ -1,6 +1,6 @@
<compiz>
<!-- winrules metadata -->
- <plugin name="winrules">
+ <plugin name="winrules" useBcop="true">
<_short>Window Rules</_short>
<_long>Set windows rules</_long>
<category>Window Management</category>