summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2010-11-19 15:24:02 +0100
committerDanny Baumann <dannybaumann@web.de>2010-11-19 15:24:02 +0100
commit5fb5ec0f2671dba449951ce20a04cb0b627c882c (patch)
tree3c3d91b18eb4ceb3d2db710a13ad0dfd69c2cfff
parentb0839e4b5bf5993c113d7fa3154722f19cb91050 (diff)
downloaddialog-compiz-0.8.tar.gz
dialog-compiz-0.8.tar.bz2
Revert "Initial C++ port"compiz-0.8
This reverts commit 45e77d888f8a326dcbed76438f4a90a8c048c123.
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--dialog.c435
-rw-r--r--dialog.xml.in17
-rw-r--r--plugin.info1
-rw-r--r--src/dialog.cpp201
-rw-r--r--src/dialog.h105
7 files changed, 975 insertions, 323 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aec1578..108995f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package (Compiz REQUIRED)
+include (CompizFusion)
-include (CompizPlugin)
-
-compiz_plugin (dialog PLUGINDEPS composite opengl)
+compiz_fusion_plugin (dialog)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ccaa8d4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,533 @@
+##
+#
+# 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); \
+ cp $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(hdr-install-target)" ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
+ else \
+ $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \
+ fi; \
+ cp $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(pkg-target)" ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
+ else \
+ $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
+ fi; \
+ cp $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
+ else \
+ $(ECHO) "install : $(schema-output)"; \
+ fi; \
+ if [ "x$(USER)" = "xroot" ]; then \
+ GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
+ gconftool-2 --makefile-install-rule $(schema-output) > /dev/null; \
+ else \
+ gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \
+ fi; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(data-files)" ]; then \
+ mkdir -p $(DATADIR); \
+ for FILE in $(data-files); do \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
+ else \
+ $(ECHO) "install : $(DATADIR)/$$FILE"; \
+ fi; \
+ FILEDIR="$(DATADIR)/`dirname "$$FILE"`"; \
+ mkdir -p "$$FILEDIR"; \
+ cp data/$$FILE $(DATADIR)/$$FILE; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
+ fi; \
+ done \
+ fi
+ @if [ -n "$(image-files)" ]; then \
+ mkdir -p $(IMAGEDIR); \
+ for FILE in $(image-files); do \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
+ else \
+ $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \
+ fi; \
+ FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \
+ mkdir -p "$$FILEDIR"; \
+ cp images/$$FILE $(IMAGEDIR)/$$FILE; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
+ fi; \
+ done \
+ fi
+
+uninstall:
+ @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \
+ fi; \
+ rm -f $(DESTDIR)/lib$(PLUGIN).so; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \
+ fi; \
+ fi
+ @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \
+ fi; \
+ rm -f $(XMLDIR)/$(PLUGIN).xml; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \
+ fi; \
+ rm -f $(CINCDIR)/compiz/$(hdr-install-target); \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \
+ fi; \
+ rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(schema-output)" -a -e "$(schema-output)" -a 'x$(USER)' = 'xroot' ]; then \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(schema-output)"; \
+ fi; \
+ GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
+ gconftool-2 --makefile-uninstall-rule $(schema-output) > /dev/null; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(schema-output)\033[0m"; \
+ fi; \
+ fi
+ @if [ -n "$(data-files)" ]; then \
+ for FILE in $(data-files); do \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \
+ fi; \
+ rm -f $(DATADIR)/$$FILE; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \
+ fi; \
+ done \
+ fi
+ @if [ -n "$(image-files)" ]; then \
+ for FILE in $(image-files); do \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \
+ else \
+ $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \
+ fi; \
+ rm -f $(IMAGEDIR)/$$FILE; \
+ if [ '$(color)' != 'no' ]; then \
+ $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \
+ fi; \
+ done \
+ fi
diff --git a/dialog.c b/dialog.c
new file mode 100644
index 0000000..7911cba
--- /dev/null
+++ b/dialog.c
@@ -0,0 +1,435 @@
+/**
+ *
+ * dialog.c
+ *
+ * Copyright (c) 2008 Douglas Young <rcxdude@gmail.com>
+ * Input shaping adapted from FreeWins plugin
+ *
+ * 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.
+ *
+ **/
+
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <X11/extensions/shape.h>
+
+#include <compiz-core.h>
+
+#include "dialog_options.h"
+
+static int displayPrivateIndex;
+
+typedef struct _DialogDisplay
+{
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
+} DialogDisplay;
+
+#define ANIMATE_UP 1
+#define ANIMATE_DOWN 2
+#define ANIMATE_NONE 0
+
+typedef struct _DialogWindow
+{
+ int animate;
+ Bool faded;
+ float opacity;
+ float saturation;
+ float brightness;
+
+ Window oldTransient;
+} DialogWindow;
+
+typedef struct _DialogScreen
+{
+ int windowPrivateIndex;
+
+ PaintWindowProc paintWindow;
+ PreparePaintScreenProc preparePaintScreen;
+} DialogScreen;
+
+
+#define GET_DIALOG_DISPLAY(d) \
+ ((DialogDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
+
+#define DIALOG_DISPLAY(d) \
+ DialogDisplay *dd = GET_DIALOG_DISPLAY (d)
+
+#define GET_DIALOG_SCREEN(s, dd) \
+ ((DialogScreen *) (s)->base.privates[(dd)->screenPrivateIndex].ptr)
+
+#define DIALOG_SCREEN(s) \
+ DialogScreen *ds = GET_DIALOG_SCREEN (s, \
+ GET_DIALOG_DISPLAY (s->display))
+
+#define GET_DIALOG_WINDOW(w, ds) \
+ ((DialogWindow *) (w)->base.privates[(ds)->windowPrivateIndex].ptr)
+
+#define DIALOG_WINDOW(w) \
+ DialogWindow *dw = GET_DIALOG_WINDOW (w, \
+ GET_DIALOG_SCREEN (w->screen, \
+ GET_DIALOG_DISPLAY (w->screen->display)))
+
+#define WIN_X(w) ((w)->attrib.x - (w)->input.left)
+#define WIN_Y(w) ((w)->attrib.y - (w)->input.top)
+#define WIN_W(w) ((w)->width + (w)->input.left + (w)->input.right)
+#define WIN_H(w) ((w)->height + (w)->input.top + (w)->input.bottom)
+
+#define SPEED (dialogGetSpeed(s->display) * 0.0005f)
+
+static Bool
+dialogPaintWindow (CompWindow *w,
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask)
+{
+ DIALOG_SCREEN(w->screen);
+ DIALOG_WINDOW(w);
+ int status;
+ if (dw->faded || dw->animate)
+ {
+ WindowPaintAttrib wAttrib = *attrib;
+ wAttrib.opacity *= dw->opacity/100;
+ wAttrib.saturation *= dw->saturation/100;
+ wAttrib.brightness *= dw->brightness/100;
+ if (dw->animate)
+ addWindowDamage (w);
+ UNWRAP(ds,w->screen, paintWindow);
+ status = (*w->screen->paintWindow)(w, &wAttrib, transform, region, mask);
+ WRAP(ds, w->screen, paintWindow, dialogPaintWindow);
+ } else {
+ UNWRAP(ds,w->screen, paintWindow);
+ status = (*w->screen->paintWindow)(w, attrib, transform, region, mask);
+ WRAP(ds, w->screen, paintWindow, dialogPaintWindow);
+ }
+ return status;
+}
+
+
+static void
+dialogPreparePaintScreen (CompScreen *s,
+ int ms)
+{
+ DIALOG_SCREEN(s);
+ CompWindow *w;
+ float topacity = dialogGetOpacity (s->display);
+ float tsat = dialogGetSaturation(s->display);
+ float tbright = dialogGetBrightness(s->display);
+ for (w = s->windows; w; w = w->next)
+ {
+ DIALOG_WINDOW(w);
+ if (dw->animate != ANIMATE_NONE)
+ {
+ if (dw->animate == ANIMATE_DOWN)
+ {
+ dw->opacity = fmax(dw->opacity - (dw->opacity - topacity) * ms * SPEED,topacity);
+ dw->saturation = fmax(dw->saturation - (dw->saturation - tsat) * ms * SPEED,tsat );
+ dw->brightness = fmax(dw->brightness - (dw->brightness - tbright) * ms * SPEED,tbright );
+ if (dw->opacity <= topacity + 1 &&
+ dw->saturation <= tsat + 1 &&
+ dw->brightness <= tbright + 1)
+ dw->animate = ANIMATE_NONE;
+ }
+ else if (dw->faded == TRUE)
+ {
+ dw->opacity = fmin(dw->opacity + (topacity - dw->opacity ) * ms * SPEED,topacity);
+ dw->saturation = fmin(dw->saturation + (tsat - dw->saturation) * ms * SPEED,tsat );
+ dw->brightness = fmin(dw->brightness + (tbright - dw->brightness) * ms * SPEED,tbright );
+ if (dw->opacity >= topacity - 1 &&
+ dw->saturation >= tsat - 1 &&
+ dw->brightness >= tbright - 1)
+ dw->animate = ANIMATE_NONE;
+ }
+ else
+ {
+ dw->opacity = fmin(dw->opacity + (100 - dw->opacity ) * ms * SPEED,100);
+ dw->saturation = fmin(dw->saturation + (100 - dw->saturation) * ms * SPEED,100);
+ dw->brightness = fmin(dw->brightness + (100 - dw->brightness) * ms * SPEED,100);
+ if (dw->opacity >= 99 &&
+ dw->saturation >= 99 &&
+ dw->brightness >= 99)
+ dw->animate = ANIMATE_NONE;
+ }
+ }
+ }
+ UNWRAP(ds, s, preparePaintScreen);
+ (*s->preparePaintScreen)(s, ms);
+ WRAP(ds, s, preparePaintScreen, dialogPreparePaintScreen);
+}
+
+static void
+dialogHandleEvent (CompDisplay *d,
+ XEvent *event)
+{
+ DIALOG_DISPLAY (d);
+ if (event->type == UnmapNotify)
+ {
+ CompWindow *w = findWindowAtDisplay (d, event->xunmap.window);
+ if (w && w->transientFor)
+ {
+ CompWindow *ww = findWindowAtDisplay (w->screen->display, w->transientFor);
+ if (ww)
+ {
+ DialogWindow *dww = GET_DIALOG_WINDOW (ww, \
+ GET_DIALOG_SCREEN (ww->screen, \
+ GET_DIALOG_DISPLAY (ww->screen->display)));
+ if (dww->faded)
+ {
+ CompWindow *www;
+ int othertrans = 0;
+ for (www = w->screen->windows; www; www = www->next)
+ {
+ if (www->transientFor == ww->id && w->id != www->id &&
+ matchEval(dialogGetDialogtypes (www->screen->display),www))
+ othertrans++;
+ }
+ if (!othertrans)
+ {
+ dww->faded = FALSE;
+ dww->animate = ANIMATE_UP;
+ addWindowDamage (ww);
+ }
+ }
+ }
+ }
+ }
+ if (event->type == MapNotify)
+ {
+ CompWindow *w = findWindowAtDisplay (d, event->xmap.window);
+ if (w && w->transientFor && matchEval(dialogGetDialogtypes (w->screen->display),w))
+ {
+ CompWindow *ww = findWindowAtDisplay (w->screen->display, w->transientFor);
+ DialogWindow *dww = GET_DIALOG_WINDOW (ww, \
+ GET_DIALOG_SCREEN (ww->screen, \
+ GET_DIALOG_DISPLAY (ww->screen->display)));
+ if (!dww->faded)
+ {
+ dww->faded = TRUE;
+ dww->animate = ANIMATE_DOWN;
+ addWindowDamage (ww);
+ }
+ }
+ }
+ UNWRAP(dd, d, handleEvent);
+ (*d->handleEvent)(d, event);
+ WRAP(dd, d, handleEvent, dialogHandleEvent);
+}
+
+
+static void
+dialogAppChange (CompDisplay *d,
+ CompOption *opt,
+ DialogDisplayOptions num)
+{
+ CompScreen *s;
+ for (s = d->screens; s; s = s->next)
+ {
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ DIALOG_WINDOW(w);
+ if (dw->faded && (dialogGetOpacity(d) > dw->opacity ||
+ dialogGetSaturation(d) > dw->saturation ||
+ dialogGetBrightness(d) > dw->brightness ))
+ dw->animate = ANIMATE_UP;
+ else if (dw->faded && (dialogGetOpacity(d) < dw->opacity ||
+ dialogGetSaturation(d) < dw->saturation ||
+ dialogGetBrightness(d) < dw->brightness ))
+ dw->animate = ANIMATE_DOWN;
+ addWindowDamage(w);
+ }
+ }
+}
+
+
+static Bool
+dialogInitDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ DialogDisplay *dd;
+
+ if (!checkPluginABI ("core", CORE_ABIVERSION))
+ return FALSE;
+
+ dd = malloc (sizeof (DialogDisplay));
+ if (!dd)
+ return FALSE;
+
+ dd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (dd->screenPrivateIndex < 0)
+ {
+ free (dd);
+ return FALSE;
+ }
+
+ d->base.privates[displayPrivateIndex].ptr = dd;
+ dialogSetOpacityNotify(d,dialogAppChange);
+ dialogSetSaturationNotify(d,dialogAppChange);
+ dialogSetBrightnessNotify(d,dialogAppChange);
+
+ WRAP(dd, d, handleEvent, dialogHandleEvent);
+
+ return TRUE;
+}
+
+static void
+dialogFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ DIALOG_DISPLAY (d);
+ freeScreenPrivateIndex (d, dd->screenPrivateIndex);
+ UNWRAP(dd, d, handleEvent);
+ free (dd);
+}
+
+static Bool
+dialogInitScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ DialogScreen *ds;
+ DIALOG_DISPLAY (s->display);
+
+ ds = malloc (sizeof (DialogScreen));
+ if (!ds)
+ return FALSE;
+
+ WRAP(ds, s, preparePaintScreen, dialogPreparePaintScreen);
+ WRAP(ds, s, paintWindow, dialogPaintWindow);
+ ds->windowPrivateIndex = allocateWindowPrivateIndex (s);
+ s->base.privates[dd->screenPrivateIndex].ptr = ds;
+
+ return TRUE;
+}
+
+static void
+dialogFiniScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ DIALOG_SCREEN (s);
+ UNWRAP(ds, s, preparePaintScreen);
+ UNWRAP(ds, s, paintWindow);
+ free (ds);
+}
+
+static Bool
+dialogInitWindow (CompPlugin *p,
+ CompWindow *w)
+{
+ DialogWindow *dw;
+
+ DIALOG_SCREEN (w->screen);
+
+ dw = malloc (sizeof (DialogWindow));
+ if (!dw)
+ return FALSE;
+ w->base.privates[ds->windowPrivateIndex].ptr = dw;
+
+ dw->opacity = 100;
+ dw->saturation = 100;
+ dw->brightness = 100;
+ dw->faded = FALSE;
+
+ dw->oldTransient = 0;
+
+ return TRUE;
+}
+
+static void
+dialogFiniWindow (CompPlugin *p,
+ CompWindow *w)
+{
+ DIALOG_WINDOW (w);
+ DIALOG_SCREEN (w->screen);
+ if (w->transientFor)
+ {
+ CompWindow *ww = findWindowAtDisplay (w->screen->display, w->transientFor);
+ if (ww)
+ {
+ DialogWindow *dww = GET_DIALOG_WINDOW (ww, \
+ GET_DIALOG_SCREEN (ww->screen, \
+ GET_DIALOG_DISPLAY (ww->screen->display)));
+ if (dww && dww->faded)
+ {
+ dww->faded = FALSE;
+ dww->animate = ANIMATE_UP;
+ addWindowDamage (ww);
+ }
+ }
+ }
+ w->base.privates[ds->windowPrivateIndex].ptr = 0;
+ free (dw);
+}
+
+static CompBool
+dialogInitObject (CompPlugin *p,
+ CompObject *o)
+{
+ static InitPluginObjectProc dispTab[] = {
+ (InitPluginObjectProc) 0, /* InitCore */
+ (InitPluginObjectProc) dialogInitDisplay,
+ (InitPluginObjectProc) dialogInitScreen,
+ (InitPluginObjectProc) dialogInitWindow
+ };
+
+ RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
+}
+
+static void
+dialogFiniObject (CompPlugin *p,
+ CompObject *o)
+{
+ static FiniPluginObjectProc dispTab[] = {
+ (FiniPluginObjectProc) 0, /* FiniCore */
+ (FiniPluginObjectProc) dialogFiniDisplay,
+ (FiniPluginObjectProc) dialogFiniScreen,
+ (FiniPluginObjectProc) dialogFiniWindow
+ };
+
+ DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
+}
+
+static Bool
+dialogInit (CompPlugin *p)
+{
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+dialogFini (CompPlugin *p)
+{
+ freeDisplayPrivateIndex(displayPrivateIndex);
+}
+
+static CompPluginVTable dialogVTable = {
+ "dialog",
+ 0,
+ dialogInit,
+ dialogFini,
+ dialogInitObject,
+ dialogFiniObject,
+ 0,
+ 0
+};
+
+CompPluginVTable*
+getCompPluginInfo (void)
+{
+ return &dialogVTable;
+}
diff --git a/dialog.xml.in b/dialog.xml.in
index f7fd44c..c4b7d16 100644
--- a/dialog.xml.in
+++ b/dialog.xml.in
@@ -1,22 +1,13 @@
<?xml version="1.0"?>
<compiz>
<plugin name="dialog" useBcop="true">
- <short>Dialog Dim</short>
+ <short>ADDialog</short>
<long>Fades windows with open dialogs</long>
<category>Extras</category>
<deps>
- <relation type="after">
- <plugin>composite</plugin>
- <plugin>opengl</plugin>
- <plugin>decor</plugin>
- </relation>
- <requirement>
- <plugin>regex</plugin>
- <plugin>composite</plugin>
- <plugin>opengl</plugin>
- </requirement>
+ <requirement> regex </requirement>
</deps>
- <options>
+ <display>
<group>
<option name="dialogtypes" type="match">
<_short>Dialog Match</_short>
@@ -56,7 +47,7 @@
<precision>1</precision>
</option>
</group>
- </options>
+ </display>
</plugin>
</compiz>
diff --git a/plugin.info b/plugin.info
new file mode 100644
index 0000000..33dc68e
--- /dev/null
+++ b/plugin.info
@@ -0,0 +1 @@
+PLUGIN=dialog
diff --git a/src/dialog.cpp b/src/dialog.cpp
deleted file mode 100644
index 0bf88f3..0000000
--- a/src/dialog.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/**
- *
- * dialog.c
- *
- * Copyright (c) 2008 Douglas Young <rcxdude@gmail.com>
- * Input shaping adapted from FreeWins plugin
- *
- * 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 "dialog.h"
-#include <cmath>
-
-COMPIZ_PLUGIN_20090315 (dialog, DialogPluginVTable);
-
-bool
-DialogWindow::glPaint (const GLWindowPaintAttrib &attrib,
- const GLMatrix &transform,
- const CompRegion &region,
- unsigned int mask)
-{
- if (mFaded || mAnimate)
- {
- GLWindowPaintAttrib wAttrib (attrib);
- wAttrib.opacity *= (mOpacity / 100);
- wAttrib.saturation *= (mSaturation / 100);
- wAttrib.brightness *= (mBrightness / 100);
-
- if (mAnimate)
- cWindow->addDamage ();
-
- return gWindow->glPaint (wAttrib, transform, region, mask);
- }
-
- return gWindow->glPaint (attrib, transform, region, mask);
-}
-
-void
-DialogScreen::preparePaint (int ms)
-{
- float topacity = optionGetOpacity ();
- float tsat = optionGetSaturation ();
- float tbright = optionGetBrightness ();
- foreach (CompWindow *w, screen->windows ())
- {
- DIALOG_WINDOW(w);
- if (dw->mAnimate != ANIMATE_NONE)
- {
- if (dw->mAnimate == ANIMATE_DOWN)
- {
- dw->mOpacity = fmax(dw->mOpacity - (dw->mOpacity - topacity) * ms * SPEED,topacity);
- dw->mSaturation = fmax(dw->mSaturation - (dw->mSaturation - tsat) * ms * SPEED,tsat );
- dw->mBrightness = fmax(dw->mBrightness - (dw->mBrightness - tbright) * ms * SPEED,tbright );
- if (dw->mOpacity <= topacity + 1 &&
- dw->mSaturation <= tsat + 1 &&
- dw->mBrightness <= tbright + 1)
- dw->mAnimate = ANIMATE_NONE;
- }
- else if (dw->mFaded == TRUE)
- {
- dw->mOpacity = fmin(dw->mOpacity + (topacity - dw->mOpacity ) * ms * SPEED,topacity);
- dw->mSaturation = fmin(dw->mSaturation + (tsat - dw->mSaturation) * ms * SPEED,tsat );
- dw->mBrightness = fmin(dw->mBrightness + (tbright - dw->mBrightness) * ms * SPEED,tbright );
- if (dw->mOpacity >= topacity - 1 &&
- dw->mSaturation >= tsat - 1 &&
- dw->mBrightness >= tbright - 1)
- dw->mAnimate = ANIMATE_NONE;
- }
- else
- {
- dw->mOpacity = fmin(dw->mOpacity + (100 - dw->mOpacity ) * ms * SPEED,100);
- dw->mSaturation = fmin(dw->mSaturation + (100 - dw->mSaturation) * ms * SPEED,100);
- dw->mBrightness = fmin(dw->mBrightness + (100 - dw->mBrightness) * ms * SPEED,100);
- if (dw->mOpacity >= 99 &&
- dw->mSaturation >= 99 &&
- dw->mBrightness >= 99)
- dw->mAnimate = ANIMATE_NONE;
- }
- }
- }
-
- cScreen->preparePaint (ms);
-}
-
-void
-DialogScreen::handleEvent (XEvent *event)
-{
- if (event->type == UnmapNotify)
- {
- CompWindow *w = screen->findWindow (event->xunmap.window);
- if (w && w->transientFor ())
- {
- CompWindow *ww = screen->findWindow (w->transientFor ());
- if (ww)
- {
- DialogWindow *dww = DialogWindow::get (ww);
- if (dww->mFaded)
- {
- int othertrans = 0;
- foreach (CompWindow *www, screen->windows ())
- {
- if (www->transientFor () == ww->id () && w->id () != www->id () &&
- optionGetDialogtypes ().evaluate (www))
- othertrans++;
- }
- if (!othertrans)
- {
- dww->mFaded = FALSE;
- dww->mAnimate = ANIMATE_UP;
- CompositeWindow::get (ww)->addDamage ();
- }
- }
- }
- }
- }
- if (event->type == MapNotify)
- {
- CompWindow *w = screen->findWindow (event->xmap.window);
- if (w && w->transientFor ())
- {
- CompWindow *ww = screen->findWindow (w->transientFor ());
- DialogWindow *dww = DialogWindow::get (ww);
- if (!dww->mFaded)
- {
- dww->mFaded = TRUE;
- dww->mAnimate = ANIMATE_DOWN;
- dww->cWindow->addDamage ();
- }
- }
- }
-
- screen->handleEvent (event);
-}
-
-void
-DialogScreen::optionChanged (CompOption *option,
- DialogOptions::Options num)
-{
- foreach (CompWindow *w, screen->windows ())
- {
- DIALOG_WINDOW (w);
-
- if (dw->mFaded && (optionGetOpacity () > dw->mOpacity ||
- optionGetSaturation () > dw->mSaturation ||
- optionGetBrightness () > dw->mBrightness ))
- dw->mAnimate = ANIMATE_UP;
- else if (dw->mFaded && (optionGetOpacity () < dw->mOpacity ||
- optionGetSaturation () < dw->mSaturation ||
- optionGetBrightness () < dw->mBrightness ))
- dw->mAnimate = ANIMATE_DOWN;
- dw->cWindow->addDamage ();
- }
-}
-
-DialogScreen::DialogScreen (CompScreen *screen) :
- PluginClassHandler <DialogScreen, CompScreen> (screen),
- cScreen (CompositeScreen::get (screen)),
- gScreen (GLScreen::get (screen))
-{
- ScreenInterface::setHandler (screen);
- CompositeScreenInterface::setHandler (cScreen);
-
- optionSetOpacityNotify (boost::bind (&DialogScreen::optionChanged, this, _1, _2));
- optionSetSaturationNotify (boost::bind (&DialogScreen::optionChanged, this, _1, _2));
- optionSetBrightnessNotify (boost::bind (&DialogScreen::optionChanged, this, _1, _2));
-}
-
-DialogWindow::DialogWindow (CompWindow *w) :
- PluginClassHandler <DialogWindow, CompWindow> (w),
- window (w),
- cWindow (CompositeWindow::get (w)),
- gWindow (GLWindow::get (w)),
- mAnimate (0),
- mFaded (false),
- mOpacity (OPAQUE),
- mBrightness (BRIGHT),
- mSaturation (COLOR),
- mOldTransient (None)
-{
- GLWindowInterface::setHandler (gWindow);
-}
-
-bool
-DialogPluginVTable::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/dialog.h b/src/dialog.h
deleted file mode 100644
index 592888a..0000000
--- a/src/dialog.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- *
- * dialog.c
- *
- * Copyright (c) 2008 Douglas Young <rcxdude@gmail.com>
- * Input shaping adapted from FreeWins plugin
- *
- * 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 <composite/composite.h>
-#include <opengl/opengl.h>
-
-#include "dialog_options.h"
-
-#define ANIMATE_UP 1
-#define ANIMATE_DOWN 2
-#define ANIMATE_NONE 0
-
-class DialogScreen :
- public PluginClassHandler <DialogScreen, CompScreen>,
- public ScreenInterface,
- public CompositeScreenInterface,
- public DialogOptions
-{
- public:
-
- DialogScreen (CompScreen *s);
-
- public:
-
- CompositeScreen *cScreen;
- GLScreen *gScreen;
-
- void
- preparePaint (int);
-
- void
- handleEvent (XEvent *);
-
- void
- optionChanged (CompOption *opt,
- DialogOptions::Options);
-};
-
-class DialogWindow :
- public PluginClassHandler <DialogWindow, CompWindow>,
- public GLWindowInterface
-{
- public:
-
- DialogWindow (CompWindow *);
-
- public:
-
- CompWindow *window;
- CompositeWindow *cWindow;
- GLWindow *gWindow;
-
- int mAnimate;
- bool mFaded;
- float mOpacity;
- float mBrightness;
- float mSaturation;
-
- Window mOldTransient;
-
- bool
- glPaint (const GLWindowPaintAttrib &,
- const GLMatrix &,
- const CompRegion &,
- unsigned int );
-};
-
-#define DIALOG_SCREEN(s) \
- DialogScreen *ds = DialogScreen::get (s);
-
-#define DIALOG_WINDOW(w) \
- DialogWindow *dw = DialogWindow::get (w);
-
-#define WIN_X(w) ((w)->x () - (w)->input ().left)
-#define WIN_Y(w) ((w)->y () - (w)->input ().top)
-#define WIN_W(w) ((w)->width () + (w)->input ().left + (w)->input ().right)
-#define WIN_H(w) ((w)->height () + (w)->input ().top + (w)->input ().bottom)
-
-#define SPEED (optionGetSpeed() * 0.0005f)
-#define SPEED_W (fws->optionGetSpeed () * 0.000f)
-
-class DialogPluginVTable :
- public CompPlugin::VTableForScreenAndWindow <DialogScreen, DialogWindow>
-{
- public:
-
- bool init ();
-};