summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-06-01 10:22:42 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-06-01 10:22:42 -0500
commitd0ff33b1fe48e45ca08f7ca62dc36486250ecb77 (patch)
tree4cf47d0b1ab194cbdbf2b9088bd6b4e74514895a /testing
parenta132c57ad9882be1abe3785f1f103d6e5011866f (diff)
parentc40a217db5f63be3aa88a32ad77ec93efb40d95c (diff)
Merge branch 'master' of vparabola:~/abslibre-pre-mips64el
Conflicts: kde-unstable/calligra/PKGBUILD
Diffstat (limited to 'testing')
-rw-r--r--testing/glew/PKGBUILD29
-rw-r--r--testing/hugin/PKGBUILD40
-rw-r--r--testing/hugin/hugin-gcc46.patch16
-rw-r--r--testing/hugin/hugin.install15
-rw-r--r--testing/koffice/PKGBUILD301
-rw-r--r--testing/koffice/filters.install11
-rw-r--r--testing/koffice/gcc46.patch23
-rw-r--r--testing/koffice/kde4-koffice-libwpg02.patch1323
-rw-r--r--testing/koffice/koffice.install11
-rw-r--r--testing/koffice/krita.install12
-rw-r--r--testing/libreoffice/PKGBUILD701
-rw-r--r--testing/libreoffice/buildfix_64bit_system_libjpeg.diff11
-rw-r--r--testing/libreoffice/buildfix_bison25.diff23
-rw-r--r--testing/libreoffice/buildfix_boost.diff40
-rw-r--r--testing/libreoffice/buildfix_ct2n.diff17
-rw-r--r--testing/libreoffice/buildfix_i116795.diff22
-rw-r--r--testing/libreoffice/libreoffice.install25
-rw-r--r--testing/libreoffice/vbahelper.visibility.patch33
-rw-r--r--testing/moc/PKGBUILD45
-rw-r--r--testing/moc/gcc-undefined-symbols.diff12
-rw-r--r--testing/xorg-server/10-quirks.conf10
-rw-r--r--testing/xorg-server/PKGBUILD196
-rw-r--r--testing/xorg-server/autoconfig-nvidia.patch104
-rw-r--r--testing/xorg-server/bg-none-revert.patch58
-rw-r--r--testing/xorg-server/git-fixes.patch318
-rw-r--r--testing/xorg-server/xorg-redhat-die-ugly-pattern-die-die-die.patch16
-rw-r--r--testing/xorg-server/xserver-1.10-pointer-barriers.patch1054
-rw-r--r--testing/xorg-server/xvfb-run180
-rw-r--r--testing/xorg-server/xvfb-run.1282
29 files changed, 4928 insertions, 0 deletions
diff --git a/testing/glew/PKGBUILD b/testing/glew/PKGBUILD
new file mode 100644
index 000000000..6270e8c8f
--- /dev/null
+++ b/testing/glew/PKGBUILD
@@ -0,0 +1,29 @@
+# $Id: PKGBUILD 125318 2011-05-25 20:28:27Z stephane $
+# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
+# Contributor: SleepyDog
+
+pkgname=glew
+pkgver=1.6.0
+pkgrel=1
+pkgdesc="The OpenGL Extension Wrangler Library"
+arch=('i686' 'x86_64')
+url="http://glew.sourceforge.net"
+license=('BSD' 'MIT' 'GPL')
+depends=('libxmu' 'libxi' 'mesa')
+source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tgz)
+sha1sums=('ed555d15d0f01239b262c4cf803e97d60d8a18b6')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ sed -i 's|lib64|lib|' config/Makefile.linux
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make GLEW_DEST="${pkgdir}/usr" install.all
+ install -D -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+
+ rm "${pkgdir}"/usr/lib/{libGLEW,libGLEWmx}.a
+ chmod 0755 "${pkgdir}"/usr/lib/libGLEW*.so.${pkgver}
+}
diff --git a/testing/hugin/PKGBUILD b/testing/hugin/PKGBUILD
new file mode 100644
index 000000000..d09e302dd
--- /dev/null
+++ b/testing/hugin/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 125347 2011-05-26 02:15:23Z eric $
+# Maintainer: Tobias Kieslich <tobias@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Dominik Ryba <domryba@post.pl>
+
+pkgname=hugin
+pkgver=2010.4.0
+pkgrel=4
+pkgdesc="A frontend to the panorama-tools"
+arch=('i686' 'x86_64')
+url="http://hugin.sourceforge.net/"
+license=('LGPL')
+depends=('wxgtk' 'libpano13' 'boost-libs' 'enblend-enfuse' 'exiv2' 'openexr'
+ 'autopano-sift-c' 'lapack' 'desktop-file-utils' 'make' 'perl-exiftool')
+makedepends=('zip' 'cmake' 'boost')
+install=${pkgname}.install
+source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2 hugin-gcc46.patch)
+md5sums=('bfd716655461987312b2f2f00c90dcc5'
+ '4393c7b31da60f230c85e63a6a2e43a0')
+sha1sums=('47f25c0a8b97c27108e567bcd22203c87f268d07'
+ '52798a155a037f853f41402f797e8a4cb6bb3e07')
+
+build() {
+ cd "${srcdir}"
+ (cd ${pkgname}-${pkgver}; patch -p1 -i ../hugin-gcc46.patch)
+ mkdir build && cd build
+
+ cmake "${srcdir}/${pkgname}-${pkgver}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_EXE_LINKER_FLAGS="-lpthread" \
+ -DENABLE_LAPACK=yes
+
+ make
+}
+
+package(){
+ cd "${srcdir}/build"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/hugin/hugin-gcc46.patch b/testing/hugin/hugin-gcc46.patch
new file mode 100644
index 000000000..98a70ad50
--- /dev/null
+++ b/testing/hugin/hugin-gcc46.patch
@@ -0,0 +1,16 @@
+
+diff -r 0377a1af6110 -r 1fc6ad6e7c7a src/foreign/vigra/vigra/multi_iterator.hxx
+--- a/src/foreign/vigra/vigra/multi_iterator.hxx Mon Jun 25 16:36:21 2007 +0000
++++ b/src/foreign/vigra/vigra/multi_iterator.hxx Tue Jan 25 21:14:13 2011 +0000
+@@ -41,6 +41,7 @@
+ #define VIGRA_MULTI_ITERATOR_HXX
+
+ #include <sys/types.h>
++#include <stddef.h>
+ #include "tinyvector.hxx"
+ #include "iteratortags.hxx"
+
+
+
+
+
diff --git a/testing/hugin/hugin.install b/testing/hugin/hugin.install
new file mode 100644
index 000000000..362749233
--- /dev/null
+++ b/testing/hugin/hugin.install
@@ -0,0 +1,15 @@
+post_install() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/gnome
+ update-desktop-database -q
+ update-mime-database usr/share/mime > /dev/null
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ gtk-update-icon-cache -q -t -f usr/share/icons/gnome
+ update-desktop-database -q
+ update-mime-database usr/share/mime > /dev/null
+}
diff --git a/testing/koffice/PKGBUILD b/testing/koffice/PKGBUILD
new file mode 100644
index 000000000..1884dd92c
--- /dev/null
+++ b/testing/koffice/PKGBUILD
@@ -0,0 +1,301 @@
+# $Id: PKGBUILD 125678 2011-05-28 00:58:39Z andrea $
+# Maintainer: Ronald van Haren <ronald.archlinux.org>
+# Contributor: Andrea Scarpino <andrea@archlinux.org>
+# Contributor: BlackEagle < ike DOT devolder AT gmail DOT com >
+
+pkgbase=koffice
+pkgname=(
+ 'koffice-filters'
+ 'koffice-interfaces'
+ 'koffice-libs'
+ 'koffice-plugins'
+ 'koffice-pics'
+ 'koffice-servicetypes'
+ 'koffice-templates'
+ 'koffice-tools'
+ 'koffice-karbon'
+ 'koffice-karbon-doc'
+# 'koffice-kchart'
+# 'koffice-kchart-doc'
+ 'koffice-kexi'
+ 'koffice-kexi-doc'
+ 'koffice-kformula'
+ 'koffice-kformula-doc'
+ 'koffice-kounavail'
+ 'koffice-kplato'
+# 'koffice-kplato-doc'
+ 'koffice-kpresenter'
+ 'koffice-kpresenter-doc'
+ 'koffice-krita'
+# 'koffice-krita-doc' # no krita-doc anymore upstream
+ 'koffice-kspread'
+ 'koffice-kspread-doc'
+ 'koffice-kword'
+# 'koffice-kword-doc' # see http://userbase.kde.org/KWord/Manual for documentation (not supplied by upstream anymore in the sources)
+ 'koffice-handbook'
+ 'koffice-thesaurus-doc'
+# 'koffice-kdgantt' # still an empty package
+)
+pkgver=2.3.3
+pkgrel=4
+arch=('i686' 'x86_64')
+url='http://koffice.kde.org'
+license=('GPL' 'LGPL' 'FDL')
+makedepends=('pkg-config' 'cmake' 'automoc4' 'boost' 'eigen' 'gsl' 'lcms'
+ 'glew' 'qimageblitz' 'kdepimlibs' 'pstoedit' 'poppler-qt' 'libwpd'
+ 'libwpg' 'opengtl' 'kdegraphics-libs')
+groups=('koffice')
+source=("http://download.kde.org/stable/${pkgbase}-${pkgver}/${pkgbase}-${pkgver}.tar.bz2"
+ 'kde4-koffice-libwpg02.patch' 'gcc46.patch')
+sha256sums=('31ba0d98c0d29c7b8ab97efdeb6c618b82177b2b0ec85da088178254da43c099'
+ '69106deb4081d71b5bd8f2e4f5af67ca689e4ce9f2bb49c11dbce5fb3409d612'
+ 'e095c0b2bbedf41da6535a68b2275464dafd3f194566028d0135322f596e4739')
+
+build() {
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+
+ patch -p1 -i "${srcdir}/kde4-koffice-libwpg02.patch"
+ patch -p1 -i "${srcdir}"/gcc46.patch
+
+ cd "${srcdir}"
+ mkdir build
+ cd build
+ cmake ../${pkgbase}-${pkgver} \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=ON \
+ -DCMAKE_INSTALL_PREFIX=/usr
+ make
+}
+
+##### 1st package common files, depends, optdepends of the koffice applications #####
+
+package_koffice-filters(){
+ pkgdesc="Filters for the KDE office suite"
+ optdepends=('libgsf: Microsoft Word document importer' 'libwpd: WordPerfect document importer'
+ 'libwpg: Corel WordPerfect Graphics image importer' 'pstoedit: Karbon EPS import filter'
+ 'kdegraphics-libs: support for raw images')
+ install=filters.install
+ cd "${srcdir}/build/filters"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-interfaces(){
+ pkgdesc="Interfaces for the KDE office suite"
+ depends=('kdelibs' 'koffice-libs')
+ cd "${srcdir}/build/interfaces"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-libs(){
+ pkgdesc="Libs for the KDE office suite"
+ depends=('kdepimlibs' 'qca' 'lcms' 'koffice-servicetypes')
+ cd "${srcdir}/build/libs"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-plugins(){
+ pkgdesc="Plugins for the KDE office suite"
+ depends=('koffice-libs')
+ replaces=('koffice-kchart')
+ conflicts=('koffice-kchart')
+ cd "${srcdir}/build/plugins"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-pics(){
+ pkgdesc="Icons for the KDE office suite"
+ install=koffice.install
+ cd "${srcdir}/build/pics"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-servicetypes(){
+ pkgdesc="Servicetypes for the KDE office suite"
+ cd "${srcdir}/build/servicetypes"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-templates(){
+ pkgdesc="Templates for the KDE office suite"
+ cd "${srcdir}/build/templates"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-tools(){
+ pkgdesc="Tools for the KDE office suite"
+ depends=('koffice-libs')
+ cd "${srcdir}/build/tools"
+ make DESTDIR="${pkgdir}" install
+}
+
+#### package common files done #####
+
+#### package apps and their docs #####
+
+package_koffice-karbon(){
+ pkgdesc="Vector drawing application for KDE"
+ depends=('hicolor-icon-theme' 'koffice-libs' 'koffice-templates')
+ optdepends=('koffice-filters: import/export filters')
+ install=koffice.install
+ cd "${srcdir}/build/karbon"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-karbon-doc(){
+ pkgdesc="Documentation for karbon"
+ cd "${srcdir}/build/doc/karbon"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kexi(){
+ pkgdesc="Integrated data management application for the KDE office suite"
+ depends=('kdelibs' 'koffice-libs' 'koffice-kspread' 'sqlite3')
+ cd "${srcdir}/build/kexi"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kexi-doc(){
+ pkgdesc="Documentation for kexi"
+ cd "${srcdir}/build/doc/kexi"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kformula(){
+ pkgdesc="Formula editor for the KDE office suite"
+ depends=('kdelibs' 'koffice-libs')
+ cd "${srcdir}/build/kformula"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kformula-doc() {
+ pkgdesc="Documentation for koffice-kformula"
+ cd "${srcdir}/build/doc/kformula"
+ make DESTDIR="${pkgdir}" install
+}
+
+
+package_koffice-kounavail(){
+ pkgdesc="Kounavail for the KDE office suite"
+ depends=('kdelibs' 'koffice-libs')
+ cd "${srcdir}/build/kounavail"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kplato(){
+ pkgdesc="Project management application for KDE"
+ depends=('hicolor-icon-theme' 'koffice-libs' 'kdepimlibs' 'koffice-templates' \
+ 'koffice-plugins' 'koffice-kword')
+ install=koffice.install
+ cd "${srcdir}/build/kplato"
+ make DESTDIR="${pkgdir}" install
+}
+
+#package_koffice-kplato-doc(){
+# pkgdesc="Documentation for kplato"
+# cd ${srcdir}/build/doc/kplato
+# make DESTDIR="${pkgdir}" install
+#}
+
+package_koffice-kpresenter(){
+ pkgdesc="Presentation tool for KDE"
+ depends=('hicolor-icon-theme' 'koffice-libs' 'koffice-templates')
+ optdepends=('koffice-filters: import/export filters')
+ install=koffice.install
+ cd "${srcdir}/build/kpresenter"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kpresenter-doc(){
+ pkgdesc="Documentation for kpresenter"
+ cd "${srcdir}/build/doc/kpresenter"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-krita(){
+ pkgdesc="Graphics editor for KDE"
+ depends=('hicolor-icon-theme' 'glew' 'qimageblitz' 'koffice-libs' \
+ 'koffice-templates' 'koffice-plugins' 'poppler-qt' 'shared-mime-info' \
+ 'openexr' 'opengtl')
+ optdepends=('koffice-filters: import/export filters')
+ install=krita.install
+ cd "${srcdir}/build/krita"
+ make DESTDIR="${pkgdir}" install
+}
+
+#package_koffice-krita-doc(){
+# pkgdesc="Documentation for krita"
+# cd ${srcdir}/build/doc/krita
+# make DESTDIR="${pkgdir}" install
+#}
+
+
+package_koffice-kspread(){
+ pkgdesc="Spreadsheet application for KDE"
+ depends=('hicolor-icon-theme' 'gsl' 'koffice-libs' 'koffice-templates' 'koffice-plugins')
+ optdepends=('koffice-filters: import/export filters')
+ install=koffice.install
+ cd "${srcdir}/build/kspread"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kspread-doc(){
+ pkgdesc="Documentation for kspread"
+ cd "${srcdir}/build/doc/kspread"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-kword(){
+ pkgdesc="Wordprocessor for KDE"
+ depends=('hicolor-icon-theme' 'koffice-libs' 'koffice-templates' 'koffice-pics' \
+ 'koffice-kounavail' 'koffice-plugins')
+ optdepends=('koffice-filters: import/export filters')
+ install=koffice.install
+ cd "${srcdir}/build/kword"
+ make DESTDIR="${pkgdir}" install
+
+ # some sed lines to have python2 in extension scripts
+ sed -i "s|/usr/bin/env python|/usr/bin/env python2|" "${pkgdir}/usr/share/apps/kword/scripts/extensions/oouno.py"
+ sed -i "s|/usr/bin/env python|/usr/bin/env python2|" "${pkgdir}/usr/share/apps/kword/scripts/extensions/importdoxyxml.py"
+ sed -i "s|/usr/bin/env python|/usr/bin/env python2|" "${pkgdir}/usr/share/apps/kword/scripts/extensions/onlinehelp.py"
+}
+
+#package_koffice-kword-doc(){
+# pkgdesc="Documentation for kword"
+# cd ${srcdir}/build/doc/kword
+# make DESTDIR="${pkgdir}" install
+#}
+
+##### package apps done #####
+
+#package_koffice-kchart(){
+# pkgdesc="Charting tool for KDE"
+# depends=('hicolor-icon-theme' 'koffice-interfaces' 'koffice-templates')
+# optdepends=('koffice-filters: import/export filters')
+# install=koffice.install
+# cd "${srcdir}/build/kchart"
+# make DESTDIR="${pkgdir}" install
+#}
+
+#package_koffice-kchart-doc(){
+# pkgdesc="Documentation for kchart"
+# cd "${srcdir}/build/doc/kchart"
+# make DESTDIR="${pkgdir}" install
+#}
+
+#package_koffice-kdgantt(){
+# pkgdesc="Gantt for KDE"
+# cd "${srcdir}/build/kdgantt"
+# make DESTDIR="${pkgdir}" install
+#}
+
+package_koffice-handbook() {
+ pkgdesc="Documentation for koffice"
+ cd "${srcdir}/build/doc/koffice"
+ make DESTDIR="${pkgdir}" install
+}
+
+package_koffice-thesaurus-doc(){
+ pkgdesc="Documentation for koffice-thesaurus"
+ cd "${srcdir}/build/doc/thesaurus"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/koffice/filters.install b/testing/koffice/filters.install
new file mode 100644
index 000000000..7c8a8bd2b
--- /dev/null
+++ b/testing/koffice/filters.install
@@ -0,0 +1,11 @@
+post_install() {
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/koffice/gcc46.patch b/testing/koffice/gcc46.patch
new file mode 100644
index 000000000..dcf8a4f85
--- /dev/null
+++ b/testing/koffice/gcc46.patch
@@ -0,0 +1,23 @@
+diff -up koffice-2.3.2/krita/plugins/formats/exr/exr_converter.cc.gcc46 koffice-2.3.2/krita/plugins/formats/exr/exr_converter.cc
+--- koffice-2.3.2/krita/plugins/formats/exr/exr_converter.cc.gcc46 2011-02-17 06:13:40.000000000 -0600
++++ koffice-2.3.2/krita/plugins/formats/exr/exr_converter.cc 2011-02-19 21:15:56.597142885 -0600
+@@ -80,6 +80,9 @@ ImageType imfTypeToKisType(Imf::PixelTyp
+ return IT_FLOAT16;
+ case Imf::FLOAT:
+ return IT_FLOAT32;
++ default:
++ // shouldn't reach here
++ return IT_UNSUPPORTED;
+ }
+ }
+
+@@ -93,6 +96,9 @@ const KoColorSpace* kisTypeToColorSpace(
+ case IT_UNKNOWN:
+ case IT_UNSUPPORTED:
+ return 0;
++ default:
++ // shouldn't reach here
++ return 0;
+ }
+ }
+
diff --git a/testing/koffice/kde4-koffice-libwpg02.patch b/testing/koffice/kde4-koffice-libwpg02.patch
new file mode 100644
index 000000000..e2a55a216
--- /dev/null
+++ b/testing/koffice/kde4-koffice-libwpg02.patch
@@ -0,0 +1,1323 @@
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/CMakeLists.txt koffice-2.3.1-libwpg02/filters/karbon/wpg/import/CMakeLists.txt
+--- koffice-2.3.1/filters/karbon/wpg/import/CMakeLists.txt 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/CMakeLists.txt 2011-01-18 07:40:25.000000000 +0100
+@@ -1,16 +1,11 @@
+
+-
+ include_directories(${CMAKE_BINARY_DIR}/filters/ ${WPD_INCLUDE_DIR} ${LIBWPG_INCLUDE_DIR}/)
+
+-set(wpgimport_PART_SRCS
+-WPGImport.cpp
+-OdgExporter.cxx
+-FileOutputHandler.cxx
+-GraphicsElement.cxx)
++set(wpgimport_PART_SRCS WPGImport.cpp)
+
+ kde4_add_plugin(wpgimport ${wpgimport_PART_SRCS})
+
+-target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES})
++target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES} ${WPD_LIBRARIES})
+
+ install(TARGETS wpgimport DESTINATION ${PLUGIN_INSTALL_DIR})
+ install(FILES karbon_wpg_import.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/FileOutputHandler.cxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/FileOutputHandler.cxx
+--- koffice-2.3.1/filters/karbon/wpg/import/FileOutputHandler.cxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/FileOutputHandler.cxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,95 +0,0 @@
+-/* libwpg
+- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpg.sourceforge.net
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#include "FileOutputHandler.hxx"
+-
+-FileOutputHandler::FileOutputHandler(std::ostringstream &contentStream) :
+- mbIsTagOpened(false),
+- mContentStream(contentStream)
+-{
+-}
+-
+-void FileOutputHandler::startDocument()
+-{
+-}
+-
+-void FileOutputHandler::startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList)
+-{
+- if (mbIsTagOpened)
+- {
+- mContentStream << ">";
+- mbIsTagOpened = false;
+- }
+- mContentStream << "<" << psName;
+-
+- for (std::vector<std::pair<std::string, std::string> >::const_iterator i = xPropList.begin(); i != xPropList.end(); i++)
+- {
+- mContentStream << " " << (*i).first.c_str() << "=\"" << (*i).second.c_str() << "\"";
+- }
+- mbIsTagOpened = true;
+- msOpenedTagName = psName;
+-}
+-
+-void FileOutputHandler::endElement(const char *psName)
+-{
+- if (mbIsTagOpened)
+- {
+- if( msOpenedTagName == psName )
+- {
+- mContentStream << "/>";
+- mbIsTagOpened = false;
+- }
+- else // should not happen, but handle it
+- {
+- mContentStream << ">";
+- mContentStream << "</" << psName << ">";
+- mbIsTagOpened = false;
+- }
+- }
+- else
+- {
+- mContentStream << "</" << psName << ">";
+- mbIsTagOpened = false;
+- }
+-}
+-
+-void FileOutputHandler::characters(const std::string &sCharacters)
+-{
+- if (mbIsTagOpened)
+- {
+- mContentStream << ">";
+- mbIsTagOpened = false;
+- }
+- mContentStream << sCharacters.c_str();
+-}
+-
+-void FileOutputHandler::endDocument()
+-{
+- if (mbIsTagOpened)
+- {
+- mContentStream << ">";
+- mbIsTagOpened = false;
+- }
+-}
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/FileOutputHandler.hxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/FileOutputHandler.hxx
+--- koffice-2.3.1/filters/karbon/wpg/import/FileOutputHandler.hxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/FileOutputHandler.hxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,49 +0,0 @@
+-/* libwpg
+- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpg.sourceforge.net
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#ifndef FILEOUTPUTHANDLER_H
+-#define FILEOUTPUTHANDLER_H
+-
+-#include <iostream>
+-#include <sstream>
+-#include <string>
+-#include "GraphicsHandler.hxx"
+-
+-class FileOutputHandler : public GraphicsHandler
+-{
+- public:
+- explicit FileOutputHandler(std::ostringstream &contentStream);
+- virtual void startDocument();
+- virtual void endDocument();
+- virtual void startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList);
+- virtual void endElement(const char *psName);
+- virtual void characters(const std::string &sCharacters);
+-
+- private:
+- bool mbIsTagOpened;
+- std::string msOpenedTagName;
+- std::ostringstream &mContentStream;
+-};
+-#endif
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/GraphicsElement.cxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsElement.cxx
+--- koffice-2.3.1/filters/karbon/wpg/import/GraphicsElement.cxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsElement.cxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,66 +0,0 @@
+-/* GraphicsElement: The items we are collecting to be put into the Writer
+- * document: paragraph and spans of text, as well as section breaks.
+- *
+- * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca)
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Lesser 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpg.sourceforge.net
+- *
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#include "GraphicsElement.hxx"
+-#include "GraphicsHandler.hxx"
+-#include <string.h>
+-
+-#define ASCII_SPACE 0x0020
+-
+-void TagGraphicsElement::print() const
+-{
+-}
+-
+-void OpenTagGraphicsElement::write(GraphicsHandler *pHandler) const
+-{
+- pHandler->startElement(getTagName().c_str(), maAttrList);
+-}
+-
+-void OpenTagGraphicsElement::print() const
+-{
+- TagGraphicsElement::print();
+-}
+-
+-void OpenTagGraphicsElement::addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue)
+-{
+- std::pair<std::string, std::string> tmpAttribute;
+- tmpAttribute.first = szAttributeName;
+- tmpAttribute.second = sAttributeValue;
+- maAttrList.push_back(tmpAttribute);
+-}
+-
+-void CloseTagGraphicsElement::write(GraphicsHandler *pHandler) const
+-{
+-
+- pHandler->endElement(getTagName().c_str());
+-}
+-
+-void CharDataGraphicsElement::write(GraphicsHandler *pHandler) const
+-{
+- pHandler->characters(msData);
+-}
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/GraphicsElement.hxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsElement.hxx
+--- koffice-2.3.1/filters/karbon/wpg/import/GraphicsElement.hxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsElement.hxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,84 +0,0 @@
+-/* GraphicsElement: The items we are collecting to be put into the Writer
+- * document: paragraph and spans of text, as well as section breaks.
+- *
+- * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca)
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Lesser 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpd.sourceforge.net
+- *
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#ifndef _GRAPHICSELEMENT_H
+-#define _GRAPHICSELEMENT_H
+-#include <string>
+-#include <map>
+-#include <vector>
+-
+-#include "GraphicsHandler.hxx"
+-
+-class GraphicsElement
+-{
+-public:
+- virtual ~GraphicsElement() {}
+- virtual void write(GraphicsHandler *pHandler) const = 0;
+- virtual void print() const {}
+-};
+-
+-class TagGraphicsElement : public GraphicsElement
+-{
+-public:
+- explicit TagGraphicsElement(const char *szTagName) : msTagName(szTagName) {}
+- const std::string &getTagName() const { return msTagName; }
+- virtual void print() const;
+-private:
+- const std::string msTagName;
+-};
+-
+-class OpenTagGraphicsElement : public TagGraphicsElement
+-{
+-public:
+- explicit OpenTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {}
+- ~OpenTagGraphicsElement() {}
+- void addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue);
+- virtual void write(GraphicsHandler *pHandler) const;
+- virtual void print () const;
+-private:
+- std::vector<std::pair<std::string, std::string> > maAttrList;
+-};
+-
+-class CloseTagGraphicsElement : public TagGraphicsElement
+-{
+-public:
+- explicit CloseTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {}
+- virtual void write(GraphicsHandler *pHandler) const;
+-};
+-
+-class CharDataGraphicsElement : public GraphicsElement
+-{
+-public:
+- CharDataGraphicsElement(const char *sData) : GraphicsElement(), msData(sData) {}
+- virtual void write(GraphicsHandler *pHandler) const;
+-private:
+- std::string msData;
+-};
+-
+-
+-#endif
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/GraphicsHandler.hxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsHandler.hxx
+--- koffice-2.3.1/filters/karbon/wpg/import/GraphicsHandler.hxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/GraphicsHandler.hxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,43 +0,0 @@
+-/*
+- * Copyright (C) 2004 William Lachance (wlach@interlog.com)
+- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version 2
+- * of the License, or (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * Contributor(s): Martin Gallwey (gallwey@sun.com)
+- *
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-#ifndef _GRAPHICSHANDLER_H
+-#define _GRAPHICSHANDLER_H
+-#include <string>
+-#include <map>
+-#include <vector>
+-
+-class GraphicsHandler
+-{
+-public:
+- virtual ~GraphicsHandler() {}
+- virtual void startDocument() = 0;
+- virtual void endDocument() = 0;
+- virtual void startElement(const char *psName, const std::vector< std::pair <std::string, std::string> > &xPropList) = 0;
+- virtual void endElement(const char *psName) = 0;
+- virtual void characters(const std::string &sCharacters) = 0;
+-};
+-#endif
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/OdgExporter.cxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/OdgExporter.cxx
+--- koffice-2.3.1/filters/karbon/wpg/import/OdgExporter.cxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/OdgExporter.cxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,662 +0,0 @@
+-/* libwpg
+- * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
+- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpg.sourceforge.net
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#include "OdgExporter.hxx"
+-#include "GraphicsElement.hxx"
+-#include "GraphicsHandler.hxx"
+-#include <locale.h>
+-
+-static std::string doubleToString(const double value)
+-{
+- std::ostringstream tempStream;
+- tempStream << value;
+- std::string decimalPoint(localeconv()->decimal_point);
+- if ((decimalPoint.size() == 0) || (decimalPoint == "."))
+- return tempStream.str();
+- std::string stringValue(tempStream.str());
+- if (!stringValue.empty())
+- {
+- std::string::size_type pos;
+- while ((pos = stringValue.find(decimalPoint)) != std::string::npos)
+- stringValue.replace(pos,decimalPoint.size(),".");
+- }
+- return stringValue;
+-}
+-
+-
+-OdgExporter::OdgExporter(GraphicsHandler *pHandler, const bool isFlatXML):
+- mpHandler(pHandler),
+- m_fillRule(AlternatingFill),
+- m_gradientIndex(1),
+- m_dashIndex(1),
+- m_styleIndex(1),
+- m_width(0.0f),
+- m_height(0.0f),
+- m_isFlatXML(isFlatXML)
+-{
+-}
+-
+-OdgExporter::~OdgExporter()
+-{
+- for (std::vector <GraphicsElement *>::iterator iterStroke = mStrokeDashElements.begin();
+- iterStroke != mStrokeDashElements.end(); iterStroke++)
+- delete (*iterStroke);
+-
+- for (std::vector <GraphicsElement *>::iterator iterGradient = mGradientElements.begin();
+- iterGradient != mGradientElements.end(); iterGradient++)
+- delete (*iterGradient);
+-
+- for (std::vector <GraphicsElement *>::iterator iterAutomaticStyles = mAutomaticStylesElements.begin();
+- iterAutomaticStyles != mAutomaticStylesElements.end(); iterAutomaticStyles++)
+- delete (*iterAutomaticStyles);
+-
+- for (std::vector<GraphicsElement *>::iterator bodyIter = mBodyElements.begin();
+- bodyIter != mBodyElements.end(); bodyIter++)
+- delete (*bodyIter);
+-}
+-
+-void OdgExporter::startGraphics(double width, double height)
+-{
+- m_gradientIndex = 1;
+- m_dashIndex = 1;
+- m_styleIndex = 1;
+- m_width = width;
+- m_height = height;
+-
+-
+- mpHandler->startDocument();
+- OpenTagGraphicsElement tmpOfficeDocumentContent("office:document");
+- tmpOfficeDocumentContent.addAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
+- tmpOfficeDocumentContent.addAttribute("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:config", "urn:oasis:names:tc:opendocument:xmlns:config:1.0");
+- tmpOfficeDocumentContent.addAttribute("xmlns:ooo", "http://openoffice.org/2004/office");
+- tmpOfficeDocumentContent.addAttribute("office:version", "1.0");
+- if (m_isFlatXML)
+- tmpOfficeDocumentContent.addAttribute("office:mimetype", "application/x-vnd.oasis.openoffice.drawing");
+- tmpOfficeDocumentContent.write(mpHandler);
+-
+- OpenTagGraphicsElement("office:settings").write(mpHandler);
+-
+- OpenTagGraphicsElement configItemSetOpenElement("config:config-item-set");
+- configItemSetOpenElement.addAttribute("config:name", "ooo:view-settings");
+- configItemSetOpenElement.write(mpHandler);
+-
+- OpenTagGraphicsElement configItemOpenElement1("config:config-item");
+- configItemOpenElement1.addAttribute("config:name", "VisibleAreaTop");
+- configItemOpenElement1.addAttribute("config:type", "int");
+- configItemOpenElement1.write(mpHandler);
+- mpHandler->characters("0");
+- mpHandler->endElement("config:config-item");
+-
+- OpenTagGraphicsElement configItemOpenElement2("config:config-item");
+- configItemOpenElement2.addAttribute("config:name", "VisibleAreaLeft");
+- configItemOpenElement2.addAttribute("config:type", "int");
+- configItemOpenElement2.write(mpHandler);
+- mpHandler->characters("0");
+- mpHandler->endElement("config:config-item");
+-
+- OpenTagGraphicsElement configItemOpenElement3("config:config-item");
+- configItemOpenElement3.addAttribute("config:name", "VisibleAreaWidth");
+- configItemOpenElement3.addAttribute("config:type", "int");
+- configItemOpenElement3.write(mpHandler);
+- m_value.str("");
+- m_value << (unsigned)(2540 * width);
+- mpHandler->characters(m_value.str());
+- mpHandler->endElement("config:config-item");
+-
+- OpenTagGraphicsElement configItemOpenElement4("config:config-item");
+- configItemOpenElement4.addAttribute("config:name", "VisibleAreaHeight");
+- configItemOpenElement4.addAttribute("config:type", "int");
+- configItemOpenElement4.write(mpHandler);
+- m_value.str("");
+- m_value << (unsigned)(2540 * height);
+- mpHandler->characters(m_value.str());
+- mpHandler->endElement("config:config-item");
+-
+- mpHandler->endElement("config:config-item-set");
+-
+- mpHandler->endElement("office:settings");
+-
+-}
+-
+-void OdgExporter::endGraphics()
+-{
+- OpenTagGraphicsElement("office:styles").write(mpHandler);
+-
+- for (std::vector <GraphicsElement *>::const_iterator iterStroke = mStrokeDashElements.begin();
+- iterStroke != mStrokeDashElements.end(); iterStroke++)
+- (*iterStroke)->write(mpHandler);
+-
+- for (std::vector <GraphicsElement *>::const_iterator iterGradient = mGradientElements.begin();
+- iterGradient != mGradientElements.end(); iterGradient++)
+- (*iterGradient)->write(mpHandler);
+-
+- mpHandler->endElement("office:styles");
+-
+- OpenTagGraphicsElement("office:automatic-styles").write(mpHandler);
+-
+- for (std::vector <GraphicsElement *>::const_iterator iterAutomaticStyles = mAutomaticStylesElements.begin();
+- iterAutomaticStyles != mAutomaticStylesElements.end(); iterAutomaticStyles++)
+- (*iterAutomaticStyles)->write(mpHandler);
+-
+- OpenTagGraphicsElement tmpStylePageLayoutOpenElement("style:page-layout");
+- tmpStylePageLayoutOpenElement.addAttribute("style:name", "PM0");
+- tmpStylePageLayoutOpenElement.write(mpHandler);
+-
+- OpenTagGraphicsElement tmpStylePageLayoutPropertiesOpenElement("style:page-layout-properties");
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-top", "0in");
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-bottom", "0in");
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-left", "0in");
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-right", "0in");
+- m_value.str("");
+- m_value << doubleToString(m_width) << "in";
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:page-width", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(m_height) << "in";
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:page-height", m_value.str());
+- m_value.str("");
+- tmpStylePageLayoutPropertiesOpenElement.addAttribute("style:print-orientation", "portrait");
+- tmpStylePageLayoutPropertiesOpenElement.write(mpHandler);
+-
+- mpHandler->endElement("style:page-layout-properties");
+-
+- mpHandler->endElement("style:page-layout");
+-
+- OpenTagGraphicsElement tmpStyleStyleOpenElement("style:style");
+- tmpStyleStyleOpenElement.addAttribute("style:name", "dp1");
+- tmpStyleStyleOpenElement.addAttribute("style:family", "drawing-page");
+- tmpStyleStyleOpenElement.write(mpHandler);
+-
+- OpenTagGraphicsElement tmpStyleDrawingPagePropertiesOpenElement("style:drawing-page-properties");
+- // tmpStyleDrawingPagePropertiesOpenElement.addAttribute("draw:background-size", "border");
+- tmpStyleDrawingPagePropertiesOpenElement.addAttribute("draw:fill", "none");
+- tmpStyleDrawingPagePropertiesOpenElement.write(mpHandler);
+-
+- mpHandler->endElement("style:drawing-page-properties");
+-
+- mpHandler->endElement("style:style");
+-
+- mpHandler->endElement("office:automatic-styles");
+-
+- OpenTagGraphicsElement("office:master-styles").write(mpHandler);
+-
+- OpenTagGraphicsElement tmpStyleMasterPageOpenElement("style:master-page");
+- tmpStyleMasterPageOpenElement.addAttribute("style:name", "Default");
+- tmpStyleMasterPageOpenElement.addAttribute("style:page-layout-name", "PM0");
+- tmpStyleMasterPageOpenElement.addAttribute("draw:style-name", "dp1");
+- tmpStyleMasterPageOpenElement.write(mpHandler);
+-
+- mpHandler->endElement("style:master-page");
+-
+- mpHandler->endElement("office:master-styles");
+-
+- OpenTagGraphicsElement("office:body").write(mpHandler);
+-
+- OpenTagGraphicsElement("office:drawing").write(mpHandler);
+-
+- OpenTagGraphicsElement tmpDrawPageOpenElement("draw:page");
+- tmpDrawPageOpenElement.addAttribute("draw:name", "page1");
+- tmpDrawPageOpenElement.addAttribute("draw:style-name", "dp1");
+- tmpDrawPageOpenElement.addAttribute("draw:master-page-name", "Default");
+- tmpDrawPageOpenElement.write(mpHandler);
+-
+- for (std::vector<GraphicsElement *>::const_iterator bodyIter = mBodyElements.begin();
+- bodyIter != mBodyElements.end(); bodyIter++)
+- {
+- (*bodyIter)->write(mpHandler);
+- }
+-
+- mpHandler->endElement("draw:page");
+- mpHandler->endElement("office:drawing");
+- mpHandler->endElement("office:body");
+- mpHandler->endElement("office:document");
+-
+- mpHandler->endDocument();
+-}
+-
+-void OdgExporter::setPen(const libwpg::WPGPen& pen)
+-{
+- m_pen = pen;
+-}
+-
+-void OdgExporter::setBrush(const libwpg::WPGBrush& brush)
+-{
+- m_brush = brush;
+-}
+-
+-void OdgExporter::setFillRule(FillRule rule)
+-{
+- m_fillRule = rule;
+-}
+-
+-void OdgExporter::startLayer(unsigned int)
+-{
+-}
+-
+-void OdgExporter::endLayer(unsigned int)
+-{
+-}
+-
+-void OdgExporter::drawRectangle(const libwpg::WPGRect& rect, double rx, double )
+-{
+- writeStyle();
+- OpenTagGraphicsElement *pDrawRectElement = new OpenTagGraphicsElement("draw:rect");
+- m_value.str("");
+- m_value << "gr" << m_styleIndex-1;
+- pDrawRectElement->addAttribute("draw:style-name", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(rect.x1) << "in";
+- pDrawRectElement->addAttribute("svg:x", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(rect.y1) << "in";
+- pDrawRectElement->addAttribute("svg:y", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(rect.x2-rect.x1) << "in";
+- pDrawRectElement->addAttribute("svg:width", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(rect.y2-rect.y1) << "in";
+- pDrawRectElement->addAttribute("svg:height", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(rx) << "in";
+- // FIXME: what to do when rx != ry ?
+- pDrawRectElement->addAttribute("draw:corner-radius", m_value.str());
+- m_value.str("");
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawRectElement));
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:rect")));
+-}
+-
+-void OdgExporter::drawEllipse(const libwpg::WPGPoint& center, double rx, double ry)
+-{
+- writeStyle();
+- OpenTagGraphicsElement *pDrawEllipseElement = new OpenTagGraphicsElement("draw:ellipse");
+- m_value.str("");
+- m_value << "gr" << m_styleIndex-1;
+- pDrawEllipseElement->addAttribute("draw:style-name", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(center.x - rx) << "in";
+- pDrawEllipseElement->addAttribute("svg:x", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(center.y - ry) << "in";
+- pDrawEllipseElement->addAttribute("svg:y", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(2 * rx) << "in";
+- pDrawEllipseElement->addAttribute("svg:width", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(2 * ry) << "in";
+- pDrawEllipseElement->addAttribute("svg:height", m_value.str());
+- m_value.str("");
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawEllipseElement));
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:ellipse")));
+-}
+-
+-void OdgExporter::drawPolygon(const libwpg::WPGPointArray& vertices)
+-{
+- if(vertices.count() < 2)
+- return;
+-
+- if(vertices.count() == 2)
+- {
+- const libwpg::WPGPoint& p1 = vertices[0];
+- const libwpg::WPGPoint& p2 = vertices[1];
+-
+- writeStyle();
+- OpenTagGraphicsElement *pDrawLineElement = new OpenTagGraphicsElement("draw:line");
+- m_value.str("");
+- m_value << "gr" << m_styleIndex-1;
+- pDrawLineElement->addAttribute("draw:style-name", m_value.str());
+- m_value.str("");
+- pDrawLineElement->addAttribute("draw:text-style-name", "P1");
+- pDrawLineElement->addAttribute("draw:layer", "layout");
+- m_value << doubleToString(p1.x) << "in";
+- pDrawLineElement->addAttribute("svg:x1", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(p1.y) << "in";
+- pDrawLineElement->addAttribute("svg:y1", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(p2.x) << "in";
+- pDrawLineElement->addAttribute("svg:x2", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(p2.y) << "in";
+- pDrawLineElement->addAttribute("svg:y2", m_value.str());
+- m_value.str("");
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawLineElement));
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:line")));
+- }
+- else
+- {
+- // draw as path
+- libwpg::WPGPath path;
+- path.moveTo(vertices[0]);
+- for(unsigned long ii = 1; ii < vertices.count(); ii++)
+- path.lineTo(vertices[ii]);
+- path.closed = true;
+- drawPath(path);
+- }
+-}
+-
+-void OdgExporter::drawPath(const libwpg::WPGPath& path)
+-{
+- if(path.count() == 0)
+- return;
+-
+- // try to find the bounding box
+- // this is simple convex hull technique, the bounding box might not be
+- // accurate but that should be enough for this purpose
+- libwpg::WPGPoint p = path.element(0).point;
+- libwpg::WPGPoint q = path.element(0).point;
+- for(unsigned k = 0; k < path.count(); k++)
+- {
+- libwpg::WPGPathElement element = path.element(k);
+- p.x = (p.x > element.point.x) ? element.point.x : p.x;
+- p.y = (p.y > element.point.y) ? element.point.y : p.y;
+- q.x = (q.x < element.point.x) ? element.point.x : q.x;
+- q.y = (q.y < element.point.y) ? element.point.y : q.y;
+- if(element.type == libwpg::WPGPathElement::CurveToElement)
+- {
+- p.x = (p.x > element.extra1.x) ? element.extra1.x : p.x;
+- p.y = (p.y > element.extra1.y) ? element.extra1.y : p.y;
+- q.x = (q.x < element.extra1.x) ? element.extra1.x : q.x;
+- q.y = (q.y < element.extra1.y) ? element.extra1.y : q.y;
+- p.x = (p.x > element.extra2.x) ? element.extra2.x : p.x;
+- p.y = (p.y > element.extra2.y) ? element.extra2.y : p.y;
+- q.x = (q.x < element.extra2.x) ? element.extra2.x : q.x;
+- q.y = (q.y < element.extra2.y) ? element.extra2.y : q.y;
+- }
+- }
+- double vw = q.x - p.x;
+- double vh = q.y - p.y;
+-
+- writeStyle();
+-
+- OpenTagGraphicsElement *pDrawPathElement = new OpenTagGraphicsElement("draw:path");
+- m_value.str("");
+- m_value << "gr" << m_styleIndex-1;
+- pDrawPathElement->addAttribute("draw:style-name", m_value.str());
+- m_value.str("");
+- pDrawPathElement->addAttribute("draw:text-style-name", "P1");
+- pDrawPathElement->addAttribute("draw:layer", "layout");
+- m_value << doubleToString(p.x) << "in";
+- pDrawPathElement->addAttribute("svg:x", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(p.y) << "in";
+- pDrawPathElement->addAttribute("svg:y", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(vw) << "in";
+- pDrawPathElement->addAttribute("svg:width", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(vh) << "in";
+- pDrawPathElement->addAttribute("svg:height", m_value.str());
+- m_value.str("");
+- m_value << "0 0 " << (int)(vw*2540) << " " << (int)(vh*2540);
+- pDrawPathElement->addAttribute("svg:viewBox", m_value.str());
+- m_value.str("");
+-
+- for(unsigned i = 0; i < path.count(); i++)
+- {
+- libwpg::WPGPathElement element = path.element(i);
+- libwpg::WPGPoint point = element.point;
+- switch(element.type)
+- {
+- // 2540 is 2.54*1000, 2.54 in = 1 in
+- case libwpg::WPGPathElement::MoveToElement:
+- m_value << "M" << (int)((point.x-p.x)*2540) << " ";
+- m_value << (int)((point.y-p.y)*2540);
+- break;
+-
+- case libwpg::WPGPathElement::LineToElement:
+- m_value << "L" << (int)((point.x-p.x)*2540) << " ";
+- m_value << (int)((point.y-p.y)*2540);
+- break;
+-
+- case libwpg::WPGPathElement::CurveToElement:
+- m_value << "C" << (int)((element.extra1.x-p.x)*2540) << " ";
+- m_value << (int)((element.extra1.y-p.y)*2540) << " ";
+- m_value << (int)((element.extra2.x-p.x)*2540) << " ";
+- m_value << (int)((element.extra2.y-p.y)*2540) << " ";
+- m_value << (int)((point.x-p.x)*2540) << " ";
+- m_value << (int)((point.y-p.y)*2540);
+- break;
+-
+- default:
+- break;
+- }
+- }
+- if(path.closed)
+- m_value << " Z";
+- pDrawPathElement->addAttribute("svg:d", m_value.str());
+- m_value.str("");
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawPathElement));
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:path")));
+-}
+-
+-
+-void OdgExporter::drawBitmap(const libwpg::WPGBitmap& bitmap)
+-{
+- OpenTagGraphicsElement *pDrawFrameElement = new OpenTagGraphicsElement("draw:frame");
+- m_value.str("");
+- m_value << doubleToString(bitmap.rect.x1) << "in";
+- pDrawFrameElement->addAttribute("svg:x", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(bitmap.rect.y1) << "in";
+- pDrawFrameElement->addAttribute("svg:y", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(bitmap.rect.height()) << "in";
+- pDrawFrameElement->addAttribute("svg:height", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(bitmap.rect.width()) << "in";
+- pDrawFrameElement->addAttribute("svg:width", m_value.str());
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawFrameElement));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("draw:image")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("office:binary-data")));
+-
+- libwpg::WPGString base64Binary;
+- bitmap.generateBase64DIB(base64Binary);
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CharDataGraphicsElement(base64Binary.cstr())));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("office:binary-data")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:image")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:frame")));
+-}
+-
+-void OdgExporter::drawImageObject(const libwpg::WPGBinaryData& binaryData)
+-{
+- if (binaryData.mimeType.length() <= 0)
+- return;
+- OpenTagGraphicsElement *pDrawFrameElement = new OpenTagGraphicsElement("draw:frame");
+- m_value.str("");
+- m_value << doubleToString(binaryData.rect.x1) << "in";
+- pDrawFrameElement->addAttribute("svg:x", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(binaryData.rect.y1) << "in";
+- pDrawFrameElement->addAttribute("svg:y", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(binaryData.rect.height()) << "in";
+- pDrawFrameElement->addAttribute("svg:height", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(binaryData.rect.width()) << "in";
+- pDrawFrameElement->addAttribute("svg:width", m_value.str());
+- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawFrameElement));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("draw:image")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("office:binary-data")));
+-
+- libwpg::WPGString base64Binary = binaryData.getBase64Data();
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CharDataGraphicsElement(base64Binary.cstr())));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("office:binary-data")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:image")));
+-
+- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:frame")));
+-}
+-
+-
+-static std::string colorToHex(const libwpg::WPGColor& color)
+-{
+- char hexdigits[] = "0123456789abcdef";
+- char buffer[] = "123456";
+- buffer[0] = hexdigits[(color.red >> 4) & 15];
+- buffer[1] = hexdigits[color.red & 15];
+- buffer[2] = hexdigits[(color.green >> 4) & 15];
+- buffer[3] = hexdigits[color.green & 15];
+- buffer[4] = hexdigits[(color.blue >> 4) & 15];
+- buffer[5] = hexdigits[color.blue & 15];
+- return std::string(buffer);
+-}
+-
+-void OdgExporter::writeStyle()
+-{
+- m_value.str("");
+- m_name.str("");
+-
+- if(!m_pen.solid && (m_pen.dashArray.count() >=2 ) )
+- {
+- // ODG only supports dashes with the same length of spaces inbetween
+- // here we take the first space and assume everything else the same
+- // note that dash length is written in percentage
+- double distance = m_pen.dashArray.at(1);
+- OpenTagGraphicsElement *tmpDrawStrokeDashElement = new OpenTagGraphicsElement("draw:stroke-dash");
+- tmpDrawStrokeDashElement->addAttribute("draw:style", "rect");
+- m_value << "Dash_" << m_dashIndex++;
+- tmpDrawStrokeDashElement->addAttribute("draw:name", m_value.str());
+- m_value.str("");
+- m_value << doubleToString(distance*100) << "%";
+- tmpDrawStrokeDashElement->addAttribute("draw:distance", m_value.str());
+- m_value.str("");
+- for(unsigned i = 0; i < m_pen.dashArray.count()/2; i++)
+- {
+- m_name << "draw:dots" << i+1;
+- tmpDrawStrokeDashElement->addAttribute(m_name.str(), "1");
+- m_name.str("");
+- m_name << "draw:dots" << i+1 << "-length";
+- m_value << doubleToString(100*m_pen.dashArray.at(i*2)) << "%";
+- tmpDrawStrokeDashElement->addAttribute(m_name.str(), m_value.str());
+- m_name.str("");
+- m_value.str("");
+- }
+- mStrokeDashElements.push_back(static_cast<GraphicsElement *>(tmpDrawStrokeDashElement));
+- mStrokeDashElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:stroke-dash")));
+- }
+-
+- if(m_brush.style == libwpg::WPGBrush::Gradient)
+- {
+- OpenTagGraphicsElement *tmpDrawGradientElement = new OpenTagGraphicsElement("draw:gradient");
+- tmpDrawGradientElement->addAttribute("draw:style", "linear");
+- m_value << "Gradient_" << m_gradientIndex++;
+- tmpDrawGradientElement->addAttribute("draw:name", m_value.str());
+- m_value.str("");
+-
+- // ODG angle unit is 0.1 degree
+- double angle = -m_brush.gradient.angle();
+- while(angle < 0)
+- angle += 360;
+- while(angle > 360)
+- angle -= 360;
+-
+- m_value << (unsigned)(angle*10);
+- tmpDrawGradientElement->addAttribute("draw:angle", m_value.str());
+- m_value.str("");
+-
+- libwpg::WPGColor startColor = m_brush.gradient.stopColor(0);
+- libwpg::WPGColor stopColor = m_brush.gradient.stopColor(1);
+- m_value << "#" << colorToHex(startColor);
+- tmpDrawGradientElement->addAttribute("draw:start-color", m_value.str());
+- m_value.str("");
+- m_value << "#" << colorToHex(stopColor);
+- tmpDrawGradientElement->addAttribute("draw:end-color", m_value.str());
+- m_value.str("");
+- tmpDrawGradientElement->addAttribute("draw:start-intensity", "100%");
+- tmpDrawGradientElement->addAttribute("draw:end-intensity", "100%");
+- tmpDrawGradientElement->addAttribute("draw:border", "0%");
+- mGradientElements.push_back(static_cast<GraphicsElement *>(tmpDrawGradientElement));
+- mGradientElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:gradient")));
+- }
+-
+- OpenTagGraphicsElement *tmpStyleStyleElement = new OpenTagGraphicsElement("style:style");
+- m_value << "gr" << m_styleIndex;
+- tmpStyleStyleElement->addAttribute("style:name", m_value.str());
+- m_value.str("");
+- tmpStyleStyleElement->addAttribute("style:family", "graphic");
+- tmpStyleStyleElement->addAttribute("style:parent-style-name", "standard");
+- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(tmpStyleStyleElement));
+-
+- OpenTagGraphicsElement *tmpStyleGraphicPropertiesElement = new OpenTagGraphicsElement("style:graphic-properties");
+-
+- if(m_pen.width > 0.0)
+- {
+- m_value << doubleToString(m_pen.width) << "in";
+- tmpStyleGraphicPropertiesElement->addAttribute("svg:stroke-width", m_value.str());
+- m_value.str("");
+- m_value << "#" << colorToHex(m_pen.foreColor);
+- tmpStyleGraphicPropertiesElement->addAttribute("svg:stroke-color", m_value.str());
+- m_value.str("");
+-
+- if(!m_pen.solid)
+- {
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke", "dash");
+- m_value << "Dash_" << m_dashIndex-1;
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke-dash", m_value.str());
+- m_value.str("");
+- }
+- }
+- else
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke", "none");
+-
+- if(m_brush.style == libwpg::WPGBrush::NoBrush)
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "none");
+-
+- if(m_brush.style == libwpg::WPGBrush::Solid)
+- {
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "solid");
+- m_value << "#" << colorToHex(m_brush.foreColor);
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill-color", m_value.str());
+- m_value.str("");
+- }
+-
+- if(m_brush.style == libwpg::WPGBrush::Gradient)
+- {
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "gradient");
+- m_value << "Gradient_" << m_gradientIndex-1;
+- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill-gradient-name", m_value.str());
+- m_value.str("");
+- }
+-
+- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(tmpStyleGraphicPropertiesElement));
+- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("style:graphic-properties")));
+-
+- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("style:style")));
+- m_styleIndex++;
+-}
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/OdgExporter.hxx koffice-2.3.1-libwpg02/filters/karbon/wpg/import/OdgExporter.hxx
+--- koffice-2.3.1/filters/karbon/wpg/import/OdgExporter.hxx 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/OdgExporter.hxx 1970-01-01 01:00:00.000000000 +0100
+@@ -1,116 +0,0 @@
+-/* libwpg
+- * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Library General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library 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
+- * Library General Public License for more details.
+- *
+- * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+- * Boston, MA 02111-1301 USA
+- *
+- * For further information visit http://libwpg.sourceforge.net
+- */
+-
+-/* "This product is not manufactured, approved, or supported by
+- * Corel Corporation or Corel Corporation Limited."
+- */
+-
+-#ifndef __ODGEXPORTER_H__
+-#define __ODGEXPORTER_H__
+-
+-#include <iostream>
+-#include <sstream>
+-#include <string>
+-
+-#include <libwpg/libwpg.h>
+-#include "GraphicsElement.hxx"
+-
+-class OdgExporter : public libwpg::WPGPaintInterface {
+-public:
+- explicit OdgExporter(GraphicsHandler *pHandler,
+- const bool isFlatXML = false);
+- ~OdgExporter();
+-
+-#if LIBWPG_VERSION_MINOR<2
+- void startGraphics(double imageWidth, double imageHeight);
+- void endGraphics();
+- void startLayer(unsigned int id);
+- void endLayer(unsigned int id);
+-
+- void setPen(const libwpg::WPGPen& pen);
+- void setBrush(const libwpg::WPGBrush& brush);
+- void setFillRule(FillRule rule);
+-
+- void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry);
+- void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry);
+- void drawPolygon(const libwpg::WPGPointArray& vertices);
+- void drawPath(const libwpg::WPGPath& path);
+- void drawBitmap(const libwpg::WPGBitmap& bitmap);
+- void drawImageObject(const libwpg::WPGBinaryData& binaryData);
+-
+-private:
+- std::vector <GraphicsElement *> mBodyElements;
+- std::vector <GraphicsElement *> mAutomaticStylesElements;
+- std::vector <GraphicsElement *> mStrokeDashElements;
+- std::vector <GraphicsElement *> mGradientElements;
+- GraphicsHandler *mpHandler;
+-
+- libwpg::WPGPen m_pen;
+- libwpg::WPGBrush m_brush;
+- FillRule m_fillRule;
+- int m_gradientIndex;
+- int m_dashIndex;
+- int m_styleIndex;
+- void writeStyle();
+- std::ostringstream m_value, m_name;
+- double m_width, m_height;
+- const bool m_isFlatXML;
+-#else
+- virtual void startGraphics(const ::WPXPropertyList &propList);
+- virtual void endGraphics();
+- virtual void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
+- virtual void startLayer(const ::WPXPropertyList &propList);
+- virtual void endLayer();
+- virtual void drawRectangle(const ::WPXPropertyList& propList);
+- virtual void drawEllipse(const ::WPXPropertyList& propList);
+- virtual void drawPolygon(const ::WPXPropertyListVector &vertices);
+- virtual void drawPath(const ::WPXPropertyListVector &path);
+- virtual void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
+- virtual void startEmbeddedGraphics(const ::WPXPropertyList &propList);
+- virtual void endEmbeddedGraphics();
+- virtual void drawPolyline(const ::WPXPropertyListVector &vertices);
+- virtual void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
+- virtual void endTextObject();
+- virtual void startTextLine(const ::WPXPropertyList &propList);
+- virtual void endTextLine();
+- virtual void startTextSpan(const ::WPXPropertyList &propList);
+- virtual void endTextSpan();
+- virtual void insertText(const ::WPXString &str);
+-
+-
+-private:
+- std::vector <GraphicsElement *> mBodyElements;
+- std::vector <GraphicsElement *> mAutomaticStylesElements;
+- std::vector <GraphicsElement *> mStrokeDashElements;
+- std::vector <GraphicsElement *> mGradientElements;
+- GraphicsHandler *mpHandler;
+-
+- int m_gradientIndex;
+- int m_dashIndex;
+- int m_styleIndex;
+- void writeStyle();
+- std::ostringstream m_value, m_name;
+- double m_width, m_height;
+- const bool m_isFlatXML;
+-#endif
+-};
+-
+-#endif // __ODGEXPORTER_H__
+diff -Nur koffice-2.3.1/filters/karbon/wpg/import/WPGImport.cpp koffice-2.3.1-libwpg02/filters/karbon/wpg/import/WPGImport.cpp
+--- koffice-2.3.1/filters/karbon/wpg/import/WPGImport.cpp 2011-01-15 21:05:35.000000000 +0100
++++ koffice-2.3.1-libwpg02/filters/karbon/wpg/import/WPGImport.cpp 2011-01-02 17:46:15.000000000 +0100
+@@ -20,28 +20,26 @@
+ #include <WPGImport.h>
+ #include <WPGImport.moc>
+
+-#include <QBuffer>
+-#include <QByteArray>
+-#include <QString>
+-
+-#include <kdebug.h>
+ #include <KoFilterChain.h>
+ #include <KoGlobal.h>
+ #include <KoUnit.h>
++#include <KoXmlWriter.h>
++
+ #include <kpluginfactory.h>
++#include <KDebug>
+
+-#include <KoXmlWriter.h>
++
++#include <QtCore/QString>
++#include <QtCore/QFile>
+
+ #include <libwpg/libwpg.h>
+ #if LIBWPG_VERSION_MINOR<2
+ #include <libwpg/WPGStreamImplementation.h>
+ #else
+ #include <libwpd-stream/libwpd-stream.h>
++#include <libwpd/libwpd.h>
+ #endif
+
+-#include "FileOutputHandler.hxx"
+-#include "OdgExporter.hxx"
+-
+ #include <iostream>
+
+ K_PLUGIN_FACTORY(WPGImportFactory, registerPlugin<WPGImport>();)
+@@ -56,35 +54,13 @@
+ {
+ }
+
+-static QByteArray createManifest()
+-{
+- KoXmlWriter* manifestWriter;
+- QByteArray manifestData;
+- QBuffer manifestBuffer(&manifestData);
+-
+- manifestBuffer.open(QIODevice::WriteOnly);
+- manifestWriter = new KoXmlWriter(&manifestBuffer);
+-
+- manifestWriter->startDocument("manifest:manifest");
+- manifestWriter->startElement("manifest:manifest");
+- manifestWriter->addAttribute("xmlns:manifest", "urn:oasis:names:tc:openoffice:xmlns:manifest:1.0");
+- manifestWriter->addManifestEntry("/", "application/vnd.oasis.opendocument.graphics");
+- //manifestWriter->addManifestEntry( "styles.xml", "text/xml" );
+- manifestWriter->addManifestEntry("content.xml", "text/xml");
+- manifestWriter->endElement();
+- manifestWriter->endDocument();
+- delete manifestWriter;
+-
+- return manifestData;
+-}
+-
+
+ KoFilter::ConversionStatus WPGImport::convert(const QByteArray& from, const QByteArray& to)
+ {
+ if (from != "application/x-wpg")
+ return KoFilter::NotImplemented;
+
+- if (to != "application/vnd.oasis.opendocument.graphics")
++ if (to != "image/svg+xml")
+ return KoFilter::NotImplemented;
+
+ #if LIBWPG_VERSION_MINOR<2
+@@ -96,6 +72,7 @@
+ input = olestream;
+ }
+ }
++ libwpg::WPGString output;
+ #else
+ WPXInputStream* input = new WPXFileStream(m_chain->inputFile().toLocal8Bit());
+ if (input->isOLEStream()) {
+@@ -105,59 +82,31 @@
+ input = olestream;
+ }
+ }
++ ::WPXString output;
+ #endif
+
+ if (!libwpg::WPGraphics::isSupported(input)) {
+- std::cerr << "ERROR: Unsupported file format (unsupported version) or file is encrypted!" << std::endl;
++ kWarning() << "ERROR: Unsupported file format (unsupported version) or file is encrypted!";
+ delete input;
+ return KoFilter::NotImplemented;
+ }
+
+- // do the conversion
+- std::ostringstream tmpStringStream;
+- FileOutputHandler tmpHandler(tmpStringStream);
+- OdgExporter exporter(&tmpHandler);
+- libwpg::WPGraphics::parse(input, &exporter);
+- delete input;
+-
+-
+- // create output store
+- KoStore* storeout;
+- storeout = KoStore::createStore(m_chain->outputFile(), KoStore::Write,
+- "application/vnd.oasis.opendocument.graphics", KoStore::Zip);
+-
+- if (!storeout) {
+- kWarning() << "Couldn't open the requested file.";
+- return KoFilter::FileNotFound;
+- }
+-
+-#if 0
+- if (!storeout->open("styles.xml")) {
+- kWarning() << "Couldn't open the file 'styles.xml'.";
+- return KoFilter::CreationError;
++ if (!libwpg::WPGraphics::generateSVG(input, output)) {
++ kWarning() << "ERROR: SVG Generation failed!";
++ delete input;
++ return KoFilter::ParsingError;
+ }
+- //storeout->write( createStyles() );
+- storeout->close();
+-#endif
+
+- if (!storeout->open("content.xml")) {
+- kWarning() << "Couldn't open the file 'content.xml'.";
+- return KoFilter::CreationError;
+- }
+- storeout->write(tmpStringStream.str().c_str());
+- storeout->close();
++ delete input;
+
+- // store document manifest
+- storeout->enterDirectory("META-INF");
+- if (!storeout->open("manifest.xml")) {
+- kWarning() << "Couldn't open the file 'META-INF/manifest.xml'.";
+- return KoFilter::CreationError;
++ QFile outputFile(m_chain->outputFile());
++ if(!outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
++ kWarning() << "ERROR: Could not open output file" << m_chain->outputFile();
++ return KoFilter::InternalError;
+ }
+- storeout->write(createManifest());
+- storeout->close();
+
+- // we are done!
+- delete storeout;
++ outputFile.write(output.cstr());
++ outputFile.close();
+
+ return KoFilter::OK;
+ }
+
diff --git a/testing/koffice/koffice.install b/testing/koffice/koffice.install
new file mode 100644
index 000000000..e70c054ec
--- /dev/null
+++ b/testing/koffice/koffice.install
@@ -0,0 +1,11 @@
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/testing/koffice/krita.install b/testing/koffice/krita.install
new file mode 100644
index 000000000..ce5c32e1b
--- /dev/null
+++ b/testing/koffice/krita.install
@@ -0,0 +1,12 @@
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor &> /dev/null
+ update-mime-database usr/share/mime &> /dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+} \ No newline at end of file
diff --git a/testing/libreoffice/PKGBUILD b/testing/libreoffice/PKGBUILD
new file mode 100644
index 000000000..4c3853010
--- /dev/null
+++ b/testing/libreoffice/PKGBUILD
@@ -0,0 +1,701 @@
+# $Id: PKGBUILD 125824 2011-05-30 09:43:02Z andyrtr $
+# Maintainer: AndyRTR <andyrtr@archlinux.org>
+
+pkgbase="libreoffice"
+pkgname=('libreoffice' 'libreoffice-sdk'
+ #'libreoffice-extension-barcode' #
+ 'libreoffice-extension-diagram'
+ 'libreoffice-extension-google-docs'
+ 'libreoffice-extension-hunart'
+ #'libreoffice-extension-lightproof' # no source integration
+ #'libreoffice-extension-mysql-connector' # missing libmysqlcppconn-dev configure: error: mysql_driver.h not found. install MySQL C++ Connectivity
+ 'libreoffice-extension-nlpsolver'
+ 'libreoffice-extension-ct2n'
+ 'libreoffice-extension-numbertext'
+ 'libreoffice-extension-oooblogger'
+ 'libreoffice-extension-pdfimport'
+ 'libreoffice-extension-presenter-screen'
+ 'libreoffice-extension-presentation-minimizer'
+ 'libreoffice-extension-report-builder'
+ 'libreoffice-extension-scripting-beanshell'
+ 'libreoffice-extension-scripting-javascript'
+ 'libreoffice-extension-scripting-python'
+ 'libreoffice-extension-typo'
+ 'libreoffice-extension-validator'
+ 'libreoffice-extension-watch-window'
+ 'libreoffice-extension-wiki-publisher')
+_LOver=3.4.0.2
+pkgver=3.4.0
+pkgrel=1
+arch=('i686' 'x86_64')
+#_LO_tree="3.4"
+_OFFICEUPD="340"
+license=('LGPL3')
+url="http://www.libreoffice.org/"
+makedepends=( # makedepends
+ 'sane' 'perl-archive-zip' 'zip' 'unzip' 'xulrunner' 'unixodbc' 'hsqldb-java' #'boost' - we use internal one for now that has some gcc4.6 fixes.
+ 'apache-ant' 'gperf' 'poppler' 'kdelibs' 'gconf' 'cppunit' #'libmysqlclient'
+ 'beanshell' 'vigra' 'libldap' 'lucene' 'libmythes' 'junit' 'libwpg' 'imagemagick'
+ 'mesa' 'gstreamer0.10-base' 'java-runtime'
+ #'saxon' - currently broken
+ # the depends from libreoffice main pkg
+ "curl>=7.20.0" "hunspell>=1.2.8" "python2>=2.7" 'libwpd>=0.9.2' 'libwps' 'libxaw' "neon>=0.28.6"
+ 'pango' 'nspr' 'libjpeg' 'libxrandr' 'libgl' 'dbus-glib' "icu>=4.6" 'libxslt'
+ 'redland' 'libgraphite' 'hyphen' 'lpsolve' 'gcc-libs' 'sh' 'libtextcat'
+ 'hicolor-icon-theme' 'desktop-file-utils' 'shared-mime-info' 'gtk2' # keep gtk2 for install script
+ 'ttf-dejavu') # to satisfy regression tests
+ # translate-toolkit - todo move them to extra to allow --with-system-foo builds
+# http://download.documentfoundation.org/mirrors/all.html
+# http://wiki.documentfoundation.org/Mirrors
+#_mirror="http://download.documentfoundation.org/libreoffice/src"
+_mirror="http://dev-builds.libreoffice.org/pre-releases/src/"
+_additional_source_url="http://hg.services.openoffice.org/binaries"
+source=(${_mirror}/${pkgbase}-{artwork,base,bootstrap,calc,components,extensions,extras,filters,help,impress,libs-core,libs-extern,libs-extern-sys,libs-gui,postprocess,sdk,testing,ure,writer}-${_LOver}.tar.bz2 #,translations
+ ${_additional_source_url}/1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
+ ${_additional_source_url}/35c94d2df8893241173de1d16b6034c0-swingExSrc.zip
+ ${_additional_source_url}/798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
+ ${_additional_source_url}/fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz
+ ${_additional_source_url}/ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip
+ ${_additional_source_url}/2a177023f9ea8ec8bd00837605c5df1b-jakarta-tomcat-5.0.30-src.tar.gz
+ ${_additional_source_url}/a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
+ ${_additional_source_url}/3c219630e4302863a9a83d0efde889db-commons-logging-1.1.1-src.tar.gz
+ ${_additional_source_url}/2ae988b339daec234019a7066f96733e-commons-lang-2.3-src.tar.gz
+ ${_additional_source_url}/2c9b0f83ed5890af02c0df1c1776f39b-commons-httpclient-3.1-src.tar.gz
+ ${_additional_source_url}/af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz
+ ${_additional_source_url}/eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip
+ ${_additional_source_url}/39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
+ ${_additional_source_url}/3404ab6b1792ae5f16bbd603bd1e1d03-libformula-1.1.7.zip
+ ${_additional_source_url}/97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip
+ ${_additional_source_url}/f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip
+ ${_additional_source_url}/8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip
+ ${_additional_source_url}/d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip
+ ${_additional_source_url}/3bdf40c0d199af31923e900d082ca2dd-libfonts-1.1.6.zip
+ ${_additional_source_url}/ace6ab49184e329db254e454a010f56d-libxml-1.1.7.zip
+ ${_additional_source_url}/db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip
+ ${_additional_source_url}/ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip
+ ${_additional_source_url}/18f577b374d60b3c760a3a3350407632-STLport-4.5.tar.gz
+ http://download.go-oo.org/src/7a0dcb3fe1e8c7229ab4fb868b7325e6-mdds_0.5.2.tar.bz2
+ http://download.go-oo.org/extern/185d60944ea767075d27247c3162b3bc-unowinreg.dll
+ http://download.go-oo.org/extern/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2
+ http://download.go-oo.org/src/451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
+ http://download.go-oo.org/src/90401bca927835b6fbae4a707ed187c8-nlpsolver-0.9.tar.bz2
+ http://download.go-oo.org/src/f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/41c9b65ad60af4b3255bbecdfef11736-Diagram_1.1.0.0.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/dbaafd21de055e582d92d7d32fe9da13-gdocs_2.3.1.oxt
+ http://ooo.itc.hu/oxygenoffice/download/libreoffice/b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt
+ buildfix_i116795.diff
+ buildfix_boost.diff
+ buildfix_ct2n.diff
+ vbahelper.visibility.patch
+ buildfix_bison25.diff)
+noextract=(185d60944ea767075d27247c3162b3bc-unowinreg.dll
+ b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2
+ 7a0dcb3fe1e8c7229ab4fb868b7325e6-mdds_0.5.2.tar.bz2
+ ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip
+ 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
+ 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
+ fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz
+ 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip
+ 2a177023f9ea8ec8bd00837605c5df1b-jakarta-tomcat-5.0.30-src.tar.gz
+ a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip
+ 3c219630e4302863a9a83d0efde889db-commons-logging-1.1.1-src.tar.gz
+ 2ae988b339daec234019a7066f96733e-commons-lang-2.3-src.tar.gz
+ 2c9b0f83ed5890af02c0df1c1776f39b-commons-httpclient-3.1-src.tar.gz
+ af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz
+ eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip
+ 39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
+ 3404ab6b1792ae5f16bbd603bd1e1d03-libformula-1.1.7.zip
+ 97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip
+ f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip
+ 8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip
+ d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip
+ 3bdf40c0d199af31923e900d082ca2dd-libfonts-1.1.6.zip
+ ace6ab49184e329db254e454a010f56d-libxml-1.1.7.zip
+ db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip
+ ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip
+ 18f577b374d60b3c760a3a3350407632-STLport-4.5.tar.gz
+ 7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt
+ 41c9b65ad60af4b3255bbecdfef11736-Diagram_1.1.0.0.oxt
+ 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
+ bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt
+ 23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt
+ b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt
+ b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt
+ 9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt
+ dbaafd21de055e582d92d7d32fe9da13-gdocs_2.3.1.oxt
+ b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt
+ 90401bca927835b6fbae4a707ed187c8-nlpsolver-0.9.tar.bz2
+ f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2)
+md5sums=('7427ddd5ae63b6ee7aa868201dfbccaa'
+ 'a78a8e08731213da02c65060cedc5589'
+ '596da255e2728faccc8f2361171270ec'
+ '8ed9803a34d13da1764e7523d550d6b0'
+ '9be46d7c4bf3a60ee8dd0a5ef3638f82'
+ 'b60db802866ab71c485de42e6382d1bb'
+ '09e374cf3bd8f07a043883393012d69b'
+ 'af9f25aa04dc4ef7b797f7bcc743877c'
+ 'ad29de786d76d67759f9d2dd574b29be'
+ 'ff13a8ac0ea324122b75773fd80a9245'
+ '6eb8f53e01da7a945ee4cd42b7297732'
+ '90df27d4cbf490668ce4f03ff7dba521'
+ 'c0ea197183564c49306a1c79ca571e51'
+ '91e69ed3c0be542fa7f69ca3da2d7808'
+ 'a81c787b2e5469c2acc9f335b2c9e52f'
+ 'ee1c78af6553657614b1a43adf4750ac'
+ 'c970d6212618fc9b34526907eb030ce6'
+ '6d25488c81af09d87015bf487243042f'
+ '9a39234a49516b7035309e28dd4f0784'
+ '1f24ab1d39f4a51faf22244c94a6203f'
+ '35c94d2df8893241173de1d16b6034c0'
+ '798b2ffdc8bcfe7bca2cf92b62caf685'
+ 'fdb27bfe2dbe2e7b57ae194d9bf36bab'
+ 'ada24d37d8d638b3d8a9985e80bc2978'
+ '2a177023f9ea8ec8bd00837605c5df1b'
+ 'a7983f859eafb2677d7ff386a023bc40'
+ '3c219630e4302863a9a83d0efde889db'
+ '2ae988b339daec234019a7066f96733e'
+ '2c9b0f83ed5890af02c0df1c1776f39b'
+ 'af3c3acf618de6108d65fcdc92b492e1'
+ 'eeb2c7ddf0d302fba4bfc6e97eac9624'
+ '39bb3fcea1514f1369fcfc87542390fd'
+ '3404ab6b1792ae5f16bbd603bd1e1d03'
+ '97b2d4dba862397f446b217e2b623e71'
+ 'f94d9870737518e3b597f9265f4e9803'
+ '8ce2fcd72becf06c41f7201d15373ed9'
+ 'd8bd5eed178db6e2b18eeed243f85aa8'
+ '3bdf40c0d199af31923e900d082ca2dd'
+ 'ace6ab49184e329db254e454a010f56d'
+ 'db60e4fde8dd6d6807523deb71ee34dc'
+ 'ba2930200c9f019c2d93a8c88c651a0f'
+ '18f577b374d60b3c760a3a3350407632'
+ '7a0dcb3fe1e8c7229ab4fb868b7325e6'
+ '185d60944ea767075d27247c3162b3bc'
+ 'b4cae0700aa1c2aef7eb7f345365e6f1'
+ '451ccf439a36a568653b024534669971'
+ '90401bca927835b6fbae4a707ed187c8'
+ 'f02578f5218f217a9f20e9c30e119c6a'
+ '7e7efc5d4a03126bb9ae3ae9aa2c4e87'
+ '41c9b65ad60af4b3255bbecdfef11736'
+ '451ccf439a36a568653b024534669971'
+ 'bbdd5639ada63e3130761daaecae1a10'
+ '23bd75552206dfcd8fd4e29137dcac84'
+ 'b8cbca7b3363e6ca2d02bc0ba2b63904'
+ 'b632bdd25649cc4067bcb410bae23d2b'
+ '9d60b6cfa3ef1926848710bbcd11115b'
+ 'dbaafd21de055e582d92d7d32fe9da13'
+ 'b7b2d0e04e142f26dd96119c80757d1f'
+ '0520d63c946e272ed3bdfc863fbdc42e'
+ 'bc228237108cab7745897a9f466b6d39'
+ 'eee273f501ff45dc5f1365e78c6d57c0'
+ '43b145db28e6c0d73578ae6fd35e510d'
+ '4fa96e04b41a6e86774e74a972024b3e')
+
+build() {
+
+ unset J2REDIR; unset J2SDKDIR; unset JAVA_HOME; unset CLASSPATH; unset EXTRAOPTS
+ [ -z "${JAVA_HOME}" ] && . /etc/profile.d/openjdk6.sh
+ [ -z "${MOZ_PLUGIN_PATH}" ] && . /etc/profile.d/mozilla-common.sh
+ [ -z "${ANT_HOME}" ] && . /etc/profile.d/apache-ant.sh
+
+ # move all LibO sources into one build directory
+ mkdir ${srcdir}/build && cd ${srcdir}/build
+ for i in libreoffice-{artwork,base,bootstrap,calc,components,extensions,extras,filters,help,impress,libs-core,libs-extern,libs-extern-sys,libs-gui,postprocess,sdk,testing,ure,writer}-${_LOver}; do #,translations
+ mv ${srcdir}/$i/* .
+ done
+
+ # move external sources into place
+ mkdir ${srcdir}/ext_sources && cd ${srcdir}/ext_sources
+ for source in "${noextract[@]}"; do
+ ln -s ${srcdir}/$source .
+ done
+
+ cd ${srcdir}/build
+
+ # buildfixes & bugfixes
+ patch -Np1 -i ${srcdir}/buildfix_i116795.diff
+ patch -Np1 -i ${srcdir}/buildfix_boost.diff
+ patch -Np1 -i ${srcdir}/buildfix_ct2n.diff
+ patch -Np0 -i ${srcdir}/vbahelper.visibility.patch
+ patch -Np0 -i ${srcdir}/buildfix_bison25.diff
+
+ # unset C(XX)FLAGS
+ # http://www.openoffice.org/issues/show_bug.cgi?id=103205
+# unset CFLAGS
+# unset CXXFLAGS
+
+ #use the CFLAGS but remove the LibO overridden ones
+ for i in $CFLAGS; do
+ case "$i" in
+ -O?|-pipe|-Wall|-g|-fexceptions) continue;;
+ esac
+ ARCH_FLAGS="$ARCH_FLAGS $i"
+ done
+
+ # python2 fix
+ export PYTHON=python2
+
+ # http://wiki.documentfoundation.org/Development/How_to_build/Configure_options
+
+# if [ "$CARCH" = "x86_64" ]; then
+# EXTRAOPTS="--without-stlport"
+# else
+# EXTRAOPTS="--with-stlport" # --without-system-boost"
+# # # avoid problems with ixion for now
+# sed -i '/fields-table-formula.diff/d' patches/dev300/apply || return 1
+# fi
+
+# autoconf -v -f
+
+ # non-SMP test build
+# export MAKEFLAGS="-j1"
+ ./configure --with-build-version="${_LOver} ArchLinux build-${pkgrel}" --with-vendor="ArchLinux" \
+ --with-unix-wrapper="libreoffice" \
+ --with-max-jobs=${MAKEFLAGS/-j/} --with-num-cpus=${MAKEFLAGS/-j/} \
+ --with-external-tar="${srcdir}/ext_sources" \
+ --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc \
+ --with-install-dirname="${pkgbase}" --libdir=/usr/lib --mandir=/usr/share/man \
+ --with-lang="" \
+ --disable-verbose \
+ --enable-cairo\
+ --enable-crashdump \
+ --enable-dbus \
+ --enable-evolution2\
+ --disable-graphite\
+ --enable-gio\
+ --disable-gnome-vfs\
+ --disable-kde\
+ --enable-kde4\
+ --enable-ldap \
+ --enable-lockdown\
+ --enable-opengl \
+ --enable-odk\
+ --enable-opengl\
+ --enable-ext-barcode \
+ --enable-ext-diagram \
+ --enable-ext-google-docs \
+ --enable-ext-hunart \
+ --disable-ext-lightproof \
+ --disable-ext-mysql-connector \
+ --with-system-mysql \
+ --enable-ext-nlpsolver \
+ --enable-ext-ct2n \
+ --enable-ext-numbertext \
+ --enable-ext-oooblogger \
+ --enable-ext-pdfimport \
+ --enable-ext-presenter-console \
+ --enable-ext-presenter-minimizer \
+ --enable-ext-report-builder \
+ --enable-ext-scripting-beanshell \
+ --enable-ext-scripting-javascript \
+ --enable-ext-scripting-python \
+ --enable-ext-typo \
+ --enable-ext-validator \
+ --enable-ext-watch-window \
+ --enable-ext-wiki-publisher \
+ --without-fonts\
+ --without-afms\
+ --without-ppds\
+ --without-system-libwps\
+ --without-system-mdds\
+ --without-myspell-dicts \
+ --with-system-dicts \
+ --with-external-dict-dir=/usr/share/hunspell \
+ --with-external-hyph-dir=/usr/share/hyphen \
+ --with-external-thes-dir=/usr/share/mythes \
+ --with-system-cppunit\
+ --with-system-libwpg \
+ --with-system-libwps \
+ --with-system-redland\
+ --without-system-saxon\
+ --with-system-libtextcat \
+ --with-external-libtextcat-data \
+ --with-openldap\
+ --with-ant-home="/usr/share/java/apache-ant"\
+ --without-system-boost\
+ --with-system-cairo\
+ --with-system-libs\
+ --with-system-mozilla\
+ --with-system-mythes\
+ --with-system-xrender-headers\
+ --with-system-headers\
+ --with-alloc=system\
+ --with-system-lucene\
+ --with-lucene-core-jar=/usr/share/java/lucene-core.jar\
+ --with-lucene-analyzers-jar=/usr/share/java/lucene-analyzers.jar\
+ $EXTRAOPTS || return 1
+
+#--with-system-graphite --enable-graohite ?
+#--with-servlet-api-jar=JARFILE
+# see http://qa.openoffice.org/issues/show_bug.cgi?id=110136
+# --with-system-saxon\
+# --with-saxon-jar=/usr/share/java/saxon/saxon9he.jar\
+
+ touch src.downloaded
+ #./download
+ unset MAKEFLAGS
+ ./bootstrap
+ make
+}
+
+#check() {
+# cd ${srcdir}/build
+# make check
+#}
+
+package_libreoffice() {
+
+ pkgdesc="a productivity suite that is compatible with other major office suites"
+ install=${pkgbase}.install
+ depends=("curl>=7.20.0" "hunspell>=1.2.8" "python2>=2.7" 'libwpd>=0.9.2' 'libwps' 'libxaw' "neon>=0.28.6"
+ 'pango' 'nspr' 'libjpeg' 'libxrandr' 'libgl' 'dbus-glib' "icu>=4.6" 'libxslt'
+ 'redland' 'libgraphite' 'hyphen' 'lpsolve' 'gcc-libs' 'sh' 'libtextcat'
+ 'hicolor-icon-theme' 'desktop-file-utils' 'shared-mime-info' 'gtk2') # keep gtk2 for install script
+ #'java-runtime'
+ #'saxon'
+ optdepends=('java-runtime: adds java support'
+ 'libcups: adds printing support'
+ 'gconf: adds additional gnome support'
+ 'nss: adds support for signed files/macros'
+ 'pstoedit: translates PostScript and PDF graphics into other vector formats'
+ 'poppler: for shipped pdfimport extension'
+ 'kdelibs: for kde integration'
+ 'libmythes: for use in thesaurus'
+ 'hsqldb-java: default database format for OpenOffice.org'
+ 'beanshell: interactive java -- good for prototyping /macros'
+ 'vigra: C++ computer vision library, usable in Basebmp'
+ 'libmspack: library for Microsoft compression formats for use in FontOOo'
+ 'libwpg: library for importing and converting Corel WordPerfect(tm) Graphics images'
+ 'libldap: to get profiles via ldap'
+ 'lucene: full-text search engine library for Java needed in the help section'
+ 'sane: for scanner access'
+ 'unixodbc: adds ODBC database support'
+ 'mesa: for the OGLTrans extension'
+ 'gstreamer0.10-base: + some gstr-plugins to support multimedia content, e.g. in impress')
+ backup=(etc/libreoffice/sofficerc
+ etc/libreoffice/bootstraprc
+ etc/libreoffice/psprint.conf)
+ provides=('go-openoffice')
+ conflicts=('go-openoffice')
+ replaces=('go-openoffice' 'openoffice-base' )
+
+ cd ${srcdir}/build
+ make DESTDIR=${pkgdir} install
+
+ # fix missing desktop integration
+ install -dm755 ${pkgdir}/usr/bin
+ pushd ${pkgdir}/usr/bin
+ ln -vs /usr/lib/libreoffice/program/soffice ./libreoffice
+ ln -vs /usr/lib/libreoffice/program/soffice ./soffice
+ ln -vs /usr/lib/libreoffice/program/sbase ./lobase
+ ln -vs /usr/lib/libreoffice/program/scalc ./localc
+ ln -vs /usr/lib/libreoffice/program/sdraw ./lodraw
+ ln -vs /usr/lib/libreoffice/program/simpress ./loimpress
+ ln -vs /usr/lib/libreoffice/program/smath ./lomath
+ ln -vs /usr/lib/libreoffice/program/swriter ./lowriter
+ ln -vs /usr/lib/libreoffice/program/unopkg ./unopkg
+ popd
+
+ # move sysui desktop files into place we want to use - javafilter and qstarter, but not unneeded printeradmin
+ install -dm755 ${pkgdir}/usr/share/{applications,icons,mime/packages,pixmaps}
+ rm ${pkgdir}/usr/lib/libreoffice/share/xdg/printeradmin.desktop
+ for i in base calc draw impress javafilter math qstart startcenter writer; do
+ cp ${pkgdir}/usr/lib/libreoffice/share/xdg/$i.desktop ${pkgdir}/usr/share/applications/libreoffice-$i.desktop
+ done
+ # remove version in menu entry and make it visible
+ sed -i -e "s/3.4//g" ${pkgdir}/usr/share/applications/*.desktop
+ sed -i -e "s/Icon=libreoffice34-/Icon=/g" ${pkgdir}/usr/share/applications/*.desktop
+ sed -i -e "/NoDisplay=true/d" ${pkgdir}/usr/share/applications/libreoffice-qstart.desktop
+ echo "Icon=startcenter" >> ${pkgdir}/usr/share/applications/libreoffice-qstart.desktop
+ # remove unneeded .desktop files
+ rm -rf ${pkgdir}/usr/lib/libreoffice/share/xdg
+
+ # add missing icon files
+ cp -R ${srcdir}/build/sysui/desktop/icons/{hi,lo}color ${pkgdir}/usr/share/icons/
+ pushd ${pkgdir}/usr/share/pixmaps
+ for i in base calc draw impress main math printeradmin startcenter writer; do
+ ln -vs /usr/share/icons/hicolor/48x48/apps/$i.png .
+ done
+ popd
+ sed -i -e 's/Icon=libreoffice-/Icon=/' ${pkgdir}/usr/share/applications/*.desktop
+
+ # add missing mimetype file
+ install -m644 ${srcdir}/build/sysui/unxlng*/misc/libreoffice/openoffice.org.xml ${pkgdir}/usr/share/mime/packages/libreoffice.xml
+
+ # put configuration files into place
+ install -dm755 ${pkgdir}/etc/libreoffice
+ install -m644 ${pkgdir}/usr/lib/libreoffice/program/{bootstraprc,sofficerc} ${pkgdir}/etc/libreoffice/
+ install -m644 ${pkgdir}/usr/lib/libreoffice/basis3.4/share/psprint/psprint.conf ${pkgdir}/etc/libreoffice/
+ # install dummy links to make them found by LibO
+ cd ${pkgdir}/usr/lib/libreoffice/program/
+ ln -vsf /etc/libreoffice/{bootstraprc,sofficerc} .
+ cd ${pkgdir}/usr/lib/libreoffice/basis3.4/share/psprint/
+ ln -vsf /etc/libreoffice/psprint.conf .
+
+ #fix http://bugs.archlinux.org/task/17656
+ find ${pkgdir} -perm 444 -exec ls -lh {} \;
+ find ${pkgdir} -perm 444 -exec chmod 644 {} \;
+ find ${pkgdir} -perm 555 -exec ls -lh {} \;
+ find ${pkgdir} -perm 555 -exec chmod 755 {} \;
+
+ # split out extensions
+ mv ${pkgdir}/usr/lib/libreoffice/share/extensions ${srcdir}/extensions-install
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ install -m644 ${srcdir}/extensions-install/package.txt ${pkgdir}/usr/lib/libreoffice/share/extensions/
+
+ # move SDK to separated package
+ mkdir -p ${srcdir}/sdk-install/usr/lib/libreoffice/basis3.4/sdk
+ mv ${pkgdir}/usr/lib/libreoffice/basis3.4/sdk ${srcdir}/sdk-install/usr/lib/libreoffice/basis3.4/
+
+ # cleanup gid_Module files
+ mkdir ${srcdir}/splitlist
+ mv -f ${pkgdir}/gid_Module* ${srcdir}/splitlist/
+}
+
+package_libreoffice-sdk() {
+
+ pkgdesc="Software development kit for LibreOffice"
+ depends=('libreoffice' 'gcc-libs' 'sh')
+
+ cd ${srcdir}/sdk-install
+ cp -r * ${pkgdir}
+
+ cd ${pkgdir}/usr/lib/libreoffice/basis3.4/sdk
+ mv setsdkenv_unix setsdkenv_unix.sh && chmod 755 setsdkenv_unix.sh
+ rm -f ${pkgdir}/usr/lib/libreoffice/basis3.4/sdk/setsdkenv_unix.{csh,sh}.in
+ #fix permissions
+ find examples -type f -exec chmod -x {} \;
+}
+
+package_libreoffice-extension-barcode() {
+
+ pkgdesc="This extension generates UPC-A, EAN-13, ISBN and JAN barcodes in Draw "
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/7e7efc5d4a03126bb9ae3ae9aa2c4e87-Barcode_1.3.1.0.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/Barcode
+ chmod o-w -R ${pkgdir}/usr/lib/libreoffice/share/extensions/Barcode
+}
+
+package_libreoffice-extension-diagram() {
+
+ pkgdesc="An OOo Draw and Impress extension that creates your favorite diagrams with a few clicks"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/41c9b65ad60af4b3255bbecdfef11736-Diagram_1.1.0.0.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/diagram
+}
+
+package_libreoffice-extension-google-docs() {
+
+ pkgdesc="Google Documents extension for LibreOffice"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/dbaafd21de055e582d92d7d32fe9da13-gdocs_2.3.1.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/google-docs
+}
+
+package_libreoffice-extension-hunart() {
+
+ pkgdesc="Hungarian cross-reference toolbar extension"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/b632bdd25649cc4067bcb410bae23d2b-hunart_0.3.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/hunart
+}
+
+#package_libreoffice-extension-lightproof() {
+
+# pkgdesc="Lightproof extension for LibreOffice"
+ #arch=('any')
+# depends=('libreoffice')
+# groups=('libreoffice-extensions')
+
+# install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+# unzip -q ${srcdir}/${pkgbase}-build-${_LOver}/build/libreoffice-${_LOver}/solver/${_OFFICEUPD}/unxlng*/bin/Lightproof.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/lightproof
+#}
+
+#package_libreoffice-extension-mysql-connector() {
+
+# pkgdesc="MySQL Connector extension for LibreOffice"
+ #arch=('any')
+# depends=('libreoffice')
+# groups=('libreoffice-extensions')
+
+# install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+# unzip -q ${srcdir}/${pkgbase}-build-${_LOver}/build/libreoffice-${_LOver}/solver/${_OFFICEUPD}/unxlng*/bin/Mysql-connector.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/mysql-connector
+#}
+
+package_libreoffice-extension-nlpsolver() {
+
+ pkgdesc="This extension integrates into Calc and offers new Solver engines to use for optimizing nonlinear programming models"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/NLPSolver.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/nlpsolver
+}
+
+package_libreoffice-extension-ct2n() {
+
+ pkgdesc="This extension enables you to convert text-cells in Calc with numbers and dates, to real numbers and dates."
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/ConvertTextToNumber.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/ct2n
+}
+
+package_libreoffice-extension-numbertext() {
+
+ pkgdesc="NUMBERTEXT/MONEYTEXT extensions"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/numbertext
+}
+
+package_libreoffice-extension-oooblogger() {
+
+ pkgdesc="An extensions for blogging"
+ #arch=('any')
+ depends=('libreoffice' 'coreutils')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/b7b2d0e04e142f26dd96119c80757d1f-oooblogger_0.1.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/oooblogger
+}
+
+package_libreoffice-extension-pdfimport() {
+
+ pkgdesc="This extension allows you to import and modify PDF documents"
+ depends=('libreoffice' 'poppler')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/pdfimport/pdfimport.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/pdfimport
+}
+
+package_libreoffice-extension-presenter-screen() {
+
+ pkgdesc="This extension provides more control over your slide show presentation, such as the ability to see the upcoming slide, the slide notes, and a presentation timer whereas the audience see only the current slide"
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/presenter-screen.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/presenter-screen
+}
+
+package_libreoffice-extension-presentation-minimizer() {
+
+ pkgdesc="This extension reduce the file size of the current presentation"
+ depends=('libreoffice' 'gcc-libs')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/presentation-minimizer.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/presentation-minimizer
+}
+
+package_libreoffice-extension-report-builder() {
+
+ pkgdesc="This extension creates smart-looking database reports"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/report-builder.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/report-builder
+}
+
+package_libreoffice-extension-scripting-beanshell() {
+
+ pkgdesc="LibreOffice extension - Enables support for scripts in BeanShell"
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/script-provider-for-beanshell.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/script-provider-for-beanshell
+}
+
+package_libreoffice-extension-scripting-javascript() {
+
+ pkgdesc="LibreOffice extension - Enables support for scripts in JavaScript"
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/script-provider-for-javascript.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/script-provider-for-javascript
+}
+
+package_libreoffice-extension-scripting-python() {
+
+ pkgdesc="LibreOffice extension - Enables support for scripts in Python"
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/script-provider-for-python.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/script-provider-for-python
+}
+
+package_libreoffice-extension-typo() {
+
+ pkgdesc="Typography toolbar extension"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/9d60b6cfa3ef1926848710bbcd11115b-typo_0.4.2.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/typo
+ chmod o+r -R ${pkgdir}/usr/lib/libreoffice/share/extensions/typo
+}
+
+package_libreoffice-extension-validator() {
+
+ pkgdesc="Validator extension for LibreOffice"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/bbdd5639ada63e3130761daaecae1a10-Validator_1.1.0.0.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/validator
+}
+
+package_libreoffice-extension-wiki-publisher() {
+
+ pkgdesc="This extension enables you to create Wiki articles on MediaWiki servers without having to know the syntax of the MediaWiki markup language"
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/build/solver/${_OFFICEUPD}/unxlng*/bin/wiki-publisher.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/wiki-publisher
+}
+
+package_libreoffice-extension-watch-window() {
+
+ pkgdesc="A OOo Calc extension to add a Watch Window, which keeps the value of the monitored cell on the screen."
+ #arch=('any')
+ depends=('libreoffice')
+ groups=('libreoffice-extensions')
+
+ install -dm755 ${pkgdir}/usr/lib/libreoffice/share/extensions
+ unzip -q ${srcdir}/23bd75552206dfcd8fd4e29137dcac84-WatchWindow_1.2.0.0.oxt -d ${pkgdir}/usr/lib/libreoffice/share/extensions/watch-window
+}
diff --git a/testing/libreoffice/buildfix_64bit_system_libjpeg.diff b/testing/libreoffice/buildfix_64bit_system_libjpeg.diff
new file mode 100644
index 000000000..1f4eb110f
--- /dev/null
+++ b/testing/libreoffice/buildfix_64bit_system_libjpeg.diff
@@ -0,0 +1,11 @@
+--- solenv/inc/libs.mk 2009-07-02 09:44:33.084467312 +0000
++++ solenv/inc/libs.mk.new 2009-07-02 10:44:03.420819776 +0000
+@@ -211,7 +211,7 @@
+ .IF "$(OS)" == "FREEBSD"
+ JPEG3RDLIB=/usr/local/lib/libjpeg.so
+ .ELIF "$(CPUNAME)" == "X86_64" || "$(CPUNAME)" == "S390X" || "$(CPUNAME)" == "POWERPC64"
+-JPEG3RDLIB=/usr/lib64/libjpeg.so
++JPEG3RDLIB=/usr/lib/libjpeg.so
+ .ELSE
+ JPEG3RDLIB=/usr/lib/libjpeg.so
+ .ENDIF
diff --git a/testing/libreoffice/buildfix_bison25.diff b/testing/libreoffice/buildfix_bison25.diff
new file mode 100644
index 000000000..869b6c81e
--- /dev/null
+++ b/testing/libreoffice/buildfix_bison25.diff
@@ -0,0 +1,23 @@
+--- connectivity/source/parse/sqlbison.y 2011-05-20 13:21:02.000000000 -0600
++++ connectivity/source/parse/sqlbison.y 2011-05-20 13:22:11.000000000 -0600
+@@ -4338,7 +4338,7 @@
+ }
+
+ // -------------------------------------------------------------------------
+-void OSQLParser::error(sal_Char *fmt)
++void OSQLParser::error(const sal_Char *fmt)
+ {
+ if(!m_sErrorMessage.getLength())
+ {
+--- connectivity/inc/connectivity/sqlparse.hxx 2011-05-20 13:23:58.000000000 -0600
++++ connectivity/inc/connectivity/sqlparse.hxx 2011-05-20 13:23:46.000000000 -0600
+@@ -233,7 +233,7 @@
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
+
+- void error(sal_Char *fmt);
++ void error(const sal_Char *fmt);
+ int SQLlex();
+ #ifdef YYBISON
+ void setParseTree(OSQLParseNode * pNewParseTree);
+
diff --git a/testing/libreoffice/buildfix_boost.diff b/testing/libreoffice/buildfix_boost.diff
new file mode 100644
index 000000000..d8608d0d4
--- /dev/null
+++ b/testing/libreoffice/buildfix_boost.diff
@@ -0,0 +1,40 @@
+From bae4fdbd105142cd3f317445eddc826da529a732 Mon Sep 17 00:00:00 2001
+From: Caolán McNamara <caolanm@redhat.com>
+Date: Tue, 05 Apr 2011 14:07:02 +0000
+Subject: silence some more of that annoying gcc#47679
+
+---
+diff --git a/boost/boost.gcc47679.patch b/boost/boost.gcc47679.patch
+index 1c804aa..9b33a5f 100644
+--- a/boost/boost.gcc47679.patch
++++ b/boost/boost.gcc47679.patch
+@@ -36,3 +36,26 @@
+ template <int MaxDigits>
+ inline bool allow_more_digits(std::size_t i)
+ {
++--- misc/boost_1_44_0/boost/optional/optional.hpp 2011-04-05 13:19:01.223587256 +0100
+++++ misc/build/boost_1_44_0/boost/optional/optional.hpp 2011-04-05 13:19:01.223587256 +0100
++@@ -31,6 +31,8 @@
++
++ #include "boost/optional/optional_fwd.hpp"
++
+++#include <string.h>
+++
++ #if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
++ // VC6.0 has the following bug:
++ // When a templated assignment operator exist, an implicit conversion
++@@ -114,6 +116,11 @@
++
++ public:
++
+++ aligned_storage()
+++ {
+++ memset(&dummy_, 0, sizeof(dummy_));
+++ }
+++
++ void const* address() const { return &dummy_.data[0]; }
++ void * address() { return &dummy_.data[0]; }
++ } ;
+--
+cgit v0.8.3-6-g21f6
+
diff --git a/testing/libreoffice/buildfix_ct2n.diff b/testing/libreoffice/buildfix_ct2n.diff
new file mode 100644
index 000000000..979587f79
--- /dev/null
+++ b/testing/libreoffice/buildfix_ct2n.diff
@@ -0,0 +1,17 @@
+From 90de903b28cb1884042be0eae3f8a55458c5bc29 Mon Sep 17 00:00:00 2001
+From: Caolán McNamara <caolanm@redhat.com>
+Date: Tue, 12 Apr 2011 19:35:51 +0000
+Subject: duplicate NULLs
+
+---
+diff --git a/ct2n/prj/build.lst b/ct2n/prj/build.lst
+index 91f44b7..714d926 100644
+--- a/ct2n/prj/build.lst
++++ b/ct2n/prj/build.lst
+@@ -1,3 +1,3 @@
+-ct2n ct2n : solenv NULL NULL
++ct2n ct2n : solenv NULL
+ ct2n ct2n usr1 - all ct2n_mkout NULL
+ ct2n ct2n nmake - all ct2n_ct2n NULL
+--
+cgit v0.8.3-6-g21f6
diff --git a/testing/libreoffice/buildfix_i116795.diff b/testing/libreoffice/buildfix_i116795.diff
new file mode 100644
index 000000000..8601bc164
--- /dev/null
+++ b/testing/libreoffice/buildfix_i116795.diff
@@ -0,0 +1,22 @@
+diff -r 4ab9e11cb892 connectivity/qa/makefile.mk
+--- a/connectivity/qa/makefile.mk Thu Mar 03 15:22:23 2011 +0100
++++ b/connectivity/qa/makefile.mk Fri Mar 04 09:51:48 2011 +0100
+@@ -35,9 +35,16 @@
+
+ #----- compile .java files -----------------------------------------
+
+-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar hsqldb.jar
+ JAVAFILES := $(shell @$(FIND) complex -name "*.java")
+
++JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
++
++.IF "$(SYSTEM_HSQLDB)" == "YES"
++EXTRAJARFILES = $(HSQLDB_JAR)
++.ELSE
++JARFILES += hsqldb.jar
++.ENDIF
++
+ #----- make a jar from compiled files ------------------------------
+
+ JARCLASSDIRS = $(PACKAGE)
+
diff --git a/testing/libreoffice/libreoffice.install b/testing/libreoffice/libreoffice.install
new file mode 100644
index 000000000..27f3173ae
--- /dev/null
+++ b/testing/libreoffice/libreoffice.install
@@ -0,0 +1,25 @@
+post_install() {
+
+gtk-update-icon-cache -f -q /usr/share/icons/hicolor
+update-desktop-database -q
+update-mime-database usr/share/mime > /dev/null 2>&1
+
+echo " * see http://wiki.archlinux.org/index.php/Openoffice"
+echo " * you may want to pacman -Ss libreoffice-extensions"
+echo " to see what extensions are prepared to install"
+echo " * it's recommended to install {hunspell,mythes,hyphen}-xx pkg for spell checking"
+echo " * make sure you have installed some ttf font (ttf-dejavu recommended)"
+}
+
+post_upgrade() {
+# post_install $1
+gtk-update-icon-cache -f -q /usr/share/icons/hicolor
+update-desktop-database -q
+update-mime-database usr/share/mime > /dev/null 2>&1
+}
+
+post_remove() {
+update-desktop-database -q
+gtk-update-icon-cache -f -q /usr/share/icons/hicolor
+update-mime-database usr/share/mime > /dev/null 2>&1
+}
diff --git a/testing/libreoffice/vbahelper.visibility.patch b/testing/libreoffice/vbahelper.visibility.patch
new file mode 100644
index 000000000..5739100d0
--- /dev/null
+++ b/testing/libreoffice/vbahelper.visibility.patch
@@ -0,0 +1,33 @@
+--- vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2011-01-28 20:27:51.507604173 +0000
++++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2011-01-28 20:28:26.230045727 +0000
+@@ -238,7 +238,7 @@
+
+ // including a HelperInterface implementation
+ template< typename Ifc1 >
+-class ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
++class VBAHELPER_DLLPUBLIC ScVbaCollectionBase : public InheritedHelperInterfaceImpl< Ifc1 >
+ {
+ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
+ protected:
+--- sc/Library_vbaobj.mk
++++ sc/Library_vbaobj.mk
+@@ -118,7 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\
+ sc/source/ui/vba/vbaquerytable \
+ sc/source/ui/vba/vbarange \
+ sc/source/ui/vba/vbasheetobject \
+- sc/source/ui/vba/vbasheetobjects \
+ sc/source/ui/vba/vbastyle \
+ sc/source/ui/vba/vbastyles \
+ sc/source/ui/vba/vbatextboxshape \
+@@ -133,6 +132,11 @@ $(eval $(call gb_Library_add_exception_objects,vbaobj,\
+ sc/source/ui/vba/vbawsfunction \
+ ))
+
++$(eval $(call gb_Library_add_cxxobjects,vbaobj,\
++ sc/source/ui/vba/vbasheetobjects \
++ , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
++))
++
+ ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS)))
+ $(eval $(call gb_Library_set_ldflags,vbaobj,\
+ $$(LDFLAGS) \
diff --git a/testing/moc/PKGBUILD b/testing/moc/PKGBUILD
new file mode 100644
index 000000000..d94540c70
--- /dev/null
+++ b/testing/moc/PKGBUILD
@@ -0,0 +1,45 @@
+# $Id: PKGBUILD 125870 2011-05-30 20:58:06Z eric $
+# Maintainer: Eric Bélanger <eric@archlinux.org>
+
+pkgname=moc
+pkgver=20110528
+pkgrel=1
+pkgdesc="An ncurses console audio player with support for the mp3, ogg, and wave formats"
+arch=('i686' 'x86_64')
+url="http://moc.daper.net/"
+license=('GPL')
+depends=('libmad' 'libid3tag' 'jack' 'curl' 'libsamplerate' 'libtool')
+makedepends=('speex' 'ffmpeg' 'taglib' 'libmpcdec' 'wavpack' 'libmodplug')
+optdepends=('speex: for using the speex plugin'
+ 'ffmpeg: for using the ffmpeg plugin'
+ 'taglib: for using the musepack plugin'
+ 'libmpcdec: for using the musepack plugin'
+ 'wavpack: for using the wavpack plugin'
+ 'libmodplug: for using the modplug plugin')
+options=('!libtool')
+source=(ftp://ftp.archlinux.org/other/moc/${pkgname}-${pkgver}.tar.xz \
+ gcc-undefined-symbols.diff)
+md5sums=('e9394640fecb725ad8146575a3091134'
+ 'efacb8559e9145e15b0c25f8fa2a9d79')
+sha1sums=('d09c27602a60e3e9fde476e13d7c1a8b21489505'
+ 'a811a4ac7e049914aab528d3f06a6be6634c2720')
+
+build() {
+ cd "${srcdir}/${pkgname}"
+ patch -p0 -i ../gcc-undefined-symbols.diff
+ sed -i 's|ffmpeg/avformat.h|libavformat/avformat.h|' decoder_plugins/ffmpeg/ffmpeg.c
+ sed -i 's|avcodec_decode_audio|avcodec_decode_audio2|' decoder_plugins/ffmpeg/ffmpeg.c
+# Disabling aac to use the external ffmpeg to play them (FS#13164)
+ ./autogen.sh
+ ./configure --prefix=/usr --without-rcc --without-aac \
+ --with-oss --with-alsa --with-jack --with-mp3 \
+ --with-musepack --with-vorbis --with-flac --with-wavpack \
+ --with-sndfile --with-modplug --with-ffmpeg --with-speex \
+ --with-samplerate --with-curl
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/testing/moc/gcc-undefined-symbols.diff b/testing/moc/gcc-undefined-symbols.diff
new file mode 100644
index 000000000..09e9b8bda
--- /dev/null
+++ b/testing/moc/gcc-undefined-symbols.diff
@@ -0,0 +1,12 @@
+--- decoder.c~ 2011-05-08 09:28:28.077137883 +0200
++++ decoder.c 2011-05-10 21:40:48.887941968 +0200
+@@ -259,6 +259,9 @@
+ for (i = 0; i < plugins_num; i++)
+ if (plugins[i].decoder->destroy)
+ plugins[i].decoder->destroy ();
++ for (i = 0; i < plugins_num; i++)
++ if (plugins[i].handle)
++ lt_dlclose(plugins[i].handle);
+
+ if (lt_dlexit())
+ logit ("lt_exit() failed: %s", lt_dlerror());
diff --git a/testing/xorg-server/10-quirks.conf b/testing/xorg-server/10-quirks.conf
new file mode 100644
index 000000000..7afad22dc
--- /dev/null
+++ b/testing/xorg-server/10-quirks.conf
@@ -0,0 +1,10 @@
+# Collection of quirks and blacklist/whitelists for specific devices.
+
+
+# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
+# http://bugs.freedesktop.org/show_bug.cgi?id=22442
+Section "InputClass"
+ Identifier "ThinkPad HDAPS accelerometer blacklist"
+ MatchProduct "ThinkPad HDAPS accelerometer data"
+ Option "Ignore" "on"
+EndSection
diff --git a/testing/xorg-server/PKGBUILD b/testing/xorg-server/PKGBUILD
new file mode 100644
index 000000000..274da6f98
--- /dev/null
+++ b/testing/xorg-server/PKGBUILD
@@ -0,0 +1,196 @@
+# $Id: PKGBUILD 125811 2011-05-30 08:49:25Z jgc $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+
+pkgbase=xorg-server
+pkgname=('xorg-server' 'xorg-server-xephyr' 'xorg-server-xdmx' 'xorg-server-xvfb' 'xorg-server-xnest' 'xorg-server-common' 'xorg-server-devel')
+pkgver=1.10.2
+pkgrel=2
+arch=('i686' 'x86_64')
+license=('custom')
+url="http://xorg.freedesktop.org"
+makedepends=('pixman' 'libx11' 'mesa' 'libgl' 'xf86driproto' 'xcmiscproto' 'xtrans' 'bigreqsproto' 'randrproto' 'inputproto' 'fontsproto' 'videoproto' 'compositeproto' 'recordproto' 'scrnsaverproto' 'resourceproto' 'xineramaproto' 'libxkbfile' 'libxfont' 'renderproto' 'libpciaccess' 'libxv' 'xf86dgaproto' 'libxmu' 'libxrender' 'libxi' 'dmxproto' 'libxaw' 'libdmx' 'libxtst' 'libxres' 'xorg-xkbcomp' 'xorg-util-macros' 'xorg-font-util')
+options=('!libtool')
+source=(${url}/releases/individual/xserver/${pkgbase}-${pkgver}.tar.bz2
+ git-fixes.patch
+ bg-none-revert.patch
+ xserver-1.10-pointer-barriers.patch
+ xorg-redhat-die-ugly-pattern-die-die-die.patch
+ autoconfig-nvidia.patch
+ xvfb-run
+ xvfb-run.1
+ 10-quirks.conf)
+sha1sums=('fd831b3c6297d1a68830c602d767752d87b9ca54'
+ '6dd2bcd9d8b17d1a50ed8c15eb1cba480558e695'
+ '629c6d8d52126eab81ee1b72a9e4209535f8cb81'
+ '1b95e91384a57d966428c7db98ed06f4cc562f91'
+ '0efcdf61bde3c0cd813072b94e2b30ab922775b9'
+ 'f9328fd7bc931bb02c8909ecfcef35403de33782'
+ 'c94f742d3f9cabf958ae58e4015d9dd185aabedc'
+ '6838fc00ef4618c924a77e0fb03c05346080908a'
+ '993798f3d22ad672d769dae5f48d1fa068d5578f')
+
+build() {
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ # Get rid of the ugly pattern
+ patch -Np3 -i "${srcdir}/xorg-redhat-die-ugly-pattern-die-die-die.patch"
+
+ # Add pointer barrier support, patch from Fedora
+ patch -Np1 -i "${srcdir}/xserver-1.10-pointer-barriers.patch"
+
+ # Patches from ~ajax/xserver xserver-next branch
+ patch -Np1 -i "${srcdir}/bg-none-revert.patch"
+
+ # Upstream fixes from 1.10 branch
+ patch -Np1 -i "${srcdir}/git-fixes.patch"
+
+ # Use nouveau/nv/nvidia drivers for nvidia devices
+ patch -Np1 -i "${srcdir}/autoconfig-nvidia.patch"
+
+ autoreconf
+ ./configure --prefix=/usr \
+ --enable-ipv6 \
+ --enable-dri \
+ --enable-dmx \
+ --enable-xvfb \
+ --enable-xnest \
+ --enable-composite \
+ --enable-xcsecurity \
+ --enable-xorg \
+ --enable-xephyr \
+ --enable-glx-tls \
+ --enable-kdrive \
+ --enable-install-setuid \
+ --enable-config-udev \
+ --disable-config-dbus \
+ --enable-record \
+ --disable-xfbdev \
+ --disable-xfake \
+ --disable-static \
+ --sysconfdir=/etc/X11 \
+ --localstatedir=/var \
+ --with-xkb-path=/usr/share/X11/xkb \
+ --with-xkb-output=/var/lib/xkb \
+ --with-fontrootdir=/usr/share/fonts
+ make
+
+ sed -e 's/^DMX_SUBDIRS =.*/DMX_SUBDIRS =/' \
+ -e 's/^XVFB_SUBDIRS =.*/XVFB_SUBDIRS =/' \
+ -e 's/^XNEST_SUBDIRS =.*/XNEST_SUBDIRS = /' \
+ -e 's/^KDRIVE_SUBDIRS =.*/KDRIVE_SUBDIRS =/' \
+ -i hw/Makefile
+}
+
+package_xorg-server-common() {
+ pkgdesc="Xorg server common files"
+ depends=('xkeyboard-config' 'xorg-xkbcomp' 'xorg-setxkbmap' 'xorg-fonts-misc')
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-common"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/xorg-server-common"
+
+ make -C xkb DESTDIR="${pkgdir}" install-data
+
+ install -m755 -d "${pkgdir}/usr/share/man/man1"
+ install -m644 doc/man/Xserver.1 "${pkgdir}/usr/share/man/man1/"
+
+ install -m755 -d "${pkgdir}/usr/lib/xorg"
+ install -m644 dix/protocol.txt "${pkgdir}/usr/lib/xorg/"
+}
+
+package_xorg-server() {
+ pkgdesc="Xorg X server"
+ depends=(libxdmcp libxfont udev libpciaccess libdrm pixman libgcrypt libxau xorg-server-common xf86-input-evdev)
+ backup=('etc/X11/xorg.conf.d/10-evdev.conf' 'etc/X11/xorg.conf.d/10-quirks.conf')
+ provides=('x-server')
+ groups=('xorg')
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/etc/X11"
+ mv "${pkgdir}/usr/share/X11/xorg.conf.d" "${pkgdir}/etc/X11/"
+ install -m644 "${srcdir}/10-quirks.conf" "${pkgdir}/etc/X11/xorg.conf.d/"
+
+ rmdir "${pkgdir}/usr/share/X11"
+
+ # Needed for non-mesa drivers, libgl will restore it
+ mv "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" \
+ "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.xorg"
+
+ rm -rf "${pkgdir}/var"
+
+ rm -f "${pkgdir}/usr/share/man/man1/Xserver.1"
+ rm -f "${pkgdir}/usr/lib/xorg/protocol.txt"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server/COPYING"
+
+ rm -rf "${pkgdir}/usr/lib/pkgconfig"
+ rm -rf "${pkgdir}/usr/include"
+ rm -rf "${pkgdir}/usr/share/aclocal"
+}
+
+package_xorg-server-xephyr() {
+ pkgdesc="A nested X server that runs as an X application"
+ depends=(libxfont libgl libgcrypt libxv pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/kdrive"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xephyr"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xephyr/COPYING"
+}
+
+package_xorg-server-xvfb() {
+ pkgdesc="Virtual framebuffer X server"
+ depends=(libxfont libxdmcp libxau libgcrypt pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/vfb"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 "${srcdir}/xvfb-run" "${pkgdir}/usr/bin/"
+ install -m644 "${srcdir}/xvfb-run.1" "${pkgdir}/usr/share/man/man1/"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xvfb"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xvfb/COPYING"
+}
+
+package_xorg-server-xnest() {
+ pkgdesc="A nested X server that runs as an X application"
+ depends=(libxfont libxext libgcrypt pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/xnest"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xnest"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xnest/COPYING"
+}
+
+package_xorg-server-xdmx() {
+ pkgdesc="Distributed Multihead X Server and utilities"
+ depends=(libxfont libxi libgcrypt libxaw libxrender libdmx libxfixes pixman xorg-server-common)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}/hw/dmx"
+ make DESTDIR="${pkgdir}" install
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-xdmx"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-xdmx/COPYING"
+}
+
+package_xorg-server-devel() {
+ pkgdesc="Development files for the X.Org X server"
+ depends=(xproto randrproto renderproto xextproto inputproto kbproto fontsproto videoproto dri2proto xineramaproto xorg-util-macros pixman libpciaccess)
+
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+
+ rm -rf "${pkgdir}/usr/bin"
+ rm -rf "${pkgdir}/usr/share/man"
+ rm -rf "${pkgdir}/usr/share/doc"
+ rm -rf "${pkgdir}/usr/share/X11"
+ rm -rf "${pkgdir}/usr/lib/xorg"
+ rm -rf "${pkgdir}/var"
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/xorg-server-devel"
+ ln -sf ../xorg-server-common/COPYING "${pkgdir}/usr/share/licenses/xorg-server-devel/COPYING"
+}
diff --git a/testing/xorg-server/autoconfig-nvidia.patch b/testing/xorg-server/autoconfig-nvidia.patch
new file mode 100644
index 000000000..c56586d54
--- /dev/null
+++ b/testing/xorg-server/autoconfig-nvidia.patch
@@ -0,0 +1,104 @@
+From a685b5cf34532cef96fc9b05f735088ac0c0c7ad Mon Sep 17 00:00:00 2001
+From: Fedora X Ninjas <x@fedoraproject.org>
+Date: Tue, 16 Feb 2010 11:38:17 +1000
+Subject: [PATCH 08/17] autoconfig: select nouveau by default for NVIDIA GPUs
+
+Also, don't treat DRI setup failure as an error for nouveau.
+
+Modified by Archlinux:
+Append nvidia driver to the list of prefered drivers
+---
+ glx/glxdri.c | 7 +++++--
+ glx/glxdri2.c | 7 +++++--
+ hw/xfree86/common/xf86AutoConfig.c | 19 ++++++++++++++++++-
+ 3 files changed, 28 insertions(+), 5 deletions(-)
+
+--- a/glx/glxdri.c
++++ b/glx/glxdri.c
+@@ -978,6 +978,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+ const __DRIconfig **driConfigs;
+ const __DRIextension **extensions;
+ int i;
++ int from = X_ERROR;
+
+ if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
+ !DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
+@@ -1057,7 +1058,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+
+ screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+ if (screen->driver == NULL) {
+- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
++ if (!strcmp(driverName, "nouveau"))
++ from = X_INFO;
++ LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n",
+ filename, dlerror());
+ goto handle_error;
+ }
+@@ -1193,7 +1196,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+
+ free(screen);
+
+- LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
++ LogMessage(from, "AIGLX: reverting to software rendering\n");
+
+ return NULL;
+ }
+--- a/glx/glxdri2.c
++++ b/glx/glxdri2.c
+@@ -708,6 +708,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+ const __DRIextension **extensions;
+ const __DRIconfig **driConfigs;
+ int i;
++ int from = X_ERROR;
+
+ screen = calloc(1, sizeof *screen);
+ if (screen == NULL)
+@@ -734,7 +735,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+
+ screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+ if (screen->driver == NULL) {
+- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n",
++ if (!strcmp(driverName, "nouveau"))
++ from = X_INFO;
++ LogMessage(from, "AIGLX error: dlopen of %s failed (%s)\n",
+ filename, dlerror());
+ goto handle_error;
+ }
+@@ -826,7 +829,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
+
+ free(screen);
+
+- LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
++ LogMessage(from, "AIGLX: reverting to software rendering\n");
+
+ return NULL;
+ }
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -1123,7 +1123,25 @@ videoPtrToDriverList(struct pci_device *
+ break;
+ case 0x102b: driverList[0] = "mga"; break;
+ case 0x10c8: driverList[0] = "neomagic"; break;
+- case 0x10de: case 0x12d2: driverList[0] = "nv"; break;
++ case 0x10de: case 0x12d2:
++ switch (dev->device_id) {
++ /* NV1 */
++ case 0x0008:
++ case 0x0009:
++ driverList[0] = "vesa";
++ break;
++ /* NV3 */
++ case 0x0018:
++ case 0x0019:
++ driverList[0] = "nv";
++ break;
++ default:
++ driverList[0] = "nouveau";
++ driverList[1] = "nv";
++ driverList[2] = "nvidia";
++ break;
++ }
++ break;
+ case 0x1106: driverList[0] = "openchrome"; break;
+ case 0x1b36: driverList[0] = "qxl"; break;
+ case 0x1163: driverList[0] = "rendition"; break;
diff --git a/testing/xorg-server/bg-none-revert.patch b/testing/xorg-server/bg-none-revert.patch
new file mode 100644
index 000000000..1a38f1f41
--- /dev/null
+++ b/testing/xorg-server/bg-none-revert.patch
@@ -0,0 +1,58 @@
+From 3bc6ed2d8c9028ec28015d05b60af67a194f3694 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Tue, 29 Mar 2011 14:09:46 +0000
+Subject: Revert "composite: Don't backfill non-bg-None windows"
+
+This reverts commit 6dd775f57d2f94f0ddaee324aeec33b9b66ed5bc.
+
+Bugzilla: https://bugs.freedesktop.org/34427
+
+Acked-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/composite/compalloc.c b/composite/compalloc.c
+index e4064f6..7164c0d 100644
+--- a/composite/compalloc.c
++++ b/composite/compalloc.c
+@@ -508,17 +508,6 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
+ return Success;
+ }
+
+-static int
+-bgNoneVisitWindow(WindowPtr pWin, void *null)
+-{
+- if (pWin->backgroundState != BackgroundPixmap)
+- return WT_WALKCHILDREN;
+- if (pWin->background.pixmap != None)
+- return WT_WALKCHILDREN;
+-
+- return WT_STOPWALKING;
+-}
+-
+ static PixmapPtr
+ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map)
+ {
+@@ -539,21 +528,6 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map)
+ if (!map)
+ return pPixmap;
+
+- /*
+- * If there's no bg=None in the tree, we're done.
+- *
+- * We could optimize this more by collection the regions of all the
+- * bg=None subwindows and feeding that in as the clip for the
+- * CopyArea below, but since window trees are shallow these days it
+- * might not be worth the effort.
+- */
+- if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH)
+- return pPixmap;
+-
+- /*
+- * Copy bits from the parent into the new pixmap so that it will
+- * have "reasonable" contents in case for background None areas.
+- */
+ if (pParent->drawable.depth == pWin->drawable.depth)
+ {
+ GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen);
+--
+cgit v0.8.3-6-g21f6
diff --git a/testing/xorg-server/git-fixes.patch b/testing/xorg-server/git-fixes.patch
new file mode 100644
index 000000000..3eadd81ba
--- /dev/null
+++ b/testing/xorg-server/git-fixes.patch
@@ -0,0 +1,318 @@
+From 613e0e9ef74c4542ed458200165adbcdfdf3cd17 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Wed, 13 Apr 2011 18:51:30 +0000
+Subject: Send events that were missing from RRSelectInput
+
+The RANDR spec (randrproto.txt) specifies that RRSelectInput will send out
+events corresponding to the event mask, if there have been changes to
+CRTCs or outputs. Only screen events were being generated, however.
+
+Fixes http://bugs.freedesktop.org/21760
+
+Signed-off-by: Federico Mena Quintero <federico@novell.com>
+Reviewd-by: Keith Packard <keithp@keithp.com>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+(cherry picked from commit b2997431fd426ab318bc5dfd2cd43956d733ebec)
+---
+diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
+index ac4d2ac..2135504 100644
+--- a/randr/rrdispatch.c
++++ b/randr/rrdispatch.c
+@@ -146,7 +146,7 @@ ProcRRSelectInput (ClientPtr client)
+ /*
+ * Now see if the client needs an event
+ */
+- if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
++ if (pScrPriv)
+ {
+ pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
+ if (CompareTimeStamps (pTimes->setTime,
+@@ -154,7 +154,35 @@ ProcRRSelectInput (ClientPtr client)
+ CompareTimeStamps (pTimes->configTime,
+ pScrPriv->lastConfigTime) != 0)
+ {
+- RRDeliverScreenEvent (client, pWin, pScreen);
++ if (pRREvent->mask & RRScreenChangeNotifyMask)
++ {
++ RRDeliverScreenEvent (client, pWin, pScreen);
++ }
++
++ if (pRREvent->mask & RRCrtcChangeNotifyMask)
++ {
++ int i;
++
++ for (i = 0; i < pScrPriv->numCrtcs; i++)
++ {
++ RRDeliverCrtcEvent (client, pWin, pScrPriv->crtcs[i]);
++ }
++ }
++
++ if (pRREvent->mask & RROutputChangeNotifyMask)
++ {
++ int i;
++
++ for (i = 0; i < pScrPriv->numOutputs; i++)
++ {
++ RRDeliverOutputEvent (client, pWin, pScrPriv->outputs[i]);
++ }
++ }
++
++ /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't
++ * say if there ought to be notifications of changes to output properties
++ * if those changes occurred before the time RRSelectInput is called.
++ */
+ }
+ }
+ }
+--
+cgit v0.8.3-6-g21f6
+From 50b9d3142ff90af2f7fa35b7b1bf9e5a07723dbd Mon Sep 17 00:00:00 2001
+From: Aaron Plattner <aplattner@nvidia.com>
+Date: Tue, 24 May 2011 23:02:42 +0000
+Subject: randr: check rotated virtual size limits correctly
+
+Commit d1107918d4626268803b54033a07405122278e7f introduced checks to
+the RandR path that cause RRSetScreenConfig requests to fail if the
+size is too large. Unfortunately, when RandR 1.1 rotation is enabled
+it compares the rotated screen dimensions to the unrotated limits,
+which causes 90- and 270-degree rotation to fail unless your screen
+happens to be square:
+
+ X Error of failed request: BadValue (integer parameter out of range for operation)
+ Major opcode of failed request: 153 (RANDR)
+ Minor opcode of failed request: 2 (RRSetScreenConfig)
+ Value in failed request: 0x780
+ Serial number of failed request: 14
+ Current serial number in output stream: 14
+
+Fix this by moving the check above the code that swaps the dimensions
+based on the rotation.
+
+Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
+Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+Tested-by: Robert Hooker <robert.hooker@canonical.com>
+Tested-by: Kent Baxley <kent.baxley@canonical.com>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+(cherry picked from commit b6c7b9b2f39e970cedb6bc1e073f901e28cb0fa3)
+---
+diff --git a/randr/rrscreen.c b/randr/rrscreen.c
+index 1bc1a9e..da6d48d 100644
+--- a/randr/rrscreen.c
++++ b/randr/rrscreen.c
+@@ -910,12 +910,6 @@ ProcRRSetScreenConfig (ClientPtr client)
+ */
+ width = mode->mode.width;
+ height = mode->mode.height;
+- if (rotation & (RR_Rotate_90|RR_Rotate_270))
+- {
+- width = mode->mode.height;
+- height = mode->mode.width;
+- }
+-
+ if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) {
+ client->errorValue = width;
+ free(pData);
+@@ -927,6 +921,12 @@ ProcRRSetScreenConfig (ClientPtr client)
+ return BadValue;
+ }
+
++ if (rotation & (RR_Rotate_90|RR_Rotate_270))
++ {
++ width = mode->mode.height;
++ height = mode->mode.width;
++ }
++
+ if (width != pScreen->width || height != pScreen->height)
+ {
+ int c;
+--
+cgit v0.8.3-6-g21f6
+From 4bfb22e7667c4cd55da5e7a31af29ce5769ecc65 Mon Sep 17 00:00:00 2001
+From: Aaron Plattner <aplattner@nvidia.com>
+Date: Mon, 18 Apr 2011 15:23:48 +0000
+Subject: linux: Retry VT ioctls while errno == EINTR
+
+When the smart scheduler is enabled, the VT ioctls (particularly
+VT_WAITACTIVE) can be interrupted by the smart scheduler's SIGALRMs.
+Previously, this caused the server to immediately continue on to
+ScreenInit, almost certainly causing a crash or failure because the X
+server that owned the VT hadn't finished cleaning up. As of commit
+7ee965a300c9eddcc1acacf9414cfe3e589222a8, it causes a FatalError
+instead.
+
+Retrying the ioctl as long as it fails with errno == EINTR fixes the
+problem and allows server regenerations to trigger VT switches that
+actually succeed.
+
+Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
+Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Cyril Brulebois <kibi@debian.org>
+Signed-off-by: Keith Packard <keithp@keithp.com>
+(cherry picked from commit 88c4622b594a1725d0cee86bc82ad640d241c520)
+---
+diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
+index 9c71a42..77dfb2f 100644
+--- a/hw/xfree86/os-support/linux/lnx_init.c
++++ b/hw/xfree86/os-support/linux/lnx_init.c
+@@ -62,17 +62,21 @@ drain_console(int fd, void *closure)
+ static void
+ switch_to(int vt, const char *from)
+ {
+- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt) < 0)
+- FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
++ int ret;
+
+- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt) < 0)
+- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
++ if (ret < 0)
++ FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
++
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
++ if (ret < 0)
++ FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+ }
+
+ void
+ xf86OpenConsole(void)
+ {
+- int i, fd = -1;
++ int i, fd = -1, ret;
+ struct vt_mode VT;
+ struct vt_stat vts;
+ MessageType from = X_PROBED;
+@@ -107,17 +111,19 @@ xf86OpenConsole(void)
+
+ if (ShareVTs)
+ {
+- if (ioctl(fd, VT_GETSTATE, &vts) == 0)
+- xf86Info.vtno = vts.v_active;
+- else
+- FatalError("xf86OpenConsole: Cannot find the current"
+- " VT (%s)\n", strerror(errno));
++ SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: Cannot find the current"
++ " VT (%s)\n", strerror(errno));
++ xf86Info.vtno = vts.v_active;
+ } else {
+- if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+- (xf86Info.vtno == -1))
+- FatalError("xf86OpenConsole: Cannot find a free VT: %s\n",
+- strerror(errno));
+- }
++ SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: Cannot find a free VT: "
++ "%s\n", strerror(errno));
++ if (xf86Info.vtno == -1)
++ FatalError("xf86OpenConsole: Cannot find a free VT\n");
++ }
+ close(fd);
+ }
+
+@@ -159,7 +165,8 @@ xf86OpenConsole(void)
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+ */
+- if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
++ if (ret < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
+ strerror(errno));
+ else
+@@ -171,7 +178,7 @@ xf86OpenConsole(void)
+ * Detach from the controlling tty to avoid char loss
+ */
+ if ((i = open("/dev/tty",O_RDWR)) >= 0) {
+- ioctl(i, TIOCNOTTY, 0);
++ SYSCALL(ioctl(i, TIOCNOTTY, 0));
+ close(i);
+ }
+ }
+@@ -186,9 +193,10 @@ xf86OpenConsole(void)
+ */
+ switch_to(xf86Info.vtno, "xf86OpenConsole");
+
+- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+- FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
+- strerror(errno));
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
++ strerror(errno));
+
+ signal(SIGUSR1, xf86VTRequest);
+
+@@ -196,20 +204,23 @@ xf86OpenConsole(void)
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+
+- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
+ strerror(errno));
+-
+- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
+- strerror(errno));
++
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
++ strerror(errno));
+
+ tcgetattr(xf86Info.consoleFd, &tty_attr);
+- ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
++ SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
+
+- if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
+- FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+- strerror(errno));
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
++ if (ret < 0)
++ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
++ strerror(errno));
+
+ nTty = tty_attr;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+@@ -241,6 +252,7 @@ void
+ xf86CloseConsole(void)
+ {
+ struct vt_mode VT;
++ int ret;
+
+ if (ShareVTs) {
+ close(xf86Info.consoleFd);
+@@ -253,20 +265,23 @@ xf86CloseConsole(void)
+ };
+
+ /* Back to text mode ... */
+- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
++ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+ strerror(errno));
+
+- ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
++ SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+
+- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
++ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
+ strerror(errno));
+ else {
+ /* set dflt vt handling */
+ VT.mode = VT_AUTO;
+- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
++ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
++ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
+ strerror(errno));
+ }
+--
+cgit v0.8.3-6-g21f6
diff --git a/testing/xorg-server/xorg-redhat-die-ugly-pattern-die-die-die.patch b/testing/xorg-server/xorg-redhat-die-ugly-pattern-die-die-die.patch
new file mode 100644
index 000000000..4e782f1c6
--- /dev/null
+++ b/testing/xorg-server/xorg-redhat-die-ugly-pattern-die-die-die.patch
@@ -0,0 +1,16 @@
+Remove the default root window grey stipple pattern, replacing it with
+blackness.
+
+--- xc/programs/Xserver/dix/window.c.die-ugly-pattern-die-die-die Tue Feb 12 16:33:04 2002
++++ xc/programs/Xserver/dix/window.c Tue Feb 12 16:45:32 2002
+@@ -119,8 +119,8 @@
+ *
+ ******/
+
+-static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
+-static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
++static unsigned char _back_lsb[4] = {0x00, 0x00, 0x00, 0x00};
++static unsigned char _back_msb[4] = {0x00, 0x00, 0x00, 0x00};
+
+ int screenIsSaved = SCREEN_SAVER_OFF;
+
diff --git a/testing/xorg-server/xserver-1.10-pointer-barriers.patch b/testing/xorg-server/xserver-1.10-pointer-barriers.patch
new file mode 100644
index 000000000..099565436
--- /dev/null
+++ b/testing/xorg-server/xserver-1.10-pointer-barriers.patch
@@ -0,0 +1,1054 @@
+From 14f1112bec18ccece8e732fe6c200a56546230c7 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Thu, 17 Mar 2011 13:56:17 -0400
+Subject: [PATCH] CRTC confine and pointer barriers
+
+---
+ dix/events.c | 7 +
+ dix/getevents.c | 12 +-
+ include/dix.h | 1 +
+ include/protocol-versions.h | 2 +-
+ mi/mipointer.c | 16 ++-
+ mi/mipointer.h | 6 +
+ randr/randr.c | 2 +
+ randr/randrstr.h | 4 +
+ randr/rrcrtc.c | 155 ++++++++++++++++
+ test/Makefile.am | 4 +-
+ xfixes/cursor.c | 408 ++++++++++++++++++++++++++++++++++++++++++-
+ xfixes/xfixes.c | 24 ++-
+ xfixes/xfixes.h | 17 ++
+ xfixes/xfixesint.h | 16 ++
+ 14 files changed, 658 insertions(+), 16 deletions(-)
+
+diff --git a/dix/events.c b/dix/events.c
+index 07f8b05..d2be84f 100644
+--- a/dix/events.c
++++ b/dix/events.c
+@@ -328,6 +328,13 @@ IsMaster(DeviceIntPtr dev)
+ return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
+ }
+
++Bool
++IsFloating(DeviceIntPtr dev)
++{
++ return GetMaster(dev, MASTER_KEYBOARD) == NULL;
++}
++
++
+ /**
+ * Max event opcode.
+ */
+diff --git a/dix/getevents.c b/dix/getevents.c
+index 794df42..c66e516 100644
+--- a/dix/getevents.c
++++ b/dix/getevents.c
+@@ -812,7 +812,11 @@ accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms)
+ * miPointerSetPosition() and then scale back into device coordinates (if
+ * needed). miPSP will change x/y if the screen was crossed.
+ *
++ * The coordinates provided are always absolute. The parameter mode whether
++ * it was relative or absolute movement that landed us at those coordinates.
++ *
+ * @param dev The device to be moved.
++ * @param mode Movement mode (Absolute or Relative)
+ * @param x Pointer to current x-axis value, may be modified.
+ * @param y Pointer to current y-axis value, may be modified.
+ * @param x_frac Fractional part of current x-axis value, may be modified.
+@@ -824,7 +828,8 @@ accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms)
+ * @param screeny_frac Fractional part of screen y coordinate, as above.
+ */
+ static void
+-positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
++positionSprite(DeviceIntPtr dev, int mode,
++ int *x, int *y, float x_frac, float y_frac,
+ ScreenPtr scr, int *screenx, int *screeny, float *screenx_frac, float *screeny_frac)
+ {
+ int old_screenx, old_screeny;
+@@ -863,7 +868,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
+ old_screeny = *screeny;
+ /* This takes care of crossing screens for us, as well as clipping
+ * to the current screen. */
+- miPointerSetPosition(dev, screenx, screeny);
++ _miPointerSetPosition(dev, mode, screenx, screeny);
+
+ if (dev->u.master) {
+ dev->u.master->last.valuators[0] = *screenx;
+@@ -1193,7 +1198,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
+
+ set_raw_valuators(raw, &mask, raw->valuators.data);
+
+- positionSprite(pDev, &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac);
++ positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
++ &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac);
+ updateHistory(pDev, &mask, ms);
+
+ /* Update the valuators with the true value sent to the client*/
+diff --git a/include/dix.h b/include/dix.h
+index 12e4b59..3f99098 100644
+--- a/include/dix.h
++++ b/include/dix.h
+@@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
+ extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
+ extern Bool IsPointerEvent(InternalEvent *event);
+ extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
++extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
+
+ extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
+ extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
+diff --git a/include/protocol-versions.h b/include/protocol-versions.h
+index 1d33bdd..1dc66ad 100644
+--- a/include/protocol-versions.h
++++ b/include/protocol-versions.h
+@@ -126,7 +126,7 @@
+ #define SERVER_XF86VIDMODE_MINOR_VERSION 2
+
+ /* Fixes */
+-#define SERVER_XFIXES_MAJOR_VERSION 4
++#define SERVER_XFIXES_MAJOR_VERSION 5
+ #define SERVER_XFIXES_MINOR_VERSION 0
+
+ /* X Input */
+diff --git a/mi/mipointer.c b/mi/mipointer.c
+index 554397a..85f1949 100644
+--- a/mi/mipointer.c
++++ b/mi/mipointer.c
+@@ -229,6 +229,10 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
+ SetupScreen (pScreen);
+
+ GenerateEvent = generateEvent;
++
++ if (pScreen->ConstrainCursorHarder)
++ pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y);
++
+ /* device dependent - must pend signal and call miPointerWarpCursor */
+ (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
+ if (!generateEvent)
+@@ -484,7 +488,7 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
+ }
+
+ void
+-miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
++_miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
+ {
+ miPointerScreenPtr pScreenPriv;
+ ScreenPtr pScreen;
+@@ -529,6 +533,9 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
+ if (*y >= pPointer->limits.y2)
+ *y = pPointer->limits.y2 - 1;
+
++ if (pScreen->ConstrainCursorHarder)
++ pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
++
+ if (pPointer->x == *x && pPointer->y == *y &&
+ pPointer->pScreen == pScreen)
+ return;
+@@ -536,6 +543,13 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
+ miPointerMoveNoEvent(pDev, pScreen, *x, *y);
+ }
+
++/* ABI hack */
++void
++miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
++{
++ _miPointerSetPosition(pDev, Absolute, x, y);
++}
++
+ void
+ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
+ {
+diff --git a/mi/mipointer.h b/mi/mipointer.h
+index 3c86110..6b6010c 100644
+--- a/mi/mipointer.h
++++ b/mi/mipointer.h
+@@ -131,6 +131,12 @@ extern _X_EXPORT void miPointerGetPosition(
+
+ /* Moves the cursor to the specified position. May clip the co-ordinates:
+ * x and y are modified in-place. */
++extern _X_EXPORT void _miPointerSetPosition(
++ DeviceIntPtr pDev,
++ int mode,
++ int *x,
++ int *y);
++
+ extern _X_EXPORT void miPointerSetPosition(
+ DeviceIntPtr pDev,
+ int *x,
+diff --git a/randr/randr.c b/randr/randr.c
+index 6077705..d337129 100644
+--- a/randr/randr.c
++++ b/randr/randr.c
+@@ -270,6 +270,8 @@ Bool RRScreenInit(ScreenPtr pScreen)
+
+ wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen);
+
++ pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
++
+ pScrPriv->numOutputs = 0;
+ pScrPriv->outputs = NULL;
+ pScrPriv->numCrtcs = 0;
+diff --git a/randr/randrstr.h b/randr/randrstr.h
+index 7ea6080..d8dd37d 100644
+--- a/randr/randrstr.h
++++ b/randr/randrstr.h
+@@ -297,6 +297,7 @@ typedef struct _rrScrPriv {
+ int rate;
+ int size;
+ #endif
++ Bool discontiguous;
+ } rrScrPrivRec, *rrScrPrivPtr;
+
+ extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
+@@ -700,6 +701,9 @@ ProcRRGetPanning (ClientPtr client);
+ int
+ ProcRRSetPanning (ClientPtr client);
+
++void
++RRConstrainCursorHarder (DeviceIntPtr, ScreenPtr, int, int *, int *);
++
+ /* rrdispatch.c */
+ extern _X_EXPORT Bool
+ RRClientKnowsRates (ClientPtr pClient);
+diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
+index 98206a2..d4d8f2a 100644
+--- a/randr/rrcrtc.c
++++ b/randr/rrcrtc.c
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright © 2006 Keith Packard
++ * Copyright 2010 Red Hat, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+@@ -22,6 +23,7 @@
+
+ #include "randrstr.h"
+ #include "swaprep.h"
++#include "mipointer.h"
+
+ RESTYPE RRCrtcType;
+
+@@ -292,6 +294,92 @@ RRCrtcPendingProperties (RRCrtcPtr crtc)
+ return FALSE;
+ }
+
++static void
++crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom)
++{
++ *left = crtc->x;
++ *top = crtc->y;
++
++ switch (crtc->rotation) {
++ case RR_Rotate_0:
++ case RR_Rotate_180:
++ default:
++ *right = crtc->x + crtc->mode->mode.width;
++ *bottom = crtc->y + crtc->mode->mode.height;
++ return;
++ case RR_Rotate_90:
++ case RR_Rotate_270:
++ *right = crtc->x + crtc->mode->mode.height;
++ *bottom = crtc->y + crtc->mode->mode.width;
++ return;
++ }
++}
++
++/* overlapping counts as adjacent */
++static Bool
++crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b)
++{
++ /* left, right, top, bottom... */
++ int al, ar, at, ab;
++ int bl, br, bt, bb;
++ int cl, cr, ct, cb; /* the overlap, if any */
++
++ crtc_bounds(a, &al, &ar, &at, &ab);
++ crtc_bounds(b, &bl, &br, &bt, &bb);
++
++ cl = max(al, bl);
++ cr = min(ar, br);
++ ct = max(at, bt);
++ cb = min(ab, bb);
++
++ return (cl <= cr) && (ct <= cb);
++}
++
++/* Depth-first search and mark all CRTCs reachable from cur */
++static void
++mark_crtcs (rrScrPrivPtr pScrPriv, int *reachable, int cur)
++{
++ int i;
++ reachable[cur] = TRUE;
++ for (i = 0; i < pScrPriv->numCrtcs; ++i) {
++ if (reachable[i] || !pScrPriv->crtcs[i]->mode)
++ continue;
++ if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i]))
++ mark_crtcs(pScrPriv, reachable, i);
++ }
++}
++
++static void
++RRComputeContiguity (ScreenPtr pScreen)
++{
++ rrScrPriv(pScreen);
++ Bool discontiguous = TRUE;
++ int i, n = pScrPriv->numCrtcs;
++
++ int *reachable = calloc(n, sizeof(int));
++ if (!reachable)
++ goto out;
++
++ /* Find first enabled CRTC and start search for reachable CRTCs from it */
++ for (i = 0; i < n; ++i) {
++ if (pScrPriv->crtcs[i]->mode) {
++ mark_crtcs(pScrPriv, reachable, i);
++ break;
++ }
++ }
++
++ /* Check that all enabled CRTCs were marked as reachable */
++ for (i = 0; i < n; ++i)
++ if (pScrPriv->crtcs[i]->mode && !reachable[i])
++ goto out;
++
++ discontiguous = FALSE;
++
++out:
++ free(reachable);
++ pScrPriv->discontiguous = discontiguous;
++}
++
+ /*
+ * Request that the Crtc be reconfigured
+ */
+@@ -306,6 +394,7 @@ RRCrtcSet (RRCrtcPtr crtc,
+ {
+ ScreenPtr pScreen = crtc->pScreen;
+ Bool ret = FALSE;
++ Bool recompute = TRUE;
+ rrScrPriv(pScreen);
+
+ /* See if nothing changed */
+@@ -318,6 +407,7 @@ RRCrtcSet (RRCrtcPtr crtc,
+ !RRCrtcPendingProperties (crtc) &&
+ !RRCrtcPendingTransform (crtc))
+ {
++ recompute = FALSE;
+ ret = TRUE;
+ }
+ else
+@@ -381,6 +471,10 @@ RRCrtcSet (RRCrtcPtr crtc,
+ RRPostPendingProperties (outputs[o]);
+ }
+ }
++
++ if (recompute)
++ RRComputeContiguity(pScreen);
++
+ return ret;
+ }
+
+@@ -1349,3 +1443,64 @@ ProcRRGetCrtcTransform (ClientPtr client)
+ free(reply);
+ return Success;
+ }
++
++void
++RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x, int *y)
++{
++ rrScrPriv (pScreen);
++ int i;
++
++ /* intentional dead space -> let it float */
++ if (pScrPriv->discontiguous)
++ return;
++
++ /* if we're moving inside a crtc, we're fine */
++ for (i = 0; i < pScrPriv->numCrtcs; i++) {
++ RRCrtcPtr crtc = pScrPriv->crtcs[i];
++
++ int left, right, top, bottom;
++
++ if (!crtc->mode)
++ continue;
++
++ crtc_bounds(crtc, &left, &right, &top, &bottom);
++
++ if ((*x >= left) && (*x <= right) && (*y >= top) && (*y <= bottom))
++ return;
++ }
++
++ /* if we're trying to escape, clamp to the CRTC we're coming from */
++ for (i = 0; i < pScrPriv->numCrtcs; i++) {
++ RRCrtcPtr crtc = pScrPriv->crtcs[i];
++ int nx, ny;
++ int left, right, top, bottom;
++
++ if (!crtc->mode)
++ continue;
++
++ crtc_bounds(crtc, &left, &right, &top, &bottom);
++ miPointerGetPosition(pDev, &nx, &ny);
++
++ if ((nx >= left) && (nx <= right) && (ny >= top) && (ny <= bottom)) {
++ if ((*x <= left) || (*x >= right)) {
++ int dx = *x - nx;
++
++ if (dx > 0)
++ *x = right;
++ else if (dx < 0)
++ *x = left;
++ }
++
++ if ((*y <= top) || (*y >= bottom)) {
++ int dy = *y - ny;
++
++ if (dy > 0)
++ *y = bottom;
++ else if (dy < 0)
++ *y = top;
++ }
++
++ return;
++ }
++ }
++}
+diff --git a/test/Makefile.am b/test/Makefile.am
+index 456221e..ccdb859 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -1,6 +1,6 @@
+ if UNITTESTS
+ SUBDIRS= . xi2
+-check_PROGRAMS = xkb input xtest
++check_PROGRAMS = xkb input xtest list fixes
+ check_LTLIBRARIES = libxservertest.la
+
+ TESTS=$(check_PROGRAMS)
+@@ -16,6 +16,8 @@ endif
+ xkb_LDADD=$(TEST_LDADD)
+ input_LDADD=$(TEST_LDADD)
+ xtest_LDADD=$(TEST_LDADD)
++list_LDADD=$(TEST_LDADD)
++fixes_LDADD=$(TEST_LDADD)
+
+ libxservertest_la_LIBADD = \
+ $(XSERVER_LIBS) \
+diff --git a/xfixes/cursor.c b/xfixes/cursor.c
+index fb608f6..5c55c95 100644
+--- a/xfixes/cursor.c
++++ b/xfixes/cursor.c
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -50,13 +51,16 @@
+ #include "cursorstr.h"
+ #include "dixevents.h"
+ #include "servermd.h"
++#include "mipointer.h"
+ #include "inputstr.h"
+ #include "windowstr.h"
+ #include "xace.h"
++#include "list.h"
+
+ static RESTYPE CursorClientType;
+ static RESTYPE CursorHideCountType;
+ static RESTYPE CursorWindowType;
++RESTYPE PointerBarrierType;
+ static CursorPtr CursorCurrent[MAXDEVICES];
+
+ static DevPrivateKeyRec CursorScreenPrivateKeyRec;
+@@ -107,6 +111,14 @@ typedef struct _CursorHideCountRec {
+ XID resource;
+ } CursorHideCountRec;
+
++typedef struct PointerBarrierClient *PointerBarrierClientPtr;
++
++struct PointerBarrierClient {
++ ScreenPtr screen;
++ struct PointerBarrier barrier;
++ struct list entry;
++};
++
+ /*
+ * Wrap DisplayCursor to catch cursor change events
+ */
+@@ -114,7 +126,9 @@ typedef struct _CursorHideCountRec {
+ typedef struct _CursorScreen {
+ DisplayCursorProcPtr DisplayCursor;
+ CloseScreenProcPtr CloseScreen;
++ ConstrainCursorHarderProcPtr ConstrainCursorHarder;
+ CursorHideCountPtr pCursorHideCounts;
++ struct list barriers;
+ } CursorScreenRec, *CursorScreenPtr;
+
+ #define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
+@@ -184,9 +198,11 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
+ Bool ret;
+ CloseScreenProcPtr close_proc;
+ DisplayCursorProcPtr display_proc;
++ ConstrainCursorHarderProcPtr constrain_proc;
+
+ Unwrap (cs, pScreen, CloseScreen, close_proc);
+ Unwrap (cs, pScreen, DisplayCursor, display_proc);
++ Unwrap (cs, pScreen, ConstrainCursorHarder, constrain_proc);
+ deleteCursorHideCountsForScreen(pScreen);
+ ret = (*pScreen->CloseScreen) (index, pScreen);
+ free(cs);
+@@ -1029,6 +1045,391 @@ CursorFreeWindow (pointer data, XID id)
+ return 1;
+ }
+
++static BOOL
++barrier_is_horizontal(const struct PointerBarrier *barrier)
++{
++ return barrier->y1 == barrier->y2;
++}
++
++static BOOL
++barrier_is_vertical(const struct PointerBarrier *barrier)
++{
++ return barrier->x1 == barrier->x2;
++}
++
++/**
++ * @return The set of barrier movement directions the movement vector
++ * x1/y1 → x2/y2 represents.
++ */
++int
++barrier_get_direction(int x1, int y1, int x2, int y2)
++{
++ int direction = 0;
++
++ /* which way are we trying to go */
++ if (x2 > x1)
++ direction |= BarrierPositiveX;
++ if (x2 < x1)
++ direction |= BarrierNegativeX;
++ if (y2 > y1)
++ direction |= BarrierPositiveY;
++ if (y2 < y1)
++ direction |= BarrierNegativeY;
++
++ return direction;
++}
++
++/**
++ * Test if the barrier may block movement in the direction defined by
++ * x1/y1 → x2/y2. This function only tests whether the directions could be
++ * blocked, it does not test if the barrier actually blocks the movement.
++ *
++ * @return TRUE if the barrier blocks the direction of movement or FALSE
++ * otherwise.
++ */
++BOOL
++barrier_is_blocking_direction(const struct PointerBarrier *barrier, int direction)
++{
++ /* Barriers define which way is ok, not which way is blocking */
++ return (barrier->directions & direction) != direction;
++}
++
++/**
++ * Test if the movement vector x1/y1 → x2/y2 is intersecting with the
++ * barrier. A movement vector with the startpoint or endpoint on the barrier
++ * itself counts as intersecting.
++ *
++ * @param x1 X start coordinate of movement vector
++ * @param y1 Y start coordinate of movement vector
++ * @param x2 X end coordinate of movement vector
++ * @param y2 Y end coordinate of movement vector
++ * @param[out] distance The distance between the start point and the
++ * intersection with the barrier (if applicable).
++ * @return TRUE if the barrier intersects with the given vector
++ */
++BOOL
++barrier_is_blocking(const struct PointerBarrier *barrier,
++ int x1, int y1, int x2, int y2,
++ double *distance)
++{
++ BOOL rc = FALSE;
++ float ua, ub, ud;
++ int dir = barrier_get_direction(x1, y1, x2, y2);
++
++ /* Algorithm below doesn't handle edge cases well, hence the extra
++ * checks. */
++ if (barrier_is_vertical(barrier)) {
++ /* handle immediate barrier adjacency, moving away */
++ if (dir & BarrierPositiveX && x1 == barrier->x1)
++ return FALSE;
++ if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1))
++ return FALSE;
++ /* startpoint on barrier */
++ if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) {
++ *distance = 0;
++ return TRUE;
++ }
++ /* endpoint on barrier */
++ if (x2 == barrier->x1 && y2 >= barrier->y1 && y2 <= barrier->y2) {
++ *distance = abs(x2 - x1);
++ return TRUE;
++ }
++ } else {
++ /* handle immediate barrier adjacency, moving away */
++ if (dir & BarrierPositiveY && y1 == barrier->y1)
++ return FALSE;
++ if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1))
++ return FALSE;
++ /* startpoint on barrier */
++ if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) {
++ *distance = 0;
++ return TRUE;
++ }
++ /* endpoint on barrier */
++ if (y2 == barrier->y1 && x2 >= barrier->x1 && x2 <= barrier->x2) {
++ *distance = abs(y2 - y1);
++ return TRUE;
++ }
++ }
++
++ /* not an edge case, compute distance */
++ ua = 0;
++ ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 - barrier->x1) * (y2 - y1);
++ if (ud != 0) {
++ ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) -
++ (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud;
++ ub = ((x2 - x1) * (y1 - barrier->y1) -
++ (y2 - y1) * (x1 - barrier->x1)) / ud;
++ if (ua < 0 || ua > 1 || ub < 0 || ub > 1)
++ ua = 0;
++ }
++
++ if (ua > 0 && ua <= 1)
++ {
++ double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1);
++ double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1);
++
++ *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2));
++ rc = TRUE;
++ }
++
++ return rc;
++}
++
++/**
++ * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
++ *
++ * @param dir Only barriers blocking movement in direction dir are checked
++ * @param x1 X start coordinate of movement vector
++ * @param y1 Y start coordinate of movement vector
++ * @param x2 X end coordinate of movement vector
++ * @param y2 Y end coordinate of movement vector
++ * @return The barrier nearest to the movement origin that blocks this movement.
++ */
++static struct PointerBarrier*
++barrier_find_nearest(CursorScreenPtr cs, int dir,
++ int x1, int y1, int x2, int y2)
++{
++ struct PointerBarrierClient *c;
++ struct PointerBarrier *nearest = NULL;
++ double min_distance = INT_MAX; /* can't get higher than that in X anyway */
++
++ list_for_each_entry(c, &cs->barriers, entry) {
++ struct PointerBarrier *b = &c->barrier;
++ double distance;
++
++ if (!barrier_is_blocking_direction(b, dir))
++ continue;
++
++ if (barrier_is_blocking(b, x1, y1, x2, y2, &distance))
++ {
++ if (min_distance > distance)
++ {
++ min_distance = distance;
++ nearest = b;
++ }
++ }
++ }
++
++ return nearest;
++}
++
++/**
++ * Clamp to the given barrier given the movement direction specified in dir.
++ *
++ * @param barrier The barrier to clamp to
++ * @param dir The movement direction
++ * @param[out] x The clamped x coordinate.
++ * @param[out] y The clamped x coordinate.
++ */
++void
++barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y)
++{
++ if (barrier_is_vertical(barrier)) {
++ if ((dir & BarrierNegativeX) & ~barrier->directions)
++ *x = barrier->x1;
++ if ((dir & BarrierPositiveX) & ~barrier->directions)
++ *x = barrier->x1 - 1;
++ }
++ if (barrier_is_horizontal(barrier))
++ {
++ if ((dir & BarrierNegativeY) & ~barrier->directions)
++ *y = barrier->y1;
++ if ((dir & BarrierPositiveY) & ~barrier->directions)
++ *y = barrier->y1 - 1;
++ }
++}
++
++static void
++CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y)
++{
++ CursorScreenPtr cs = GetCursorScreen(screen);
++
++ if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
++ int ox, oy;
++ int dir;
++ struct PointerBarrier *nearest = NULL;
++
++ /* where are we coming from */
++ miPointerGetPosition(dev, &ox, &oy);
++
++ /* How this works:
++ * Given the origin and the movement vector, get the nearest barrier
++ * to the origin that is blocking the movement.
++ * Clamp to that barrier.
++ * Then, check from the clamped position to the original
++ * destination, again finding the nearest barrier and clamping.
++ */
++ dir = barrier_get_direction(ox, oy, *x, *y);
++
++ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
++ if (nearest) {
++ barrier_clamp_to_barrier(nearest, dir, x, y);
++
++ if (barrier_is_vertical(nearest)) {
++ dir &= ~(BarrierNegativeX | BarrierPositiveX);
++ ox = *x;
++ } else if (barrier_is_horizontal(nearest)) {
++ dir &= ~(BarrierNegativeY | BarrierPositiveY);
++ oy = *y;
++ }
++
++ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
++ if (nearest) {
++ barrier_clamp_to_barrier(nearest, dir, x, y);
++ }
++ }
++ }
++
++ if (cs->ConstrainCursorHarder) {
++ screen->ConstrainCursorHarder = cs->ConstrainCursorHarder;
++ screen->ConstrainCursorHarder(dev, screen, mode, x, y);
++ screen->ConstrainCursorHarder = CursorConstrainCursorHarder;
++ }
++}
++
++static struct PointerBarrierClient *
++CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
++ xXFixesCreatePointerBarrierReq *stuff)
++{
++ CursorScreenPtr cs = GetCursorScreen(screen);
++ struct PointerBarrierClient *ret = malloc(sizeof(*ret));
++
++ if (ret) {
++ ret->screen = screen;
++ ret->barrier.x1 = min(stuff->x1, stuff->x2);
++ ret->barrier.x2 = max(stuff->x1, stuff->x2);
++ ret->barrier.y1 = min(stuff->y1, stuff->y2);
++ ret->barrier.y2 = max(stuff->y1, stuff->y2);
++ ret->barrier.directions = stuff->directions & 0x0f;
++ if (barrier_is_horizontal(&ret->barrier))
++ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
++ if (barrier_is_vertical(&ret->barrier))
++ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
++ list_add(&ret->entry, &cs->barriers);
++ }
++
++ return ret;
++}
++
++int
++ProcXFixesCreatePointerBarrier (ClientPtr client)
++{
++ int err;
++ WindowPtr pWin;
++ struct PointerBarrierClient *barrier;
++ struct PointerBarrier b;
++ REQUEST (xXFixesCreatePointerBarrierReq);
++
++ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
++ LEGAL_NEW_RESOURCE(stuff->barrier, client);
++
++ err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
++ if (err != Success) {
++ client->errorValue = stuff->window;
++ return err;
++ }
++
++ /* This sure does need fixing. */
++ if (stuff->num_devices)
++ return BadImplementation;
++
++ b.x1 = stuff->x1;
++ b.x2 = stuff->x2;
++ b.y1 = stuff->y1;
++ b.y2 = stuff->y2;
++
++ if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b))
++ return BadValue;
++
++ /* no 0-sized barriers */
++ if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
++ return BadValue;
++
++ if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
++ client, stuff)))
++ return BadAlloc;
++
++ if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
++ return BadAlloc;
++
++ return Success;
++}
++
++int
++SProcXFixesCreatePointerBarrier (ClientPtr client)
++{
++ int n;
++ REQUEST(xXFixesCreatePointerBarrierReq);
++
++ swaps(&stuff->length, n);
++ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
++ swapl(&stuff->barrier, n);
++ swapl(&stuff->window, n);
++ swaps(&stuff->x1, n);
++ swaps(&stuff->y1, n);
++ swaps(&stuff->x2, n);
++ swaps(&stuff->y2, n);
++ swapl(&stuff->directions, n);
++ return ProcXFixesVector[stuff->xfixesReqType](client);
++}
++
++static int
++CursorFreeBarrier(void *data, XID id)
++{
++ struct PointerBarrierClient *b = NULL, *barrier;
++ ScreenPtr screen;
++ CursorScreenPtr cs;
++
++ barrier = container_of(data, struct PointerBarrierClient, barrier);
++ screen = barrier->screen;
++ cs = GetCursorScreen(screen);
++
++ /* find and unlink from the screen private */
++ list_for_each_entry(b, &cs->barriers, entry) {
++ if (b == barrier) {
++ list_del(&b->entry);
++ break;
++ }
++ }
++
++ free(barrier);
++ return Success;
++}
++
++int
++ProcXFixesDestroyPointerBarrier (ClientPtr client)
++{
++ int err;
++ void *barrier;
++ REQUEST (xXFixesDestroyPointerBarrierReq);
++
++ REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
++
++ err = dixLookupResourceByType((void **)&barrier, stuff->barrier,
++ PointerBarrierType, client,
++ DixDestroyAccess);
++ if (err != Success) {
++ client->errorValue = stuff->barrier;
++ return err;
++ }
++
++ FreeResource(stuff->barrier, RT_NONE);
++ return Success;
++}
++
++int
++SProcXFixesDestroyPointerBarrier (ClientPtr client)
++{
++ int n;
++ REQUEST(xXFixesDestroyPointerBarrierReq);
++
++ swaps(&stuff->length, n);
++ REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
++ swapl(&stuff->barrier, n);
++ return ProcXFixesVector[stuff->xfixesReqType](client);
++}
++
+ Bool
+ XFixesCursorInit (void)
+ {
+@@ -1048,8 +1449,10 @@ XFixesCursorInit (void)
+ cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
+ if (!cs)
+ return FALSE;
++ list_init(&cs->barriers);
+ Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
+ Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
++ Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);
+ cs->pCursorHideCounts = NULL;
+ SetCursorScreen (pScreen, cs);
+ }
+@@ -1059,7 +1462,10 @@ XFixesCursorInit (void)
+ "XFixesCursorHideCount");
+ CursorWindowType = CreateNewResourceType(CursorFreeWindow,
+ "XFixesCursorWindow");
++ PointerBarrierType = CreateNewResourceType(CursorFreeBarrier,
++ "XFixesPointerBarrier");
+
+- return CursorClientType && CursorHideCountType && CursorWindowType;
++ return CursorClientType && CursorHideCountType && CursorWindowType &&
++ PointerBarrierType;
+ }
+
+diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
+index e8c7bf1..a57884b 100644
+--- a/xfixes/xfixes.c
++++ b/xfixes/xfixes.c
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -47,10 +48,6 @@
+
+ #include "xfixesint.h"
+ #include "protocol-versions.h"
+-/*
+- * Must use these instead of the constants from xfixeswire.h. They advertise
+- * what we implement, not what the protocol headers define.
+- */
+
+ static unsigned char XFixesReqCode;
+ int XFixesEventBase;
+@@ -97,11 +94,12 @@ ProcXFixesQueryVersion(ClientPtr client)
+
+ /* Major version controls available requests */
+ static const int version_requests[] = {
+- X_XFixesQueryVersion, /* before client sends QueryVersion */
+- X_XFixesGetCursorImage, /* Version 1 */
+- X_XFixesChangeCursorByName, /* Version 2 */
+- X_XFixesExpandRegion, /* Version 3 */
+- X_XFixesShowCursor, /* Version 4 */
++ X_XFixesQueryVersion, /* before client sends QueryVersion */
++ X_XFixesGetCursorImage, /* Version 1 */
++ X_XFixesChangeCursorByName, /* Version 2 */
++ X_XFixesExpandRegion, /* Version 3 */
++ X_XFixesShowCursor, /* Version 4 */
++ X_XFixesDestroyPointerBarrier, /* Version 5 */
+ };
+
+ #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
+@@ -142,6 +140,9 @@ int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+ /*************** Version 4 ****************/
+ ProcXFixesHideCursor,
+ ProcXFixesShowCursor,
++/*************** Version 5 ****************/
++ ProcXFixesCreatePointerBarrier,
++ ProcXFixesDestroyPointerBarrier,
+ };
+
+ static int
+@@ -205,6 +206,9 @@ static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+ /*************** Version 4 ****************/
+ SProcXFixesHideCursor,
+ SProcXFixesShowCursor,
++/*************** Version 5 ****************/
++ SProcXFixesCreatePointerBarrier,
++ SProcXFixesDestroyPointerBarrier,
+ };
+
+ static int
+@@ -260,6 +264,8 @@ XFixesExtensionInit(void)
+ EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
+ (EventSwapPtr) SXFixesCursorNotifyEvent;
+ SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
++ SetResourceTypeErrorValue(PointerBarrierType,
++ XFixesErrorBase + BadBarrier);
+ }
+ }
+
+diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h
+index 1638350..5765e64 100644
+--- a/xfixes/xfixes.h
++++ b/xfixes/xfixes.h
+@@ -30,6 +30,7 @@
+ #include "resource.h"
+
+ extern _X_EXPORT RESTYPE RegionResType;
++extern _X_EXPORT RESTYPE PointerBarrierType;
+ extern _X_EXPORT int XFixesErrorBase;
+
+ #define VERIFY_REGION(pRegion, rid, client, mode) \
+@@ -51,5 +52,21 @@ extern _X_EXPORT int XFixesErrorBase;
+ extern _X_EXPORT RegionPtr
+ XFixesRegionCopy (RegionPtr pRegion);
+
++struct PointerBarrier {
++ CARD16 x1, x2, y1, y2;
++ CARD32 directions;
++};
++
++
++extern int
++barrier_get_direction(int, int, int, int);
++extern BOOL
++barrier_is_blocking(const struct PointerBarrier*, int, int, int, int, double*);
++extern BOOL
++barrier_is_blocking_direction(const struct PointerBarrier*, int);
++extern void
++barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y);
++
++
+
+ #endif /* _XFIXES_H_ */
+diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
+index d005369..6ba276e 100644
+--- a/xfixes/xfixesint.h
++++ b/xfixes/xfixesint.h
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright 2010 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+@@ -278,6 +279,21 @@ ProcXFixesShowCursor (ClientPtr client);
+ int
+ SProcXFixesShowCursor (ClientPtr client);
+
++/* Version 5 */
++
++int
++ProcXFixesCreatePointerBarrier (ClientPtr client);
++
++int
++SProcXFixesCreatePointerBarrier (ClientPtr client);
++
++int
++ProcXFixesDestroyPointerBarrier (ClientPtr client);
++
++int
++SProcXFixesDestroyPointerBarrier (ClientPtr client);
++
++/* Xinerama */
+ extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr);
+ void PanoramiXFixesInit (void);
+ void PanoramiXFixesReset (void);
+--
+1.7.4
+
diff --git a/testing/xorg-server/xvfb-run b/testing/xorg-server/xvfb-run
new file mode 100644
index 000000000..4c2f4e0d3
--- /dev/null
+++ b/testing/xorg-server/xvfb-run
@@ -0,0 +1,180 @@
+#!/bin/sh
+
+# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
+
+# This script starts an instance of Xvfb, the "fake" X server, runs a command
+# with that server available, and kills the X server when done. The return
+# value of the command becomes the return value of this script.
+#
+# If anyone is using this to build a Debian package, make sure the package
+# Build-Depends on xvfb, xbase-clients, and xfonts-base.
+
+set -e
+
+PROGNAME=xvfb-run
+SERVERNUM=99
+AUTHFILE=
+ERRORFILE=/dev/null
+STARTWAIT=3
+XVFBARGS="-screen 0 640x480x8"
+LISTENTCP="-nolisten tcp"
+XAUTHPROTO=.
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user. This is used only as a fallback in the event
+# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the
+# script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
+ DEFCOLUMNS=80
+fi
+
+# Display a message, wrapping lines at the terminal width.
+message () {
+ echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
+}
+
+# Display an error message.
+error () {
+ message "error: $*" >&2
+}
+
+# Display a usage message.
+usage () {
+ if [ -n "$*" ]; then
+ message "usage error: $*"
+ fi
+ cat <<EOF
+Usage: $PROGNAME [OPTION ...] COMMAND
+Run COMMAND (usually an X client) in a virtual X server environment.
+Options:
+-a --auto-servernum try to get a free server number, starting at
+ --server-num
+-e FILE --error-file=FILE file used to store xauth errors and Xvfb
+ output (default: $ERRORFILE)
+-f FILE --auth-file=FILE file used to store auth cookie
+ (default: ./.Xauthority)
+-h --help display this usage message and exit
+-n NUM --server-num=NUM server number to use (default: $SERVERNUM)
+-l --listen-tcp enable TCP port listening in the X server
+-p PROTO --xauth-protocol=PROTO X authority protocol name to use
+ (default: xauth command's default)
+-s ARGS --server-args=ARGS arguments (other than server number and
+ "-nolisten tcp") to pass to the Xvfb server
+ (default: "$XVFBARGS")
+-w DELAY --wait=DELAY delay in seconds to wait for Xvfb to start
+ before running COMMAND (default: $STARTWAIT)
+EOF
+}
+
+# Find a free server number by looking at .X*-lock files in /tmp.
+find_free_servernum() {
+ # Sadly, the "local" keyword is not POSIX. Leave the next line commented in
+ # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
+ # anyway.
+ #local i
+
+ i=$SERVERNUM
+ while [ -f /tmp/.X$i-lock ]; do
+ i=$(($i + 1))
+ done
+ echo $i
+}
+
+# Clean up files
+clean_up() {
+ if [ -e "$AUTHFILE" ]; then
+ XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >>"$ERRORFILE" 2>&1
+ fi
+ if [ -n "$XVFB_RUN_TMPDIR" ]; then
+ if ! rm -r "$XVFB_RUN_TMPDIR"; then
+ error "problem while cleaning up temporary directory"
+ exit 5
+ fi
+ fi
+}
+
+# Parse the command line.
+ARGS=$(getopt --options +ae:f:hn:lp:s:w: \
+ --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \
+ --name "$PROGNAME" -- "$@")
+GETOPT_STATUS=$?
+
+if [ $GETOPT_STATUS -ne 0 ]; then
+ error "internal error; getopt exited with status $GETOPT_STATUS"
+ exit 6
+fi
+
+eval set -- "$ARGS"
+
+while :; do
+ case "$1" in
+ -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
+ -e|--error-file) ERRORFILE="$2"; shift ;;
+ -f|--auth-file) AUTHFILE="$2"; shift ;;
+ -h|--help) SHOWHELP="yes" ;;
+ -n|--server-num) SERVERNUM="$2"; shift ;;
+ -l|--listen-tcp) LISTENTCP="" ;;
+ -p|--xauth-protocol) XAUTHPROTO="$2"; shift ;;
+ -s|--server-args) XVFBARGS="$2"; shift ;;
+ -w|--wait) STARTWAIT="$2"; shift ;;
+ --) shift; break ;;
+ *) error "internal error; getopt permitted \"$1\" unexpectedly"
+ exit 6
+ ;;
+ esac
+ shift
+done
+
+if [ "$SHOWHELP" ]; then
+ usage
+ exit 0
+fi
+
+if [ -z "$*" ]; then
+ usage "need a command to run" >&2
+ exit 2
+fi
+
+if ! which xauth >/dev/null; then
+ error "xauth command not found"
+ exit 3
+fi
+
+# tidy up after ourselves
+trap clean_up EXIT
+
+# If the user did not specify an X authorization file to use, set up a temporary
+# directory to house one.
+if [ -z "$AUTHFILE" ]; then
+ XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
+ AUTHFILE="$XVFB_RUN_TMPDIR/Xauthority"
+fi
+
+# Start Xvfb.
+MCOOKIE=$(mcookie)
+XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
+add :$SERVERNUM $XAUTHPROTO $MCOOKIE
+EOF
+XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
+ 2>&1 &
+XVFBPID=$!
+sleep "$STARTWAIT"
+if ! kill -0 $XVFBPID 2>/dev/null; then
+ echo "Xvfb failed to start" >&2
+ exit 1
+fi
+
+# Start the command and save its exit status.
+set +e
+DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
+RETVAL=$?
+set -e
+
+# Kill Xvfb now that the command has exited.
+kill $XVFBPID
+
+# Return the executed command's exit status.
+exit $RETVAL
+
+# vim:set ai et sts=4 sw=4 tw=80:
diff --git a/testing/xorg-server/xvfb-run.1 b/testing/xorg-server/xvfb-run.1
new file mode 100644
index 000000000..137d3a196
--- /dev/null
+++ b/testing/xorg-server/xvfb-run.1
@@ -0,0 +1,282 @@
+.\" $Id: xvfb-run.1 2138 2005-01-17 23:40:27Z branden $
+.\"
+.\" Copyright 1998-2004 Branden Robinson <branden@debian.org>.
+.\"
+.\" This is free software; you may 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,
+.\" or (at your option) any later version.
+.\"
+.\" This is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License with
+.\" the Debian operating system, in /usr/share/common-licenses/GPL; if
+.\" not, write to the Free Software Foundation, Inc., 59 Temple Place,
+.\" Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" We need the URL macro from groff's www macro package, but also want
+.\" things to work all right for people who don't have it. So we define
+.\" our own URL macro and let the www macro package override it if it's
+.\" available.
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.TH xvfb\-run 1 "2004\-11\-12" "Debian Project"
+.SH NAME
+xvfb\-run \- run specified X client or command in a virtual X server environment
+.SH SYNOPSIS
+.B xvfb\-run
+[
+.I options
+]
+.I command
+.SH DESCRIPTION
+.B xvfb\-run
+is a wrapper for the
+.BR Xvfb (1x)
+command which simplifies the task of running commands (typically an X
+client, or a script containing a list of clients to be run) within a virtual
+X server environment.
+.PP
+.B xvfb\-run
+sets up an X authority file (or uses an existing user\-specified one),
+writes a cookie to it (see
+.BR xauth (1x))
+and then starts the
+.B Xvfb
+X server as a background process.
+The process ID of
+.B Xvfb
+is stored for later use.
+The specified
+.I command
+is then run using the X display corresponding to the
+.B Xvfb
+server
+just started and the X authority file created earlier.
+.PP
+When the
+.I command
+exits, its status is saved, the
+.B Xvfb
+server is killed (using the process ID stored earlier), the X authority
+cookie removed, and the authority file deleted (if the user did not specify
+one to use).
+.B xvfb\-run
+then exits with the exit status of
+.IR command .
+.PP
+.B xvfb\-run
+requires the
+.B xauth
+command to function.
+.SH OPTIONS
+.TP
+.B \-a\fR,\fB \-\-auto\-servernum
+Try to get a free server number, starting at 99, or the argument to
+.BR \-\-server\-num .
+.TP
+.BI \-e\ file \fR,\fB\ \-\-error\-file= file
+Store output from
+.B xauth
+and
+.B Xvfb
+in
+.IR file .
+The default is
+.IR /dev/null .
+.TP
+.BI \-f\ file \fR,\fB\ \-\-auth\-file= file
+Store X authentication data in
+.IR file .
+By default, a temporary directory called
+.IR xvfb\-run. PID
+(where PID is the process ID of
+.B xvfb\-run
+itself) is created in the directory specified by the environment variable
+.B TMPDIR
+(or
+.I /tmp
+if that variable is null or unset), and the
+.BR tempfile (1)
+command is used to create a file in that temporary directory called
+.IR Xauthority .
+.TP
+.B \-h\fR,\fB \-\-help
+Display a usage message and exit.
+.TP
+.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber
+Use
+.I servernumber
+as the server number (but see the
+.B \-a\fR,\fB \-\-auto\-servernum
+option above).
+The default is 99.
+.TP
+.B \-l\fR,\fB \-\-listen\-tcp
+Enable TCP port listening in the X server.
+For security reasons (to avoid denial\-of\-service attacks or exploits),
+TCP port listening is disabled by default.
+.TP
+.BI \-p\ protocolname \fR,\fB\ \-\-xauth\-protocol= protocolname
+Use
+.I protocolname
+as the X authority protocol to use.
+The default is \(oq.\(cq, which
+.B xauth
+interprets as its own default protocol, which is MIT\-MAGIC\-COOKIE\-1.
+.TP
+.BI \-s\ arguments \fR,\fB\ \-\-server\-args= arguments
+Pass
+.I arguments
+to the
+.B Xvfb
+server.
+Be careful to quote any whitespace characters that may occur within
+.I arguments
+to prevent them from regarded as separators for
+.BR xvfb\-run 's
+own arguments.
+Also, note that specification of \(oq\-nolisten tcp\(cq in
+.I arguments
+may override the function of
+.BR xvfb\-run 's
+own
+.B \-l\fR,\fB \-\-listen\-tcp
+option, and that specification of the server number (e.g., \(oq:1\(cq) may
+be ignored because of the way the X server parses its argument list.
+Use the
+.B xvfb\-run
+option
+.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber
+to achieve the latter function.
+The default is \(oq\-screen 0 640x480x8\(cq.
+.TP
+.BI \-w\ delay \fR,\fB\ \-\-wait= delay
+Wait
+.I delay
+seconds after launching
+.B Xvfb
+before attempting to start the specified command.
+The default is 3.
+.SH ENVIRONMENT
+.TP
+.B COLUMNS
+indicates the width of the terminal device in character cells.
+This value is used for formatting diagnostic messages.
+If not set, the terminal is queried using
+.BR stty (1)
+to determine its width.
+If that fails, a value of \(oq80\(cq is assumed.
+.TP
+.B TMPDIR
+specifies the directory in which to place
+.BR xvfb\-run 's
+temporary directory for storage of the X authority file; only used if the
+.B \-f
+or
+.B \-\-auth\-file
+options are not specified.
+.SH "OUTPUT FILES"
+.PP
+Unless the
+.B \-f
+or
+.B \-\-auth\-file
+options are specified, a temporary
+directory and file within it are created (and deleted) to store the X
+authority cookies used by the
+.B Xvfb
+server and client(s) run under it.
+See
+.BR tempfile (1).
+If \-f or \-\-auth\-file are used, then the specified X authority file is
+only written to, not created or deleted (though
+.B xauth
+creates an authority file itself if told to use use that does not already
+exist).
+.PP
+An error file with a user\-specified name is also created if the
+.B \-e
+or
+.B \-\-error\-file
+options are specifed; see above.
+.SH "EXIT STATUS"
+.B xvfb\-run
+uses its exit status as well as output to standard error to communicate
+diagnostics.
+The exit status of \(oq1\(cq is not used, and should be interpreted as failure
+of the specified command.
+.TP
+0
+.B xvfb\-run
+only uses this exit status if the
+.B \-h\fR,\fB \-\-help
+option is given.
+In all other situations, this may be interpreted as success of the specified
+command.
+.TP
+2
+No command to run was specified.
+.TP
+3
+The
+.B xauth
+command is not available.
+.TP
+4
+The temporary directory that was going to be used already exists; since
+.B xvfb\-run
+produces a uniquely named directory, this may indicate an attempt by another
+process on the system to exploit a temporary file race condition.
+.TP
+5
+A problem was encountered while cleaning up the temporary directory.
+.TP
+6
+A problem was encountered while using
+.BR getopt (1)
+to parse the command\-line arguments.
+.SH EXAMPLES
+.TP
+.B xvfb\-run \-\-auto\-servernum \-\-server\-num=1 xlogo
+runs the
+.BR xlogo (1x)
+demonstration client inside the
+.B Xvfb
+X server on the first available server number greater than or equal to 1.
+.TP
+.B xvfb\-run \-\-server\-args="\-screen 0 1024x768x24" ico \-faces
+runs the
+.BR ico (1x)
+demonstration client (and passes it the
+.B \-faces
+argument) inside the
+.B Xvfb
+X server, configured with a root window of 1024 by 768 pixels and a color
+depth of 24 bits.
+.PP
+Note that the demo X clients used in the above examples will not exit on
+their own, so they will have to be killed before
+.B xvfb\-run
+will exit.
+.SH BUGS
+See
+.URL "http://bugs.debian.org/xvfb" "the Debian Bug Tracking System" .
+If you wish to report a bug in
+.BR xvfb\-run ,
+please use the
+.BR reportbug (1)
+command.
+.SH AUTHOR
+.B xfvb\-run
+was written by Branden Robinson and Jeff Licquia with sponsorship from
+Progeny Linux Systems.
+.SH "SEE ALSO"
+.BR Xvfb (1x),
+.BR xauth (1x)
+.\" vim:set et tw=80: