diff --git a/Makefile.am b/Makefile.am
index f52cff242b514f1d44da7cc51aabfb0d8efa0a83..16ffba2947aa1c69f70c30cda47daa6c1b3a1806 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,6 @@
 EXTRA_DIST = example.xfwm4rc
 
 SUBDIRS = src defaults themes
+
+distclean-local:
+	rm -f example.xfwm4rc
diff --git a/Makefile.in b/Makefile.in
index aa982dff7816a0963a3596be5864cd0236cb2937..eec5c4dd8e57207df1b572e32e222666a3707914 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -62,6 +62,7 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
 EXTRA_DIST = example.xfwm4rc
 
@@ -318,7 +319,8 @@ clean-am:  clean-hdr clean-tags clean-generic mostlyclean-am
 
 clean: clean-recursive
 
-distclean-am:  distclean-hdr distclean-tags distclean-generic clean-am
+distclean-am:  distclean-hdr distclean-tags distclean-generic clean-am \
+		distclean-local
 
 distclean: distclean-recursive
 	-rm -f config.status
@@ -345,6 +347,9 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
+distclean-local:
+	rm -f example.xfwm4rc
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/acconfig.h b/acconfig.h
index 7d3deb87d7b2e55f970405d699ff006a7b4975c2..567b67b508a272e62c78448f7d1559c6693bbf86 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1 +1,2 @@
 #undef DEBUG
+#undef XFWM4_DIR
diff --git a/config.h.in b/config.h.in
index 320306c006f4b68383c243d86f60199fa608e09a..9761ca44e9c76a9eaa134de3e32d0289a3d490c1 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,6 @@
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
 #undef DEBUG
+#undef XFWM4_DIR
 
 /* Define if you have the `X11' library (-lX11). */
 #undef HAVE_LIBX11
diff --git a/configure b/configure
index 35d2ab5f3ca524b91df6b82eca614ae259d452d9..15353163be0029e4dba84ad33f1cd369a1743a54 100755
--- a/configure
+++ b/configure
@@ -3926,6 +3926,21 @@ EOF
 
 fi;
 
+echo "$as_me:3929: checking xfwm4 directory structure" >&5
+echo $ECHO_N "checking xfwm4 directory structure... $ECHO_C" >&6
+if test "x$datadir" = "x\${prefix}/share" -o "x$prefix" = "xNONE";
+then
+  XFWM4_DIR="/usr/local/share/xfwm4"
+else
+  XFWM4_DIR="$datadir/xfwm4"
+fi
+echo "$as_me:3937: result: xfwm4 data dir set to $XFWM4_DIR" >&5
+echo "${ECHO_T}xfwm4 data dir set to $XFWM4_DIR" >&6
+
+cat >>confdefs.h <<\EOF
+#define XFWM4_DIR $XFWM4_DIR
+EOF
+
 ## Versions of dependencies
 GLIB_REQUIRED_VERSION=2.0.0
 GTK_REQUIRED_VERSION=2.0.0
@@ -3936,7 +3951,7 @@ PANGO_REQUIRED_VERSION=1.0.0
   if test -z "$PKG_CONFIG"; then
     # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-echo "$as_me:3939: checking for $ac_word" >&5
+echo "$as_me:3954: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3953,7 +3968,7 @@ for ac_dir in $ac_dummy; do
   test -z "$ac_dir" && ac_dir=.
   if $as_executable_p "$ac_dir/$ac_word"; then
    ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
-   echo "$as_me:3956: found $ac_dir/$ac_word" >&5
+   echo "$as_me:3971: found $ac_dir/$ac_word" >&5
    break
 fi
 done
@@ -3965,10 +3980,10 @@ fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 
 if test -n "$PKG_CONFIG"; then
-  echo "$as_me:3968: result: $PKG_CONFIG" >&5
+  echo "$as_me:3983: result: $PKG_CONFIG" >&5
 echo "${ECHO_T}$PKG_CONFIG" >&6
 else
-  echo "$as_me:3971: result: no" >&5
+  echo "$as_me:3986: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -3982,24 +3997,24 @@ fi
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:3985: checking for glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION" >&5
+        echo "$as_me:4000: checking for glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION" >&5
 echo $ECHO_N "checking for glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION... $ECHO_C" >&6
 
         if $PKG_CONFIG --exists "glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION" ; then
-            echo "$as_me:3989: result: yes" >&5
+            echo "$as_me:4004: result: yes" >&5
 echo "${ECHO_T}yes" >&6
             succeeded=yes
 
-            echo "$as_me:3993: checking BASE_DEPENDENCIES_CFLAGS" >&5
+            echo "$as_me:4008: checking BASE_DEPENDENCIES_CFLAGS" >&5
 echo $ECHO_N "checking BASE_DEPENDENCIES_CFLAGS... $ECHO_C" >&6
             BASE_DEPENDENCIES_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION"`
-            echo "$as_me:3996: result: $BASE_DEPENDENCIES_CFLAGS" >&5
+            echo "$as_me:4011: result: $BASE_DEPENDENCIES_CFLAGS" >&5
 echo "${ECHO_T}$BASE_DEPENDENCIES_CFLAGS" >&6
 
-            echo "$as_me:3999: checking BASE_DEPENDENCIES_LIBS" >&5
+            echo "$as_me:4014: checking BASE_DEPENDENCIES_LIBS" >&5
 echo $ECHO_N "checking BASE_DEPENDENCIES_LIBS... $ECHO_C" >&6
             BASE_DEPENDENCIES_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION"`
-            echo "$as_me:4002: result: $BASE_DEPENDENCIES_LIBS" >&5
+            echo "$as_me:4017: result: $BASE_DEPENDENCIES_LIBS" >&5
 echo "${ECHO_T}$BASE_DEPENDENCIES_LIBS" >&6
         else
             BASE_DEPENDENCIES_CFLAGS=""
@@ -4019,12 +4034,15 @@ echo "${ECHO_T}$BASE_DEPENDENCIES_LIBS" >&6
   if test $succeeded = yes; then
      :
   else
-     { { echo "$as_me:4022: error: Library requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+     { { echo "$as_me:4037: error: Library requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
 echo "$as_me: error: Library requirements (glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
    { (exit 1); exit 1; }; }
   fi
 
-ac_config_files="$ac_config_files Makefile src/Makefile defaults/defaults defaults/Makefile themes/Makefile themes/agua/Makefile themes/coldsteel/Makefile themes/crux/Makefile themes/cruxish/Makefile themes/gtk/Makefile themes/kde/Makefile themes/linea/Makefile themes/mofit/Makefile themes/next/Makefile themes/oroborus/Makefile themes/platinum/Makefile themes/redmond/Makefile themes/redmondxp/Makefile themes/slimline/Makefile themes/trench/Makefile themes/xfce/Makefile"
+sed -e "s%XFWM4_DIR%$XFWM4_DIR%g" example.xfwm4rc.in > example.xfwm4rc
+sed -e "s%XFWM4_DIR%$XFWM4_DIR%g" defaults/defaults.in > defaults/defaults
+
+ac_config_files="$ac_config_files Makefile src/Makefile defaults/Makefile themes/Makefile themes/agua/Makefile themes/coldsteel/Makefile themes/crux/Makefile themes/cruxish/Makefile themes/gtk/Makefile themes/kde/Makefile themes/linea/Makefile themes/mofit/Makefile themes/next/Makefile themes/oroborus/Makefile themes/platinum/Makefile themes/redmond/Makefile themes/redmondxp/Makefile themes/slimline/Makefile themes/trench/Makefile themes/xfce/Makefile"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -4104,7 +4122,7 @@ DEFS=-DHAVE_CONFIG_H
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:4107: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:4125: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -4280,7 +4298,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:4283: error: ambiguous option: $1
+    { { echo "$as_me:4301: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -4299,7 +4317,7 @@ Try \`$0 --help' for more information." >&2;}
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:4302: error: unrecognized option: $1
+  -*) { { echo "$as_me:4320: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -4343,7 +4361,6 @@ do
   # Handling of arguments.
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-  "defaults/defaults" ) CONFIG_FILES="$CONFIG_FILES defaults/defaults" ;;
   "defaults/Makefile" ) CONFIG_FILES="$CONFIG_FILES defaults/Makefile" ;;
   "themes/Makefile" ) CONFIG_FILES="$CONFIG_FILES themes/Makefile" ;;
   "themes/agua/Makefile" ) CONFIG_FILES="$CONFIG_FILES themes/agua/Makefile" ;;
@@ -4364,7 +4381,7 @@ do
   "themes/xfce/Makefile" ) CONFIG_FILES="$CONFIG_FILES themes/xfce/Makefile" ;;
   "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-  *) { { echo "$as_me:4367: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:4384: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -4469,6 +4486,7 @@ s,@X_CFLAGS@,$X_CFLAGS,;t t
 s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
 s,@X_LIBS@,$X_LIBS,;t t
 s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
+s,@XFWM4_DIR@,$XFWM4_DIR,;t t
 s,@PKG_CONFIG@,$PKG_CONFIG,;t t
 s,@BASE_DEPENDENCIES_CFLAGS@,$BASE_DEPENDENCIES_CFLAGS,;t t
 s,@BASE_DEPENDENCIES_LIBS@,$BASE_DEPENDENCIES_LIBS,;t t
@@ -4586,7 +4604,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:4589: creating $ac_file" >&5
+    { echo "$as_me:4607: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -4604,7 +4622,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:4607: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:4625: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -4617,7 +4635,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:4620: error: cannot find input file: $f" >&5
+           { { echo "$as_me:4638: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -4678,7 +4696,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:4681: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:4699: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -4689,7 +4707,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:4692: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:4710: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -4702,7 +4720,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:4705: error: cannot find input file: $f" >&5
+           { { echo "$as_me:4723: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -4819,7 +4837,7 @@ cat >>$CONFIG_STATUS <<\EOF
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:4822: $ac_file is unchanged" >&5
+      { echo "$as_me:4840: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
diff --git a/configure.in b/configure.in
index c263bf10945966aeb872200bb8c2780f8aee9bfa..d78100651bd80a044b8bc031fc8e86689c7230f4 100644
--- a/configure.in
+++ b/configure.in
@@ -20,6 +20,18 @@ AC_CHECK_FUNCS(malloc setlocale strchr strdup strrchr strstr)
 
 AC_ARG_ENABLE(debug, [  --enable-debug  	use this option if you want to debug xfwm4], [ AC_DEFINE(DEBUG, 1) ],)
 
+dnl The following is to ensure $prefix is properly expanded
+AC_MSG_CHECKING(xfwm4 directory structure)
+if test "x$datadir" = "x\${prefix}/share" -o "x$prefix" = "xNONE";
+then
+  XFWM4_DIR="/usr/local/share/xfwm4"
+else
+  XFWM4_DIR="$datadir/xfwm4"
+fi
+AC_MSG_RESULT(xfwm4 data dir set to $XFWM4_DIR)
+AC_SUBST(XFWM4_DIR)
+AC_DEFINE(XFWM4_DIR, $XFWM4_DIR)
+
 ## Versions of dependencies
 GLIB_REQUIRED_VERSION=2.0.0
 GTK_REQUIRED_VERSION=2.0.0
@@ -27,11 +39,12 @@ PANGO_REQUIRED_VERSION=1.0.0
 
 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION)
 
+sed -e "s%XFWM4_DIR%$XFWM4_DIR%g" example.xfwm4rc.in > example.xfwm4rc
+sed -e "s%XFWM4_DIR%$XFWM4_DIR%g" defaults/defaults.in > defaults/defaults
 
 AC_OUTPUT([
 Makefile
 src/Makefile
-defaults/defaults
 defaults/Makefile
 themes/Makefile
 themes/agua/Makefile
diff --git a/defaults/Makefile.am b/defaults/Makefile.am
index c9ac985fce343a86f59b8ec9d1bd985c70420232..ff95bd64104de448b8eaa8db98f410e74ccaeba4 100644
--- a/defaults/Makefile.am
+++ b/defaults/Makefile.am
@@ -1,4 +1,4 @@
-defaultsdir = $(prefix)/share/xfwm4
+defaultsdir = $(pkgdatadir)/xfwm4
 defaults_DATA = defaults
 
 distclean-local:
diff --git a/defaults/Makefile.in b/defaults/Makefile.in
index e6284794e632cbb7014be001b4a4ce4356ba9c54..fb6b00494ce483b724a30d9b2d5d0ffba6435778 100644
--- a/defaults/Makefile.in
+++ b/defaults/Makefile.in
@@ -62,15 +62,16 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-defaultsdir = $(prefix)/share/xfwm4
+defaultsdir = $(pkgdatadir)/xfwm4
 defaults_DATA = defaults
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =  defaults
+CONFIG_CLEAN_FILES = 
 DATA =  $(defaults_DATA)
 
-DIST_COMMON =  Makefile.am Makefile.in defaults.in
+DIST_COMMON =  Makefile.am Makefile.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -86,8 +87,6 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
 	cd $(top_builddir) \
 	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
-defaults: $(top_builddir)/config.status defaults.in
-	cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 install-defaultsDATA: $(defaults_DATA)
 	@$(NORMAL_INSTALL)
diff --git a/defaults/defaults.in b/defaults/defaults.in
index 04640db67fc90adcdc06095f5f414df60af30a61..39dcb6f91f02b2e01c2f1518bc3a23ef18b01df1 100644
--- a/defaults/defaults.in
+++ b/defaults/defaults.in
@@ -1,4 +1,4 @@
-theme=@prefix@/share/xfwm4/themes/kde
+theme=XFWM4_DIR/themes/kde
 title_alignment=left
 full_width_title=true
 button_layout=OT|SHMC
diff --git a/example.xfwm4rc b/example.xfwm4rc.in
similarity index 98%
rename from example.xfwm4rc
rename to example.xfwm4rc.in
index 273e97df3ea8ffc494b9b0db23f33c4eba44d8c1..a9e0c6a0ba940667c7e64889749f946c150ead8c 100644
--- a/example.xfwm4rc
+++ b/example.xfwm4rc.in
@@ -3,7 +3,7 @@
 # You can use it as a template for your own configuration file
 
 # theme=directory
-theme=/usr/local/share/xfwm4/themes/kde
+theme=XFWM4_DIR/themes/kde
 
 # title_alignment=left/right/center
 title_alignment=left
diff --git a/src/Makefile.in b/src/Makefile.in
index bad39c40e87ea576cb20f1447d3dfca1d25a0a86..ff7cdaa250f5e80d9e992307e7bcf33247c21d89 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -62,41 +62,13 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
 CFLAGS = @CFLAGS@ @X_CFLAGS@ @BASE_DEPENDENCIES_CFLAGS@ -DDATADIR=\"$(prefix)/share/xfwm4\"
 LIBS = @LIBS@ @X_LIBS@  @BASE_DEPENDENCIES_LIBS@
 
 bin_PROGRAMS = xfwm4
-xfwm4_SOURCES = \
-	client.c \
-	events.c \
-	frame.c \
-	gtk_style.c \
-	gtktoxevent.c \
-	hints.c \
-	keyboard.c \
-	main.c \
-	menu.c \
-	misc.c \
-	parserc.c \
-	pixmap.c \
-	settings.c \
-	workspaces.c \
-	client.h \
-	debug.h \
-	events.h \
-	frame.h \
-	gtk_style.h \
-	gtktoxevent.h \
-	hints.h \
-	keyboard.h \
-	main.h \
-	menu.h \
-	misc.h \
-	parserc.h \
-	pixmap.h \
-	settings.h \
-	workspaces.h
+xfwm4_SOURCES =  	client.c 	events.c 	frame.c 	gtk_style.c 	gtktoxevent.c 	hints.c 	keyboard.c 	main.c 	menu.c 	misc.c 	parserc.c 	pixmap.c 	settings.c 	workspaces.c 	client.h 	debug.h 	events.h 	frame.h 	gtk_style.h 	gtktoxevent.h 	hints.h 	keyboard.h 	main.h 	menu.h 	misc.h 	parserc.h 	pixmap.h 	settings.h 	workspaces.h
 
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
diff --git a/themes/Makefile.in b/themes/Makefile.in
index 85ccfaea525c0aedc2aa2b7714b5ca4b4727a582..fa92f78cffa78bfd143a0668c030e2b176667803 100644
--- a/themes/Makefile.in
+++ b/themes/Makefile.in
@@ -62,24 +62,9 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-SUBDIRS = \
-agua \
-coldsteel \
-crux \
-cruxish \
-gtk \
-kde \
-linea \
-mofit \
-next \
-oroborus \
-platinum \
-redmond \
-redmondxp \
-slimline \
-trench \
-xfce
+SUBDIRS =  agua coldsteel crux cruxish gtk kde linea mofit next oroborus platinum redmond redmondxp slimline trench xfce
 
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
diff --git a/themes/agua/Makefile.am b/themes/agua/Makefile.am
index bb4cbdaa0bb51dd08706b98b96b88523245c1bfc..253083a21aea14a60aa24ffa8beee9af044e7375 100644
--- a/themes/agua/Makefile.am
+++ b/themes/agua/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/agua
+themedir = $(XFWM4_DIR)/themes/agua
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/agua/Makefile.in b/themes/agua/Makefile.in
index 2776ae195f8d4631a24673bd2d808b4365991c27..bab2e354af94d8a6f7e57e19d47245d3ec24a497 100644
--- a/themes/agua/Makefile.in
+++ b/themes/agua/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/agua
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/agua
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/coldsteel/Makefile.am b/themes/coldsteel/Makefile.am
index f3087c005935c649ae9bcd0d300be2ea5feed364..37e290caee273713292826677ad92815b77472c7 100644
--- a/themes/coldsteel/Makefile.am
+++ b/themes/coldsteel/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/coldsteel
+themedir = $(XFWM4_DIR)/themes/coldsteel
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/coldsteel/Makefile.in b/themes/coldsteel/Makefile.in
index 70bd72e9af2c19cb6bc9d07b773a71013b4d3aa9..c0712238be0c41d7267ce43158a8e30eaa0d886f 100644
--- a/themes/coldsteel/Makefile.in
+++ b/themes/coldsteel/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/coldsteel
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/coldsteel
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/crux/Makefile.am b/themes/crux/Makefile.am
index d70515b1cb194a465c352258e13ea7a14f7bdb55..800fe195424f4f2ffd90fdd73afff94246212f45 100644
--- a/themes/crux/Makefile.am
+++ b/themes/crux/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/crux
+themedir = $(XFWM4_DIR)/themes/crux
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/crux/Makefile.in b/themes/crux/Makefile.in
index 873de5c2002c072cebcb5850af5ff41622e8b078..08e9352fdc9264831a461c465fe1ef30620a4bc8 100644
--- a/themes/crux/Makefile.in
+++ b/themes/crux/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/crux
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/crux
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/cruxish/Makefile.am b/themes/cruxish/Makefile.am
index d2771afa415a77aeb47e99ab5b215a4cc77d73fb..c7ccb7814187782a78b597015d0fa4fca85f3ea6 100644
--- a/themes/cruxish/Makefile.am
+++ b/themes/cruxish/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/cruxish
+themedir = $(XFWM4_DIR)/themes/cruxish
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/cruxish/Makefile.in b/themes/cruxish/Makefile.in
index 380dc49a924bb8caeff81ef0f6ad6a75526365ac..0b1e790833c603d47fd46d0adb5ae12100281409 100644
--- a/themes/cruxish/Makefile.in
+++ b/themes/cruxish/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/cruxish
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/cruxish
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/gtk/Makefile.am b/themes/gtk/Makefile.am
index a4509d28b620ee7ff4fac111eec2d0fc28d8c88e..c3b908ef8d735d979d2c3c66abf323c5322364f4 100644
--- a/themes/gtk/Makefile.am
+++ b/themes/gtk/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/gtk
+themedir = $(XFWM4_DIR)/themes/gtk
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/gtk/Makefile.in b/themes/gtk/Makefile.in
index 09bf29986e8a8e3958d5c0247f02b4b635211e32..21f2a0504e3b8a3f5049802a37b516eff65978d4 100644
--- a/themes/gtk/Makefile.in
+++ b/themes/gtk/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/gtk
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/gtk
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/kde/Makefile.am b/themes/kde/Makefile.am
index 6c4d6473163c7102eb29097cb2bbe3156badaee5..45fbb79a07cc8fdd5645cd020a541c2ec1ffc97b 100644
--- a/themes/kde/Makefile.am
+++ b/themes/kde/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/kde
+themedir = $(XFWM4_DIR)/themes/kde
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/kde/Makefile.in b/themes/kde/Makefile.in
index f7e304131c1832721bde8357ae6d9725e85653f6..c2c4e5f605305d585f2f41f28b7e968a2031340b 100644
--- a/themes/kde/Makefile.in
+++ b/themes/kde/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/kde
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/kde
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/linea/Makefile.am b/themes/linea/Makefile.am
index 18e3805ca8f29de659992b0b749ba327021feb18..4add04239ac01604e7bf5ecbd78202da70608361 100644
--- a/themes/linea/Makefile.am
+++ b/themes/linea/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/linea
+themedir = $(XFWM4_DIR)/themes/linea
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/linea/Makefile.in b/themes/linea/Makefile.in
index ae32e88c1423c85a23d8ad9d624bf1431eff0e75..d19944aac7b40e4281a204298f3aac02c5829f09 100644
--- a/themes/linea/Makefile.in
+++ b/themes/linea/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/linea
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/linea
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/mofit/Makefile.am b/themes/mofit/Makefile.am
index c3120f20b0bde53368cef90525bbe55b24158077..944ead265e136dfe32ecec4fc20bdedce7fc25e6 100644
--- a/themes/mofit/Makefile.am
+++ b/themes/mofit/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/mofit
+themedir = $(XFWM4_DIR)/themes/mofit
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/mofit/Makefile.in b/themes/mofit/Makefile.in
index 3f5413f9a95dcdc5bd6faa80c9f8d2cef361096a..69a7eb6219e514511490e68e6eaa14ced3aaec3c 100644
--- a/themes/mofit/Makefile.in
+++ b/themes/mofit/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/mofit
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/mofit
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/next/Makefile.am b/themes/next/Makefile.am
index 5b05b1a930b9ad0b795957b11c8ac95f4e61633f..9cd3ea50c5b8dd7871ed138f380a9b8a53d54628 100644
--- a/themes/next/Makefile.am
+++ b/themes/next/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/next
+themedir = $(XFWM4_DIR)/themes/next
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/next/Makefile.in b/themes/next/Makefile.in
index 34bbe71b5c553720cddabf7d7bd603581e305494..9daead566c20b906199d3d68dc55400a8815a937 100644
--- a/themes/next/Makefile.in
+++ b/themes/next/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/next
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/next
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/oroborus/Makefile.am b/themes/oroborus/Makefile.am
index 6c60f562d734939e3977d66994692183238747ba..e0e6d4e4886b92ea3156dd24833cb4ef6807f661 100644
--- a/themes/oroborus/Makefile.am
+++ b/themes/oroborus/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/oroborus
+themedir = $(XFWM4_DIR)/themes/oroborus
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/oroborus/Makefile.in b/themes/oroborus/Makefile.in
index 0a06ce5642d160a9162edcaeabca07297db6f39f..68e9211ecb93ed2e1f9068f5473e03474d14b51b 100644
--- a/themes/oroborus/Makefile.in
+++ b/themes/oroborus/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/oroborus
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/oroborus
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/platinum/Makefile.am b/themes/platinum/Makefile.am
index 923667d5c4f4fdd3fdc66985360b62e86a8e4909..4144de9ee15fe04c2805dc68eaff36a54370a9f4 100644
--- a/themes/platinum/Makefile.am
+++ b/themes/platinum/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/platinum
+themedir = $(XFWM4_DIR)/themes/platinum
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/platinum/Makefile.in b/themes/platinum/Makefile.in
index 3c58a863d494e94332c28bd996aa3f79651d8a0a..9f4748a8339357e53d338ef656a0037cc2d00d88 100644
--- a/themes/platinum/Makefile.in
+++ b/themes/platinum/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/platinum
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/platinum
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/redmond/Makefile.am b/themes/redmond/Makefile.am
index c4433525dea180069f08e0e67777fa8e2abbca78..6994cf9f001ca7ac2730f06fe57a31cd91d36654 100644
--- a/themes/redmond/Makefile.am
+++ b/themes/redmond/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/redmond
+themedir = $(XFWM4_DIR)/themes/redmond
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/redmond/Makefile.in b/themes/redmond/Makefile.in
index 70fc3157943143378f8b7b234bdb02a847b9121b..fab265acee19c48a6f8d060bedd6af7245559c84 100644
--- a/themes/redmond/Makefile.in
+++ b/themes/redmond/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/redmond
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/redmond
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/redmondxp/Makefile.am b/themes/redmondxp/Makefile.am
index 8c162c6391e04fe084c56059d6a59dfaaa6aca53..595c0d685e8715da56aa5cb4265ed17334d18702 100644
--- a/themes/redmondxp/Makefile.am
+++ b/themes/redmondxp/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/redmondxp
+themedir = $(XFWM4_DIR)/themes/redmondxp
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/redmondxp/Makefile.in b/themes/redmondxp/Makefile.in
index ae2788d55e9265357772bf706116c1b8ca8b3c0c..46378d84bfa552fabae80d82bf347cb4a113f63e 100644
--- a/themes/redmondxp/Makefile.in
+++ b/themes/redmondxp/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/redmondxp
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/redmondxp
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/slimline/Makefile.am b/themes/slimline/Makefile.am
index 5eff4ca7518202920dd3b929ffca6c86b9d15b6e..9f20d1edc492085c6a6fcdaf44d616555eea9507 100644
--- a/themes/slimline/Makefile.am
+++ b/themes/slimline/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/slimline
+themedir = $(XFWM4_DIR)/themes/slimline
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/slimline/Makefile.in b/themes/slimline/Makefile.in
index 514a7b46f5ecdd56954d2908191a4fb07531fcd9..a35e056d93020ed410449bb8566df659cf46497b 100644
--- a/themes/slimline/Makefile.in
+++ b/themes/slimline/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/slimline
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/slimline
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/trench/Makefile.am b/themes/trench/Makefile.am
index f21e6f2add0a48101fb2e0f9df631fbabfce6456..11394b618c7e605b3766d065e99c1293797d8b8e 100644
--- a/themes/trench/Makefile.am
+++ b/themes/trench/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/trench
+themedir = $(XFWM4_DIR)/themes/trench
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/trench/Makefile.in b/themes/trench/Makefile.in
index 03a27e56d8ad968ed37905c35055c7a1e9c04e23..f10c1672ccb262685ae9464fe3d2ad1312511ed0 100644
--- a/themes/trench/Makefile.in
+++ b/themes/trench/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/trench
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/trench
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/themes/xfce/Makefile.am b/themes/xfce/Makefile.am
index 167649444c28da1b8efe97d5a11d4d0499b55ee6..6a433127fbcde94806fd662028fdfb5b84562411 100644
--- a/themes/xfce/Makefile.am
+++ b/themes/xfce/Makefile.am
@@ -1,4 +1,4 @@
-themedir = $(prefix)/share/xfwm4/themes/xfce
+themedir = $(XFWM4_DIR)/themes/xfce
 theme_DATA = bottom-active.xpm \
 	bottom-inactive.xpm \
 	bottom-left-active.xpm \
diff --git a/themes/xfce/Makefile.in b/themes/xfce/Makefile.in
index 992e2e5b7389fe00470bcebbdb78c6e8d3f4d106..b57024560bd472010e384aeecf26276a8caac2f2 100644
--- a/themes/xfce/Makefile.in
+++ b/themes/xfce/Makefile.in
@@ -62,51 +62,10 @@ MAKEINFO = @MAKEINFO@
 PACKAGE = @PACKAGE@
 PKG_CONFIG = @PKG_CONFIG@
 VERSION = @VERSION@
+XFWM4_DIR = @XFWM4_DIR@
 
-themedir = $(prefix)/share/xfwm4/themes/xfce
-theme_DATA = bottom-active.xpm \
-	bottom-inactive.xpm \
-	bottom-left-active.xpm \
-	bottom-left-inactive.xpm \
-	bottom-right-active.xpm \
-	bottom-right-inactive.xpm \
-	close-active.xpm \
-	close-inactive.xpm \
-	close-pressed.xpm \
-	hide-active.xpm \
-	hide-inactive.xpm \
-	hide-pressed.xpm \
-	left-active.xpm \
-	left-inactive.xpm \
-	maximize-active.xpm \
-	maximize-inactive.xpm \
-	maximize-pressed.xpm \
-	menu-active.xpm \
-	menu-inactive.xpm \
-	menu-pressed.xpm \
-	right-active.xpm \
-	right-inactive.xpm \
-	shade-active.xpm \
-	shade-inactive.xpm \
-	shade-pressed.xpm \
-	stick-active.xpm \
-	stick-inactive.xpm \
-	stick-pressed.xpm \
-	themerc \
-	title-1-active.xpm \
-	title-1-inactive.xpm \
-	title-2-active.xpm \
-	title-2-inactive.xpm \
-	title-3-active.xpm \
-	title-3-inactive.xpm \
-	title-4-active.xpm \
-	title-4-inactive.xpm \
-	title-5-active.xpm \
-	title-5-inactive.xpm \
-	top-left-active.xpm \
-	top-left-inactive.xpm \
-	top-right-active.xpm \
-	top-right-inactive.xpm
+themedir = $(XFWM4_DIR)/themes/xfce
+theme_DATA = bottom-active.xpm 	bottom-inactive.xpm 	bottom-left-active.xpm 	bottom-left-inactive.xpm 	bottom-right-active.xpm 	bottom-right-inactive.xpm 	close-active.xpm 	close-inactive.xpm 	close-pressed.xpm 	hide-active.xpm 	hide-inactive.xpm 	hide-pressed.xpm 	left-active.xpm 	left-inactive.xpm 	maximize-active.xpm 	maximize-inactive.xpm 	maximize-pressed.xpm 	menu-active.xpm 	menu-inactive.xpm 	menu-pressed.xpm 	right-active.xpm 	right-inactive.xpm 	shade-active.xpm 	shade-inactive.xpm 	shade-pressed.xpm 	stick-active.xpm 	stick-inactive.xpm 	stick-pressed.xpm 	themerc 	title-1-active.xpm 	title-1-inactive.xpm 	title-2-active.xpm 	title-2-inactive.xpm 	title-3-active.xpm 	title-3-inactive.xpm 	title-4-active.xpm 	title-4-inactive.xpm 	title-5-active.xpm 	title-5-inactive.xpm 	top-left-active.xpm 	top-left-inactive.xpm 	top-right-active.xpm 	top-right-inactive.xpm
 
 EXTRA_DIST = $(theme_DATA)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/xfwm4.spec b/xfwm4.spec
new file mode 100644
index 0000000000000000000000000000000000000000..6a9aaf322b8a3f816a08acd955c57d2e79b31bef
--- /dev/null
+++ b/xfwm4.spec
@@ -0,0 +1,38 @@
+Summary: xfwm4, next generation window manager for xfce
+Name: xfwm4
+Version: 0.1.0
+Release: 1
+URL: http://people.redhat.com/~hp/metacity/
+Source0: %{name}-%{version}.tar.gz
+License: GPL
+Group: User Interface/Desktops
+BuildRoot: %{_tmppath}/%{name}-root
+BuildRequires: gtk2-devel >= 2.0.0
+BuildRequires: glib2-devel >= 2.0.0
+BuildRequires: pango-devel >= 1.0.0
+
+%description
+
+Xfwm4 is a window manager compatable with GNOME, GNOME2, KDE2, KDE3 and Xfce.
+
+%prep
+%setup -q
+
+%build
+%configure
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc example.xfwm4rc example.gtkrc-2.0 README
+%{_bindir}/*
+%{_datadir}/xfwm4
+
+