summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2010-08-28 22:45:08 -0600
committerScott Moreau <oreaus@gmail.com>2010-08-28 22:45:08 -0600
commit12b72b972551b65bc6813520e17d07d6da3bc4c0 (patch)
tree07615b4adbf068193ea8a4a7530e0b6fe9c234a6
parentffeda61b0ca595458ea8ca36656171d6f8b2551c (diff)
downloadworkspacenames-12b72b972551b65bc6813520e17d07d6da3bc4c0.tar.gz
workspacenames-12b72b972551b65bc6813520e17d07d6da3bc4c0.tar.bz2
Initial C++ port.
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile533
-rw-r--r--plugin.info4
-rw-r--r--src/workspacenames.cpp264
-rw-r--r--src/workspacenames.h94
-rw-r--r--workspacenames.c449
-rw-r--r--workspacenames.xml.in10
7 files changed, 370 insertions, 990 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e8bdcd..042cd43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
-include (CompizFusion)
+find_package (Compiz REQUIRED)
-compiz_fusion_plugin (workspacenames PLUGINDEPS text)
+include (CompizPlugin)
+
+compiz_plugin (workspacenames PLUGINDEPS composite opengl text)
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 0aaa7b7..0000000
--- a/plugin.info
+++ /dev/null
@@ -1,4 +0,0 @@
-PLUGIN = workspacenames
-PKG_DEP = compiz-text
-CHK_HEADERS = compiz-text.h
-
diff --git a/src/workspacenames.cpp b/src/workspacenames.cpp
new file mode 100644
index 0000000..a8abc85
--- /dev/null
+++ b/src/workspacenames.cpp
@@ -0,0 +1,264 @@
+/*
+ *
+ * Compiz workspace name display plugin
+ *
+ * workspacenames.cpp
+ *
+ * Copyright : (C) 2008 by Danny Baumann
+ * E-mail : maniac@compiz-fusion.org
+ *
+ * Ported to Compiz 0.9.x
+ * Copyright : (c) 2010 Scott Moreau <oreaus@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.
+ *
+ */
+
+#include "workspacenames.h"
+
+void
+WSNamesScreen::freeText ()
+{
+
+ if (textData.getWidth () == 0 &&
+ textData.getHeight () == 0)
+ return;
+
+ textData.clear ();
+}
+
+CompString
+WSNamesScreen::getCurrentWSName ()
+{
+ int currentVp;
+ int listSize, i;
+ CompString ret;
+ CompOption::Value::Vector names;
+ CompOption::Value::Vector vpNumbers;
+
+ vpNumbers = optionGetViewports ();
+ names = optionGetNames ();
+
+ currentVp = screen->vp ().y () * screen->vpSize ().width () +
+ screen->vp ().x () + 1;
+ listSize = MIN (vpNumbers.size (), names.size ());
+
+ for (i = 0; i < listSize; i++)
+ if (vpNumbers.at (i).i () == currentVp)
+ return names.at (i).s ();
+
+ return ret;
+}
+
+void
+WSNamesScreen::renderNameText ()
+{
+ CompText::Attrib attrib;
+ CompString name;
+
+ freeText ();
+
+ name = getCurrentWSName ();
+
+ if (name.empty ())
+ return;
+
+ CompRect oe = screen->getCurrentOutputExtents ();
+
+ /* 75% of the output device as maximum width */
+ attrib.maxWidth = oe.width () * 3 / 4;
+ attrib.maxHeight = 100;
+
+ attrib.family = "Sans";
+ attrib.size = optionGetTextFontSize ();
+
+ attrib.color[0] = optionGetFontColorRed ();
+ attrib.color[1] = optionGetFontColorGreen ();
+ attrib.color[2] = optionGetFontColorBlue ();
+ attrib.color[3] = optionGetFontColorAlpha ();
+
+ attrib.flags = CompText::WithBackground | CompText::Ellipsized;
+ if (optionGetBoldText ())
+ attrib.flags |= CompText::StyleBold;
+
+ attrib.bgHMargin = 15;
+ attrib.bgVMargin = 15;
+ attrib.bgColor[0] = optionGetBackColorRed ();
+ attrib.bgColor[1] = optionGetBackColorGreen ();
+ attrib.bgColor[2] = optionGetBackColorBlue ();
+ attrib.bgColor[3] = optionGetBackColorAlpha ();
+
+ textData.renderText (name, attrib);
+}
+
+void
+WSNamesScreen::drawText ()
+{
+ GLfloat alpha;
+ float x, y, border = 10.0f;
+
+ CompRect oe = screen->getCurrentOutputExtents ();
+
+ x = oe.centerX ();
+
+ /* assign y (for the lower corner!) according to the setting */
+ switch (optionGetTextPlacement ())
+ {
+ case WorkspacenamesOptions::TextPlacementCenteredOnScreen:
+ y = oe.centerY ();
+ break;
+ case WorkspacenamesOptions::TextPlacementTopOfScreen:
+ case WorkspacenamesOptions::TextPlacementBottomOfScreen:
+ {
+ CompRect workArea = screen->currentOutputDev ().workArea ();
+
+ if (optionGetTextPlacement () ==
+ WorkspacenamesOptions::TextPlacementTopOfScreen)
+ y = oe.y1 () + workArea.y () + (2 * border) + textData.getHeight ();
+ else
+ y = oe.y1 () + workArea.y () + workArea.height () - (2 * border);
+ }
+ break;
+ default:
+ return;
+ break;
+ }
+
+ if (timer)
+ alpha = timer / (optionGetFadeTime () * 1000.0f);
+ else
+ alpha = 1.0f;
+
+ textData.draw (floor (x), floor (y), alpha);
+}
+
+bool
+WSNamesScreen::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 (!(textData.getWidth () == 0 &&
+ textData.getHeight () == 0))
+ {
+ GLMatrix sTransform (transform);
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+ glPushMatrix ();
+ glLoadMatrixf (sTransform.getMatrix ());
+
+ drawText ();
+
+ glPopMatrix ();
+ }
+
+ return status;
+}
+
+void
+WSNamesScreen::preparePaint (int msSinceLastPaint)
+{
+ if (timer)
+ {
+ timer -= msSinceLastPaint;
+ timer = MAX (timer, 0);
+
+ if (!timer)
+ freeText ();
+ }
+
+ cScreen->preparePaint (msSinceLastPaint);
+}
+
+void
+WSNamesScreen::donePaint ()
+{
+ /* FIXME: better only damage paint region */
+ if (timer)
+ cScreen->damageScreen ();
+
+ cScreen->donePaint ();
+}
+
+bool
+WSNamesScreen::hideTimeout ()
+{
+ timer = optionGetFadeTime () * 1000;
+ if (!timer)
+ freeText ();
+
+ cScreen->damageScreen ();
+
+ timeoutHandle.stop ();
+
+ return false;
+}
+
+void
+WSNamesScreen::handleEvent (XEvent *event)
+{
+ screen->handleEvent (event);
+
+ if (event->type != PropertyNotify)
+ return;
+
+ if (event->xproperty.atom == Atoms::desktopViewport)
+ {
+ int timeout = optionGetDisplayTime () * 1000;
+
+ timer = 0;
+ if (timeoutHandle.active ())
+ timeoutHandle.stop ();
+
+ renderNameText ();
+ timeoutHandle.start (timeout, timeout + 200);
+
+ cScreen->damageScreen ();
+ }
+}
+
+WSNamesScreen::WSNamesScreen (CompScreen *screen) :
+ PluginClassHandler <WSNamesScreen, CompScreen> (screen),
+ cScreen (CompositeScreen::get (screen)),
+ gScreen (GLScreen::get (screen)),
+ timer (0)
+{
+ ScreenInterface::setHandler (screen, true);
+ CompositeScreenInterface::setHandler (cScreen, true);
+ GLScreenInterface::setHandler (gScreen, true);
+
+ timeoutHandle.start (boost::bind (&WSNamesScreen::hideTimeout, this),
+ 0, 0);
+}
+
+WSNamesScreen::~WSNamesScreen ()
+{
+ freeText ();
+}
+
+bool
+WorkspacenamesPluginVTable::init ()
+{
+ if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
+ !CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
+ !CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
+ return false;
+
+ if (!CompPlugin::checkPluginABI ("text", COMPIZ_TEXT_ABI))
+ compLogMessage ("workspacenames", CompLogLevelWarn,
+ "No compatible text plugin loaded");
+ return true;
+}
diff --git a/src/workspacenames.h b/src/workspacenames.h
new file mode 100644
index 0000000..3014547
--- /dev/null
+++ b/src/workspacenames.h
@@ -0,0 +1,94 @@
+/*
+ *
+ * Compiz workspace name display plugin
+ *
+ * workspacenames.h
+ *
+ * Copyright : (C) 2008 by Danny Baumann
+ * E-mail : maniac@compiz-fusion.org
+ *
+ * Ported to Compiz 0.9.x
+ * Copyright : (c) 2010 Scott Moreau <oreaus@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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <core/core.h>
+#include <core/atoms.h>
+#include <composite/composite.h>
+#include <opengl/opengl.h>
+#include <text/text.h>
+
+#include "workspacenames_options.h"
+
+class WSNamesScreen :
+ public PluginClassHandler <WSNamesScreen, CompScreen>,
+ public ScreenInterface,
+ public CompositeScreenInterface,
+ public GLScreenInterface,
+ public WorkspacenamesOptions
+{
+ public:
+ WSNamesScreen (CompScreen *screen);
+ ~WSNamesScreen ();
+
+ CompositeScreen *cScreen;
+ GLScreen *gScreen;
+
+ CompText textData;
+ CompTimer timeoutHandle;
+ int timer;
+
+ void
+ freeText ();
+
+ CompString
+ getCurrentWSName ();
+
+ void
+ renderNameText ();
+
+ void
+ drawText ();
+
+ bool
+ glPaintOutput (const GLScreenPaintAttrib &attrib,
+ const GLMatrix &transform,
+ const CompRegion &region,
+ CompOutput *output,
+ unsigned int mask);
+
+ void
+ preparePaint (int ms);
+
+ void
+ donePaint ();
+
+ bool
+ hideTimeout ();
+
+ void
+ handleEvent (XEvent *);
+};
+
+class WorkspacenamesPluginVTable :
+ public CompPlugin::VTableForScreen <WSNamesScreen>
+{
+ public:
+ bool init ();
+};
+
+COMPIZ_PLUGIN_20090315 (workspacenames, WorkspacenamesPluginVTable);
diff --git a/workspacenames.c b/workspacenames.c
deleted file mode 100644
index ecd9a18..0000000
--- a/workspacenames.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- *
- * Compiz workspace name display plugin
- *
- * workspacenames.c
- *
- * Copyright : (C) 2008 by Danny Baumann
- * E-mail : maniac@compiz-fusion.org
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <compiz-core.h>
-#include <compiz-text.h>
-#include "workspacenames_options.h"
-
-#define PI 3.1415926
-
-static int WSNamesDisplayPrivateIndex;
-
-typedef struct _WSNamesDisplay {
- int screenPrivateIndex;
-
- HandleEventProc handleEvent;
-
- TextFunc *textFunc;
-} WSNamesDisplay;
-
-typedef struct _WSNamesScreen {
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
-
- CompTextData *textData;
-
- CompTimeoutHandle timeoutHandle;
- int timer;
-} WSNamesScreen;
-
-#define WSNAMES_DISPLAY(d) PLUGIN_DISPLAY(d, WSNames, w)
-#define WSNAMES_SCREEN(s) PLUGIN_SCREEN(s, WSNames, w)
-
-static void
-wsnamesFreeText (CompScreen *s)
-{
- WSNAMES_SCREEN (s);
- WSNAMES_DISPLAY (s->display);
-
- if (!ws->textData)
- return;
-
- (wd->textFunc->finiTextData) (s, ws->textData);
- ws->textData = NULL;
-}
-
-static char *
-wsnamesGetCurrentWSName (CompScreen *s)
-{
- int currentVp;
- int listSize, i;
- CompListValue *names;
- CompListValue *vpNumbers;
-
- vpNumbers = workspacenamesGetViewports (s);
- names = workspacenamesGetNames (s);
-
- currentVp = s->y * s->hsize + s->x + 1;
- listSize = MIN (vpNumbers->nValue, names->nValue);
-
- for (i = 0; i < listSize; i++)
- if (vpNumbers->value[i].i == currentVp)
- return names->value[i].s;
-
- return NULL;
-}
-
-static void
-wsnamesRenderNameText (CompScreen *s)
-{
- CompTextAttrib attrib;
- char *name;
- int ox1, ox2, oy1, oy2;
-
- WSNAMES_SCREEN (s);
- WSNAMES_DISPLAY (s->display);
-
- wsnamesFreeText (s);
-
- name = wsnamesGetCurrentWSName (s);
- if (!name)
- return;
-
- getCurrentOutputExtents (s, &ox1, &oy1, &ox2, &oy2);
-
- /* 75% of the output device as maximum width */
- attrib.maxWidth = (ox2 - ox1) * 3 / 4;
- attrib.maxHeight = 100;
-
- attrib.family = "Sans";
- attrib.size = workspacenamesGetTextFontSize (s);
-
- attrib.color[0] = workspacenamesGetFontColorRed (s);
- attrib.color[1] = workspacenamesGetFontColorGreen (s);
- attrib.color[2] = workspacenamesGetFontColorBlue (s);
- attrib.color[3] = workspacenamesGetFontColorAlpha (s);
-
- attrib.flags = CompTextFlagWithBackground | CompTextFlagEllipsized;
- if (workspacenamesGetBoldText (s))
- attrib.flags |= CompTextFlagStyleBold;
-
- attrib.bgHMargin = 15;
- attrib.bgVMargin = 15;
- attrib.bgColor[0] = workspacenamesGetBackColorRed (s);
- attrib.bgColor[1] = workspacenamesGetBackColorGreen (s);
- attrib.bgColor[2] = workspacenamesGetBackColorBlue (s);
- attrib.bgColor[3] = workspacenamesGetBackColorAlpha (s);
-
- ws->textData = (wd->textFunc->renderText) (s, name, &attrib);
-}
-
-static void
-wsnamesDrawText (CompScreen *s)
-{
- GLfloat alpha;
- int ox1, ox2, oy1, oy2;
- float x, y, border = 10.0f;
-
- WSNAMES_SCREEN (s);
- WSNAMES_DISPLAY (s->display);
-
- getCurrentOutputExtents (s, &ox1, &oy1, &ox2, &oy2);
-
- x = ox1 + ((ox2 - ox1) / 2) - (ws->textData->width / 2);
-
- /* assign y (for the lower corner!) according to the setting */
- switch (workspacenamesGetTextPlacement (s))
- {
- case TextPlacementCenteredOnScreen:
- y = oy1 + ((oy2 - oy1) / 2) + (ws->textData->height / 2);
- break;
- case TextPlacementTopOfScreen:
- case TextPlacementBottomOfScreen:
- {
- XRectangle workArea;
- getWorkareaForOutput (s, s->currentOutputDev, &workArea);
-
- if (workspacenamesGetTextPlacement (s) ==
- TextPlacementTopOfScreen)
- y = oy1 + workArea.y + (2 * border) + ws->textData->height;
- else
- y = oy1 + workArea.y + workArea.height - (2 * border);
- }
- break;
- default:
- return;
- break;
- }
-
- if (ws->timer)
- alpha = ws->timer / (workspacenamesGetFadeTime (s) * 1000.0f);
- else
- alpha = 1.0f;
-
- (wd->textFunc->drawText) (s, ws->textData, floor (x), floor (y), alpha);
-}
-
-static Bool
-wsnamesPaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- Bool status;
-
- WSNAMES_SCREEN (s);
-
- UNWRAP (ws, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (ws, s, paintOutput, wsnamesPaintOutput);
-
- if (ws->textData)
- {
- CompTransform sTransform = *transform;
-
- transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
- glPushMatrix ();
- glLoadMatrixf (sTransform.m);
-
- wsnamesDrawText (s);
-
- glPopMatrix ();
- }
-
- return status;
-}
-
-static void
-wsnamesPreparePaintScreen (CompScreen *s,
- int msSinceLastPaint)
-{
- WSNAMES_SCREEN (s);
-
- if (ws->timer)
- {
- ws->timer -= msSinceLastPaint;
- ws->timer = MAX (ws->timer, 0);
-
- if (!ws->timer)
- wsnamesFreeText (s);
- }
-
- UNWRAP (ws, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, msSinceLastPaint);
- WRAP (ws, s, preparePaintScreen, wsnamesPreparePaintScreen);
-}
-
-static void
-wsnamesDonePaintScreen (CompScreen *s)
-{
- WSNAMES_SCREEN (s);
-
- /* FIXME: better only damage paint region */
- if (ws->timer)
- damageScreen (s);
-
- UNWRAP (ws, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (ws, s, donePaintScreen, wsnamesDonePaintScreen);
-}
-
-static Bool
-wsnamesHideTimeout (void *closure)
-{
- CompScreen *s = (CompScreen *) closure;
-
- WSNAMES_SCREEN (s);
-
- ws->timer = workspacenamesGetFadeTime (s) * 1000;
- if (!ws->timer)
- wsnamesFreeText (s);
-
- damageScreen (s);
-
- ws->timeoutHandle = 0;
-
- return FALSE;
-}
-
-static void
-wsnamesHandleEvent (CompDisplay *d,
- XEvent *event)
-{
- WSNAMES_DISPLAY (d);
-
- UNWRAP (wd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (wd, d, handleEvent, wsnamesHandleEvent);
-
- switch (event->type) {
- case PropertyNotify:
- if (event->xproperty.atom == d->desktopViewportAtom)
- {
- CompScreen *s;
- s = findScreenAtDisplay (d, event->xproperty.window);
- if (s)
- {
- int timeout;
-
- WSNAMES_SCREEN (s);
-
- ws->timer = 0;
- if (ws->timeoutHandle)
- compRemoveTimeout (ws->timeoutHandle);
-
- wsnamesRenderNameText (s);
- timeout = workspacenamesGetDisplayTime (s) * 1000;
- ws->timeoutHandle = compAddTimeout (timeout, timeout + 200,
- wsnamesHideTimeout, s);
-
- damageScreen (s);
- }
- }
- break;
- }
-}
-
-static Bool
-wsnamesInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- WSNamesDisplay *wd;
- int index;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- if (!checkPluginABI ("text", TEXT_ABIVERSION) ||
- !getPluginDisplayIndex (d, "text", &index))
- {
- return FALSE;
- }
-
- wd = malloc (sizeof (WSNamesDisplay));
- if (!wd)
- return FALSE;
-
- wd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (wd->screenPrivateIndex < 0)
- {
- free (wd);
- return FALSE;
- }
-
- wd->textFunc = d->base.privates[index].ptr;
-
- WRAP (wd, d, handleEvent, wsnamesHandleEvent);
-
- d->base.privates[WSNamesDisplayPrivateIndex].ptr = wd;
-
- return TRUE;
-}
-
-static void
-wsnamesFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- WSNAMES_DISPLAY (d);
-
- freeScreenPrivateIndex (d, wd->screenPrivateIndex);
-
- UNWRAP (wd, d, handleEvent);
-
- free (wd);
-}
-
-static Bool
-wsnamesInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- WSNamesScreen *ws;
-
- WSNAMES_DISPLAY (s->display);
-
- ws = malloc (sizeof (WSNamesScreen));
- if (!ws)
- return FALSE;
-
- ws->textData = NULL;
-
- ws->timeoutHandle = 0;
- ws->timer = 0;
-
- WRAP (ws, s, preparePaintScreen, wsnamesPreparePaintScreen);
- WRAP (ws, s, donePaintScreen, wsnamesDonePaintScreen);
- WRAP (ws, s, paintOutput, wsnamesPaintOutput);
-
- s->base.privates[wd->screenPrivateIndex].ptr = ws;
-
- return TRUE;
-}
-
-static void
-wsnamesFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- WSNAMES_SCREEN (s);
-
- UNWRAP (ws, s, preparePaintScreen);
- UNWRAP (ws, s, donePaintScreen);
- UNWRAP (ws, s, paintOutput);
-
- wsnamesFreeText (s);
-
- free (ws);
-}
-
-static CompBool
-wsnamesInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) wsnamesInitDisplay,
- (InitPluginObjectProc) wsnamesInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-wsnamesFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) wsnamesFiniDisplay,
- (FiniPluginObjectProc) wsnamesFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static Bool
-wsnamesInit (CompPlugin *p)
-{
- WSNamesDisplayPrivateIndex = allocateDisplayPrivateIndex ();
- if (WSNamesDisplayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-wsnamesFini (CompPlugin *p)
-{
- freeDisplayPrivateIndex (WSNamesDisplayPrivateIndex);
-}
-
-CompPluginVTable wsnamesVTable = {
- "workspacenames",
- 0,
- wsnamesInit,
- wsnamesFini,
- wsnamesInitObject,
- wsnamesFiniObject,
- 0,
- 0
-};
-
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &wsnamesVTable;
-}
diff --git a/workspacenames.xml.in b/workspacenames.xml.in
index 26fe747..7b6e442 100644
--- a/workspacenames.xml.in
+++ b/workspacenames.xml.in
@@ -6,10 +6,16 @@
<category>Window Management</category>
<deps>
<relation type="after">
+ <plugin>opengl</plugin>
+ <plugin>composite</plugin>
<plugin>text</plugin>
</relation>
+ <requirement>
+ <plugin>opengl</plugin>
+ <plugin>composite</plugin>
+ </requirement>
</deps>
- <screen>
+ <options>
<group>
<_short>Names</_short>
<subgroup>
@@ -104,6 +110,6 @@
</option>
</subgroup>
</group>
- </screen>
+ </options>
</plugin>
</compiz>