summaryrefslogtreecommitdiffstats
path: root/source/l/qt
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2016-06-30 20:26:57 +0000
committer Eric Hameleers <alien@slackware.com>2018-05-31 23:31:18 +0200
commitd31c50870d0bee042ce660e445c9294a59a3a65b (patch)
tree6bfc0de3c95267b401b620c2c67859557dc60f97 /source/l/qt
parent76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff)
downloadcurrent-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz
current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.xz
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016 Slackware 14.2 x86_64 stable is released! The long development cycle (the Linux community has lately been living in "interesting times", as they say) is finally behind us, and we're proud to announce the release of Slackware 14.2. The new release brings many updates and modern tools, has switched from udev to eudev (no systemd), and adds well over a hundred new packages to the system. Thanks to the team, the upstream developers, the dedicated Slackware community, and everyone else who pitched in to help make this release a reality. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Have fun! :-)
Diffstat (limited to 'source/l/qt')
-rw-r--r--source/l/qt/Qt.pc2
-rwxr-xr-xsource/l/qt/qt-nowebkit.SlackBuild320
-rwxr-xr-xsource/l/qt/qt.SlackBuild301
-rw-r--r--source/l/qt/qt.fix.broken.gif.crash.diff16
-rw-r--r--source/l/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff63
-rw-r--r--source/l/qt/qt.ld-gold.patch22
-rw-r--r--source/l/qt/qt.qclipboard_delay.patch12
-rw-r--r--source/l/qt/qt.qclipboard_fix_recursive.patch94
-rw-r--r--source/l/qt/qt.qsystemtrayicon-plugin-system.diff1466
-rw-r--r--source/l/qt/qtwebkit/doinst.sh5
-rwxr-xr-xsource/l/qt/qtwebkit/qtwebkit.SlackBuild165
-rw-r--r--source/l/qt/qtwebkit/qtwebkit.putByIndexBeyondVectorLengthWithArrayStorage.diff13
-rw-r--r--source/l/qt/qtwebkit/qtwebkit.url1
-rw-r--r--source/l/qt/qtwebkit/slack-desc19
-rwxr-xr-x[-rw-r--r--]source/l/qt/slack-desc2
15 files changed, 2219 insertions, 282 deletions
diff --git a/source/l/qt/Qt.pc b/source/l/qt/Qt.pc
index f4c0d5938..29d1131c6 100644
--- a/source/l/qt/Qt.pc
+++ b/source/l/qt/Qt.pc
@@ -13,4 +13,4 @@ translationdir=${prefix}/translations
Name: Qt
Description: Qt Configuration
-Version: 4.8.1
+Version: 4.8.6
diff --git a/source/l/qt/qt-nowebkit.SlackBuild b/source/l/qt/qt-nowebkit.SlackBuild
new file mode 100755
index 000000000..cb25ba647
--- /dev/null
+++ b/source/l/qt/qt-nowebkit.SlackBuild
@@ -0,0 +1,320 @@
+#!/bin/sh
+
+# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Merged some ideas from Alex Sarmardzic's script for qt4 at SlackBuilds.org
+# ^^ Modified by Robby Workman <rworkman@slackware.com> for QT4 & KDE4
+
+# We're using qt-copy instead of a released qt version, as this git release
+# has at least one bugfix strongly recommended by the kde developers.
+
+# Obtained from:
+# git clone git://gitorious.org/+kde-developers/qt/kde-qt.git
+# git checkout origin/4.5.3-patched
+# git checkout origin/4.6.0-stable-patched
+# git checkout origin/4.6.1-patched
+# git checkout origin/4.7.0-patched
+#
+# Alternate method (we don't use this):
+# wget http://qt.gitorious.org/qt/kde-qt/archive-tarball/4.6.2-patched
+#
+# Modifications 2010, 2011, 2012 Eric Hameleers, Eindhoven, NL
+# qt 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2, 4.8.4, 4.8.5, 4.8.6 are built from original nokia sources.
+
+PKGNAM=qt
+VERSION=$(ls qt-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+BUILD=${BUILD:-4}
+
+NUMJOBS=${NUMJOBS:--j7}
+
+# Automatically determine the architecture we're building on:
+MARCH=$( uname -m )
+if [ -z "$ARCH" ]; then
+ case "$MARCH" in
+ i?86) export ARCH=i586 ;;
+ armv7hl) export ARCH=$MARCH ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$MARCH ;;
+ esac
+fi
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ # To prevent "qatomic_armv6.h error: output number 2 not directly addressable"
+ # More permanent solution is to patch gcc:
+ # http://bazaar.launchpad.net/~linaro-toolchain-dev/gcc-linaro/4.6/revision/106731
+ SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -fno-strict-volatile-bitfields"
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+case "$ARCH" in
+ arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+ *) TARGET=$ARCH-slackware-linux ;;
+esac
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-${PKGNAM}
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf qt-everywhere-opensource-src-$VERSION
+tar xvf $CWD/qt-everywhere-opensource-src-$VERSION.tar.xz # For qt releases
+cd qt-everywhere-opensource-src-$VERSION || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+if [ $ARCH = "i486" -o $ARCH = "i586" ]; then
+ sed -i -e "s/QMAKE_CFLAGS_RELEASE += -O2/QMAKE_CFLAGS_RELEASE += $SLKCFLAGS/" mkspecs/common/gcc-base.conf || exit 1
+fi
+
+# Fix path to mysql header
+zcat $CWD/qt.mysql.h.diff.gz | patch -p1 --verbose || exit 1
+
+# Stupid idea - remove it:
+zcat $CWD/qt.webkit-no_Werror.patch.gz | patch -p1 --verbose || exit 1
+
+# Fix crash on malformed GIF images (CVE-2014-0190):
+zcat $CWD/qt.fix.broken.gif.crash.diff.gz | patch -p1 --verbose || exit 1
+
+# Implement qsystemtrayicon support for Qt4 applications in Plasma 5:
+zcat $CWD/qt.qsystemtrayicon-plugin-system.diff.gz | patch -p1 --verbose || exit 1
+
+# Apply LibreOffice fixes (QTBUG-37380, QTBUG-34614, QTBUG-38585),
+# Native KDE4 file pickers will be disabled at runtime otherwise.
+zcat $CWD/qt.glib-honor-ExcludeSocketNotifiers-flag.diff.gz | patch -p1 --verbose || exit 1
+zcat $CWD/qt.qclipboard_fix_recursive.patch.gz | patch -p1 --verbose || exit 1
+zcat $CWD/qt.qclipboard_delay.patch.gz | patch -p1 --verbose || exit 1
+
+# All other distros I checked build with -no-webkit. But this has the downside of
+# breaking the build when QtWebKit is present on the build system and some things
+# (assistant for one) are built without support for QtWebKit. So let's go with
+# -webkit and remove the built files later from the package. -HW
+
+export CFLAGS="$SLKCFLAGS"
+export CXXFLAGS="$SLKCFLAGS"
+export OPENSOURCE_CXXFLAGS="$SLKCFLAGS"
+./configure \
+ -confirm-license \
+ -opensource \
+ -prefix /usr/lib${LIBDIRSUFFIX}/qt \
+ -fast \
+ -system-libpng \
+ -system-libjpeg \
+ -system-zlib \
+ -system-sqlite \
+ -plugin-sql-sqlite \
+ -dbus \
+ -webkit \
+ -no-phonon \
+ -nomake examples \
+ -nomake demos \
+ -nomake docs \
+ -no-separate-debug-info \
+ -no-pch
+ # No-precompiled-headers is ccache-friendly.
+
+# Sometimes a failure happens when parallelizing make. Try again if make fails,
+# but make a failure the second time around (single threaded) a fatal error:
+make $NUMJOBS || make || exit 1
+make install INSTALL_ROOT=$PKG || exit 1
+
+# dropping the just built WebKit since we replace it with an external one
+rm -f $PKG/usr/lib$LIBDIRSUFFIX/qt/lib/libQtWebKit*
+rm -f $PKG/usr/lib$LIBDIRSUFFIX/qt/lib/pkgconfig/QtWebKit.pc
+rm -rf $PKG/usr/lib$LIBDIRSUFFIX/qt/imports/QtWebKit
+rm -rf $PKG/usr/lib$LIBDIRSUFFIX/qt/include/QtWebKit
+
+# The infamous qt -> qt-${VERSION} link that keeps the full path out of .la files:
+( cd $PKG/usr/lib${LIBDIRSUFFIX} ; ln -sf qt qt-${VERSION} )
+
+# Add a missing Qt.pc which is needed by KDE applications:
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig
+cat <<EOF > $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/Qt.pc
+prefix=/usr/lib${LIBDIRSUFFIX}/qt
+bindir=\${prefix}/bin
+datadir=\${prefix}
+docdir=\${prefix}/doc
+headerdir=\${prefix}/include
+importdir=\${prefix}/imports
+libdir=\${prefix}/lib
+moc=\${bindir}/moc
+plugindir=\${prefix}/plugins
+qmake=\${bindir}/qmake
+sysconfdir=\${prefix}/etc/settings
+translationdir=\${prefix}/translations
+
+Name: Qt
+Description: Qt Configuration
+Version: $VERSION
+EOF
+
+# libjscore is used internally. Prevent a false dependency on this in the .la and .pc files:
+sed -i "s,-ljscore,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/*.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
+sed -i "s,-L../JavaScriptCore/release,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/*.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
+
+# Make sure that .la and .pc files use the correct $LIBDIRSUFFIX:
+sed -i "s,-L/usr/X11R6/lib,-L/usr/X11R6/lib${LIBDIRSUFFIX},g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/*.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
+
+# Link the shared libraries into /usr/lib:
+( cd $PKG/usr/lib${LIBDIRSUFFIX}
+ for file in qt/lib/*.so* ; do
+ ln -sf $file .
+ done
+)
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Add profile scripts
+mkdir -p $PKG/etc/profile.d
+sed -e "s#usr/lib/#usr/lib${LIBDIRSUFFIX}/#g" $CWD/profile.d/qt4.sh \
+ > $PKG/etc/profile.d/qt4.sh
+sed -e "s#usr/lib/#usr/lib${LIBDIRSUFFIX}/#g" $CWD/profile.d/qt4.csh \
+ > $PKG/etc/profile.d/qt4.csh
+chmod 0755 $PKG/etc/profile.d/*
+
+# Put a ton of links to more "normal" places. I'd just use a prefix of /usr, but it
+# creates a ton of new (and ambiguously named) /usr directories...
+mkdir -p $PKG/usr/bin
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/qt/bin
+ for file in * ; do
+ ( cd $PKG/usr/bin ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt/bin/$file . )
+ done
+)
+
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig
+ for file in *.pc ; do
+ ( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/$file . )
+ done
+)
+
+# Install Qt's private headers - at least Gentoo and Fedora are adding these
+# and some software has (inevitably) started depending on them:
+# We're using `rsync -R` as easy way to preserve relative path names:
+rsync -aR \
+ include/Qt{Core,Declarative,Gui,Script}/private \
+ src/{corelib,declarative,gui,script}/*/*_p.h \
+ ${PKG}/usr/lib${LIBDIRSUFFIX}/qt/
+
+# Add menu entries for all those hidden but great Qt applications:
+# Assistant icons
+install -p -m644 -D tools/assistant/tools/assistant/images/assistant.png $PKG/usr/share/icons/hicolor/32x32/apps/assistant.png
+install -p -m644 -D tools/assistant/tools/assistant/images/assistant-128.png $PKG/usr/share/icons/hicolor/128x128/apps/assistant.png
+# Designer icon
+install -p -m644 -D tools/designer/src/designer/images/designer.png $PKG/usr/share/icons/hicolor/128x128/apps/designer.png
+# Linguist icons
+for icon in tools/linguist/linguist/images/icons/linguist-*-32.png ; do
+ size=$(echo $(basename ${icon}) | cut -d- -f2)
+ install -p -m644 -D ${icon} $PKG/usr/share/icons/hicolor/${size}x${size}/apps/linguist.png
+done
+# Qt logo:
+convert doc/src/images/qt-logo.png -resize 48x48 $PKG/usr/share/icons/hicolor/48x48/apps/qt-logo.png
+
+# And the .desktop files
+mkdir -p $PKG/usr/share/applications
+cat <<EOF > $PKG/usr/share/applications/designer.desktop
+[Desktop Entry]
+Name=Qt4 Designer
+GenericName=Interface Designer
+Comment=Design GUIs for Qt4 applications
+Exec=designer
+Icon=designer
+MimeType=application/x-designer;
+Terminal=false
+Encoding=UTF-8
+Type=Application
+Categories=Qt;Development;
+EOF
+cat <<EOF > $PKG/usr/share/applications/assistant.desktop
+[Desktop Entry]
+Name=Qt4 Assistant
+Comment=Shows Qt4 documentation and examples
+Exec=assistant
+Icon=assistant
+Terminal=false
+Encoding=UTF-8
+Type=Application
+Categories=Qt;Development;Documentation;
+EOF
+cat <<EOF > $PKG/usr/share/applications/linguist.desktop
+[Desktop Entry]
+Name=Qt4 Linguist
+Comment=Add translations to Qt4 applications
+Exec=linguist
+Icon=linguist
+MimeType=text/vnd.trolltech.linguist;application/x-linguist;
+Terminal=false
+Encoding=UTF-8
+Type=Application
+Categories=Qt;Development;
+EOF
+cat <<EOF > $PKG/usr/share/applications/qtconfig.desktop
+[Desktop Entry]
+Name=Qt4 Config
+Comment=Configure Qt4 behavior, styles, fonts
+Exec=qtconfig
+Icon=qt-logo
+Terminal=false
+Encoding=UTF-8
+Type=Application
+Categories=Qt;Settings;
+EOF
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a *GPL_EXCEPTION* FAQ* INSTALL KNOWN* LICENSE* README* changes-* \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+if [ -d $PKG/usr/lib${LIBDIRSUFFIX}/qt/doc/html ]; then
+ ( cd $PKG/usr/doc/$PKGNAM-$VERSION
+ ln -sf /usr/lib${LIBDIRSUFFIX}/qt/doc/html .
+ )
+fi
+
+mkdir -p $PKG/install
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/l/qt/qt.SlackBuild b/source/l/qt/qt.SlackBuild
index 8954243bd..3c4ca01d1 100755
--- a/source/l/qt/qt.SlackBuild
+++ b/source/l/qt/qt.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2015 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,36 +20,22 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Merged some ideas from Alex Sarmardzic's script for qt4 at SlackBuilds.org
-# ^^ Modified by Robby Workman <rworkman@slackware.com> for QT4 & KDE4
+# This script builds Qt, packages it without WebKit, upgrades the machine to
+# a WebKit-less Qt, builds a WebKit package, merges the two packages, and
+# finally upgrades the machine to a combined package.
-# We're using qt-copy instead of a released qt version, as this git release
-# has at least one bugfix strongly recommended by the kde developers.
-
-# Obtained from:
-# git clone git://gitorious.org/+kde-developers/qt/kde-qt.git
-# git checkout origin/4.5.3-patched
-# git checkout origin/4.6.0-stable-patched
-# git checkout origin/4.6.1-patched
-# git checkout origin/4.7.0-patched
-#
-# Alternate method (we don't use this):
-# wget http://qt.gitorious.org/qt/kde-qt/archive-tarball/4.6.2-patched
-#
-# Modifications 2010, 2011, 2012 Eric Hameleers, Eindhoven, NL
-# qt 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2, 4.8.4 are built from original nokia sources.
-
-PKGNAM=qt
-VERSION=$(ls qt-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
-BUILD=${BUILD:-2}
-
-NUMJOBS=${NUMJOBS:--j7}
+QTVERSION=$(ls qt-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+# Adjust the combined package $BUILD in qt-nowebkit.SlackBuild:
+QTBUILD=$(grep BUILD= qt-nowebkit.SlackBuild | cut -f 2 -d - | cut -f 1 -d \})
+WEBKITVERSION=$(ls qtwebkit/qtwebkit-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+# This $BUILD doesn't really need to change as long as these are combined:
+WEBKITBUILD=$(grep BUILD= qtwebkit/qtwebkit.SlackBuild | cut -f 2 -d - | cut -f 1 -d \})
# Automatically determine the architecture we're building on:
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
case "$MARCH" in
- i?86) export ARCH=i486 ;;
+ i?86) export ARCH=i586 ;;
armv7hl) export ARCH=$MARCH ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
@@ -57,246 +43,45 @@ if [ -z "$ARCH" ]; then
esac
fi
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "s390" ]; then
- SLKCFLAGS="-O2"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
- LIBDIRSUFFIX="64"
-elif [ "$ARCH" = "armv7hl" ]; then
- # To prevent "qatomic_armv6.h error: output number 2 not directly addressable"
- # More permanent solution is to patch gcc:
- # http://bazaar.launchpad.net/~linaro-toolchain-dev/gcc-linaro/4.6/revision/106731
- SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -fno-strict-volatile-bitfields"
- LIBDIRSUFFIX=""
-else
- SLKCFLAGS="-O2"
- LIBDIRSUFFIX=""
-fi
-
-case "$ARCH" in
- arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
- *) TARGET=$ARCH-slackware-linux ;;
-esac
-
-CWD=$(pwd)
TMP=${TMP:-/tmp}
-PKG=$TMP/package-${PKGNAM}
-rm -rf $PKG
-mkdir -p $TMP $PKG
-cd $TMP
-rm -rf qt-everywhere-opensource-src-$VERSION
-tar xvf $CWD/qt-everywhere-opensource-src-$VERSION.tar.xz # For qt releases
-cd qt-everywhere-opensource-src-$VERSION || exit 1
-
-chown -R root:root .
-find . \
- \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
- -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
- -exec chmod 644 {} \;
-
-if [ $ARCH = "i486" ]; then
- sed -i -e "s/QMAKE_CFLAGS_RELEASE += -O2/QMAKE_CFLAGS_RELEASE += $SLKCFLAGS/" mkspecs/common/gcc-base.conf || exit 1
+# Build Qt and package it without WebKit:
+rm -f $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
+./qt-nowebkit.SlackBuild
+if [ ! -r $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz ]; then
+ echo "FATAL: Failed to build Qt package without WebKit."
+ exit 1
fi
-# Fix path to mysql header
-zcat $CWD/qt.mysql.h.diff.gz | patch -p1 --verbose || exit 1
-
-# gcc doesn't support flag "-fuse-ld=gold":
-zcat $CWD/qt.ld-gold.patch.gz | patch -p1 --verbose || exit 1
-
-# Stupid idea - remove it:
-zcat $CWD/qt.webkit-no_Werror.patch.gz | patch -p1 --verbose || exit 1
-
-export CFLAGS="$SLKCFLAGS"
-export CXXFLAGS="$SLKCFLAGS"
-export OPENSOURCE_CXXFLAGS="$SLKCFLAGS"
-./configure \
- -confirm-license \
- -opensource \
- -prefix /usr/lib${LIBDIRSUFFIX}/qt \
- -fast \
- -system-libpng \
- -system-libjpeg \
- -system-zlib \
- -system-sqlite \
- -plugin-sql-sqlite \
- -dbus \
- -webkit \
- -no-phonon \
- -nomake examples \
- -nomake demos \
- -nomake docs \
- -no-separate-debug-info \
- -no-pch
- # No-precompiled-headers is ccache-friendly.
-
-# Sometimes a failure happens when parallelizing make. Try again if make fails,
-# but make a failure the second time around (single threaded) a fatal error:
-make $NUMJOBS || make || exit 1
-make install INSTALL_ROOT=$PKG || exit 1
-
-# The infamous qt -> qt-${VERSION} link that keeps the full path out of .la files:
-( cd $PKG/usr/lib${LIBDIRSUFFIX} ; ln -sf qt qt-${VERSION} )
-
-# Add a missing Qt.pc which is needed by KDE applications:
-mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig
-cat <<EOF > $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/Qt.pc
-prefix=/usr/lib${LIBDIRSUFFIX}/qt
-bindir=\${prefix}/bin
-datadir=\${prefix}
-docdir=\${prefix}/doc
-headerdir=\${prefix}/include
-importdir=\${prefix}/imports
-libdir=\${prefix}/lib
-moc=\${bindir}/moc
-plugindir=\${prefix}/plugins
-qmake=\${bindir}/qmake
-sysconfdir=\${prefix}/etc/settings
-translationdir=\${prefix}/translations
-
-Name: Qt
-Description: Qt Configuration
-Version: $VERSION
-EOF
-
-# libjscore is used internally. Prevent a false dependency on this in the .la and .pc files:
-sed -i "s,-ljscore,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/*.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
-sed -i "s,-L../JavaScriptCore/release,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/*.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
-
-# libwebcore is used internally. Prevent a false dependency on this in the .la and .pc files:
-sed -i \
- -e "s#-L/usr/lib${LIBDIRSUFFIX}/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib$LIBDIRSUFFIX -lwebcore##g" \
- -e "s#-L/usr/lib${LIBDIRSUFFIX}/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib -lwebcore##g" \
- -e "s# -lwebcore##g" \
- $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/libQtWebKit.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/QtWebKit.pc
-
-# Link the shared libraries into /usr/lib:
-( cd $PKG/usr/lib${LIBDIRSUFFIX}
- for file in qt/lib/*.so* ; do
- ln -sf $file .
- done
-)
-
-find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
- | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
-
-# Add profile scripts
-mkdir -p $PKG/etc/profile.d
-sed -e "s#usr/lib/#usr/lib${LIBDIRSUFFIX}/#g" $CWD/profile.d/qt4.sh \
- > $PKG/etc/profile.d/qt4.sh
-sed -e "s#usr/lib/#usr/lib${LIBDIRSUFFIX}/#g" $CWD/profile.d/qt4.csh \
- > $PKG/etc/profile.d/qt4.csh
-chmod 0755 $PKG/etc/profile.d/*
-
-# Put a ton of links to more "normal" places. I'd just use a prefix of /usr, but it
-# creates a ton of new (and ambiguously named) /usr directories...
-mkdir -p $PKG/usr/bin
-( cd $PKG/usr/lib${LIBDIRSUFFIX}/qt/bin
- for file in * ; do
- ( cd $PKG/usr/bin ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt/bin/$file . )
- done
-)
+# Upgrade system to Qt (without WebKit):
+/sbin/upgradepkg --reinstall --install-new $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
+
+# Build standalone WebKit package (qtwebkit):
+rm -f $TMP/qtwebkit-${WEBKITVERSION}-${ARCH}-${WEBKITBUILD}.txz
+( cd qtwebkit
+ ./qtwebkit.SlackBuild )
+if [ ! -r $TMP/qtwebkit-${WEBKITVERSION}-${ARCH}-${WEBKITBUILD}.txz ]; then
+ echo "FATAL: Failed to build QtWebKit standalone package."
+ rm -f $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
+ exit 1
+fi
-mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
-( cd $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig
- for file in *.pc ; do
- ( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/$file . )
- done
+# Combine the packages:
+rm -rf $TMP/package-qt
+mkdir -p $TMP/package-qt
+( cd $TMP/package-qt
+ /sbin/explodepkg $TMP/qtwebkit-${WEBKITVERSION}-${ARCH}-${WEBKITBUILD}.txz
+ /sbin/explodepkg $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
+ cat $TMP/package-qtwebkit/install/doinst.sh | grep '^(' >> install/doinst.sh
+ mv usr/doc/qtwebkit-* usr/doc/qt-*
+ /sbin/makepkg -l y -c n ../qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
)
-# Install Qt's private headers - at least Gentoo and Fedora are adding these
-# and some software has (inevitably) started depending on them:
-# We're using `rsync -R` as easy way to preserve relative path names:
-rsync -aR \
- include/Qt{Core,Declarative,Gui,Script}/private \
- src/{corelib,declarative,gui,script}/*/*_p.h \
- ${PKG}/usr/lib${LIBDIRSUFFIX}/qt/
-
-# Add menu entries for all those hidden but great Qt applications:
-# Qt logo:
-convert $PKG/usr/lib$LIBDIRSUFFIX/qt/doc/src/images/qt-logo.png -resize 48x48 $PKG/usr/share/icons/hicolor/48x48/apps/qt-logo.png
-convert $PKG/usr/lib$LIBDIRSUFFIX/qt/doc/src/images/qt-logo.png -resize 48x48 $PKG/usr/share/icons/hicolor/48x48/apps/qt-logo.png
-# Assistant icons
-install -p -m644 -D tools/assistant/tools/assistant/images/assistant.png $PKG/usr/share/icons/hicolor/32x32/apps/assistant.png
-install -p -m644 -D tools/assistant/tools/assistant/images/assistant-128.png $PKG/usr/share/icons/hicolor/128x128/apps/assistant.png
-# Designer icon
-install -p -m644 -D tools/designer/src/designer/images/designer.png $PKG/usr/share/icons/hicolor/128x128/apps/designer.png
-# Linguist icons
-for icon in tools/linguist/linguist/images/icons/linguist-*-32.png ; do
- size=$(echo $(basename ${icon}) | cut -d- -f2)
- install -p -m644 -D ${icon} $PKG/usr/share/icons/hicolor/${size}x${size}/apps/linguist.png
-done
-
-# And the .desktop files
-mkdir -p $PKG/usr/share/applications
-cat <<EOF > $PKG/usr/share/applications/designer.desktop
-[Desktop Entry]
-Name=Qt4 Designer
-GenericName=Interface Designer
-Comment=Design GUIs for Qt4 applications
-Exec=designer
-Icon=designer
-MimeType=application/x-designer;
-Terminal=false
-Encoding=UTF-8
-Type=Application
-Categories=Qt;Development;
-EOF
-cat <<EOF > $PKG/usr/share/applications/assistant.desktop
-[Desktop Entry]
-Name=Qt4 Assistant
-Comment=Shows Qt4 documentation and examples
-Exec=assistant
-Icon=assistant
-Terminal=false
-Encoding=UTF-8
-Type=Application
-Categories=Qt;Development;Documentation;
-EOF
-cat <<EOF > $PKG/usr/share/applications/linguist.desktop
-[Desktop Entry]
-Name=Qt4 Linguist
-Comment=Add translations to Qt4 applications
-Exec=linguist
-Icon=linguist
-MimeType=text/vnd.trolltech.linguist;application/x-linguist;
-Terminal=false
-Encoding=UTF-8
-Type=Application
-Categories=Qt;Development;
-EOF
-cat <<EOF > $PKG/usr/share/applications/qtconfig.desktop
-[Desktop Entry]
-Name=Qt4 Config
-Comment=Configure Qt4 behavior, styles, fonts
-Exec=qtconfig
-Icon=qt-logo
-Terminal=false
-Encoding=UTF-8
-Type=Application
-Categories=Qt;Settings;
-EOF
-
-# Add a documentation directory:
-mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
-cp -a *GPL_EXCEPTION* FAQ* INSTALL KNOWN* LICENSE* README* changes-* \
- $PKG/usr/doc/$PKGNAM-$VERSION
-if [ -d $PKG/usr/lib${LIBDIRSUFFIX}/qt/doc/html ]; then
- ( cd $PKG/usr/doc/$PKGNAM-$VERSION
- ln -sf /usr/lib${LIBDIRSUFFIX}/qt/doc/html .
- )
-fi
+# Remove intermediate qtwebkit package:
+rm -f $TMP/qtwebkit-${WEBKITVERSION}-${ARCH}-${WEBKITBUILD}.txz
-mkdir -p $PKG/install
-zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
-cat $CWD/slack-desc > $PKG/install/slack-desc
+# Upgrade system to the combined Qt/WebKit package:
+/sbin/upgradepkg --reinstall --install-new $TMP/qt-${QTVERSION}-${ARCH}-${QTBUILD}.txz
-cd $PKG
-/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+# Done.
diff --git a/source/l/qt/qt.fix.broken.gif.crash.diff b/source/l/qt/qt.fix.broken.gif.crash.diff
new file mode 100644
index 000000000..7f74d71f1
--- /dev/null
+++ b/source/l/qt/qt.fix.broken.gif.crash.diff
@@ -0,0 +1,16 @@
+--- ./src/gui/image/qgifhandler.cpp.orig 2014-04-10 13:37:12.000000000 -0500
++++ ./src/gui/image/qgifhandler.cpp 2014-04-25 13:42:48.468692269 -0500
+@@ -358,6 +358,13 @@
+ bits = image->bits();
+ memset(bits, 0, image->byteCount());
+ }
++
++ // Check if the previous attempt to create the image failed. If it
++ // did then the image is broken and we should give up.
++ if (image->isNull()) {
++ state = Error;
++ return -1;
++ }
+
+ disposePrevious(image);
+ disposed = false;
diff --git a/source/l/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff b/source/l/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff
new file mode 100644
index 000000000..6949bbfef
--- /dev/null
+++ b/source/l/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff
@@ -0,0 +1,63 @@
+Author: Jan-Marek Glogowski <glogow@fbihome.de>
+Date: Thu Mar 06 18:44:43 2014 +0100
+
+ Honor QEventLoop::ExcludeSocketNotifiers in glib event loop.
+
+ Implements QEventLoop::ExcludeSocketNotifiers in the same way
+ QEventLoop::X11ExcludeTimers is already implemented for the glib
+ event loop.
+
+--- qt4-x11-4.8.1.orig/src/corelib/kernel/qeventdispatcher_glib.cpp
++++ qt4-x11-4.8.1/src/corelib/kernel/qeventdispatcher_glib.cpp
+@@ -65,6 +65,7 @@ struct GPollFDWithQSocketNotifier
+ struct GSocketNotifierSource
+ {
+ GSource source;
++ QEventLoop::ProcessEventsFlags processEventsFlags;
+ QList<GPollFDWithQSocketNotifier *> pollfds;
+ };
+
+@@ -80,6 +81,9 @@ static gboolean socketNotifierSourceChec
+ GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
+
+ bool pending = false;
++ if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
++ return pending;
++
+ for (int i = 0; !pending && i < src->pollfds.count(); ++i) {
+ GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
+
+@@ -103,6 +107,9 @@ static gboolean socketNotifierSourceDisp
+ QEvent event(QEvent::SockAct);
+
+ GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
++ if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
++ return true;
++
+ for (int i = 0; i < src->pollfds.count(); ++i) {
+ GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
+
+@@ -330,6 +337,7 @@ QEventDispatcherGlibPrivate::QEventDispa
+ reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs,
+ sizeof(GSocketNotifierSource)));
+ (void) new (&socketNotifierSource->pollfds) QList<GPollFDWithQSocketNotifier *>();
++ socketNotifierSource->processEventsFlags = QEventLoop::AllEvents;
+ g_source_set_can_recurse(&socketNotifierSource->source, true);
+ g_source_attach(&socketNotifierSource->source, mainContext);
+
+@@ -415,6 +423,7 @@ bool QEventDispatcherGlib::processEvents
+ // tell postEventSourcePrepare() and timerSource about any new flags
+ QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
+ d->timerSource->processEventsFlags = flags;
++ d->socketNotifierSource->processEventsFlags = flags;
+
+ if (!(flags & QEventLoop::EventLoopExec)) {
+ // force timers to be sent at normal priority
+@@ -426,6 +435,7 @@ bool QEventDispatcherGlib::processEvents
+ result = g_main_context_iteration(d->mainContext, canWait);
+
+ d->timerSource->processEventsFlags = savedFlags;
++ d->socketNotifierSource->processEventsFlags = savedFlags;
+
+ if (canWait)
+ emit awake();
diff --git a/source/l/qt/qt.ld-gold.patch b/source/l/qt/qt.ld-gold.patch
deleted file mode 100644
index 0e3897e98..000000000
--- a/source/l/qt/qt.ld-gold.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -up qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/common.pri.me qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/common.pri
---- qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/common.pri.me 2012-01-24 13:05:50.460890750 +0100
-+++ qt-everywhere-opensource-src-4.8.0/src/3rdparty/webkit/Source/common.pri 2012-01-24 13:19:08.836799974 +0100
-@@ -3,12 +3,12 @@
- contains(JAVASCRIPTCORE_JIT,yes): DEFINES+=ENABLE_JIT=1
- contains(JAVASCRIPTCORE_JIT,no): DEFINES+=ENABLE_JIT=0
-
--linux-g++ {
--isEmpty($$(SBOX_DPKG_INST_ARCH)):exists(/usr/bin/ld.gold) {
-- message(Using gold linker)
-- QMAKE_LFLAGS+=-fuse-ld=gold
--}
--}
-+#linux-g++ {
-+#isEmpty($$(SBOX_DPKG_INST_ARCH)):exists(/usr/bin/ld.gold) {
-+# message(Using gold linker)
-+# QMAKE_LFLAGS+=-fuse-ld=gold
-+#}
-+#}
-
- # We use this flag on production branches
- # See https://bugs.webkit.org/show_bug.cgi?id=60824
diff --git a/source/l/qt/qt.qclipboard_delay.patch b/source/l/qt/qt.qclipboard_delay.patch
new file mode 100644
index 000000000..dcdf51c00
--- /dev/null
+++ b/source/l/qt/qt.qclipboard_delay.patch
@@ -0,0 +1,12 @@
+--- a/src/gui/kernel/qclipboard_x11.cpp.sav 2014-04-25 09:52:03.855693228 +0200
++++ b/src/gui/kernel/qclipboard_x11.cpp 2014-04-25 09:51:58.038693777 +0200
+@@ -548,7 +548,8 @@ bool QX11Data::clipboardWaitForEvent(Win
+ return false;
+
+ XSync(X11->display, false);
+- usleep(50000);
++ if (!XPending(X11->display))
++ usleep(5000);
+
+ now.start();
+
diff --git a/source/l/qt/qt.qclipboard_fix_recursive.patch b/source/l/qt/qt.qclipboard_fix_recursive.patch
new file mode 100644
index 000000000..d9fe24b7f
--- /dev/null
+++ b/source/l/qt/qt.qclipboard_fix_recursive.patch
@@ -0,0 +1,94 @@
+--- a/src/corelib/kernel/qeventdispatcher_glib.cpp.sav 2014-03-28 15:26:37.000000000 +0100
++++ b/src/corelib/kernel/qeventdispatcher_glib.cpp 2014-04-24 09:44:09.358659204 +0200
+@@ -255,22 +255,30 @@ struct GPostEventSource
+ GSource source;
+ QAtomicInt serialNumber;
+ int lastSerialNumber;
++ QEventLoop::ProcessEventsFlags processEventsFlags;
+ QEventDispatcherGlibPrivate *d;
+ };
+
+ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
+ {
++ GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
+ QThreadData *data = QThreadData::current();
+ if (!data)
+ return false;
+
++ QEventLoop::ProcessEventsFlags excludeAllFlags
++ = QEventLoop::ExcludeUserInputEvents
++ | QEventLoop::ExcludeSocketNotifiers
++ | QEventLoop::X11ExcludeTimers;
++ if ((source->processEventsFlags & excludeAllFlags) == excludeAllFlags)
++ return false;
++
+ gint dummy;
+ if (!timeout)
+ timeout = &dummy;
+ const bool canWait = data->canWaitLocked();
+ *timeout = canWait ? -1 : 0;
+
+- GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
+ return (!canWait
+ || (source->serialNumber != source->lastSerialNumber));
+ }
+@@ -284,8 +292,14 @@ static gboolean postEventSourceDispatch(
+ {
+ GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
+ source->lastSerialNumber = source->serialNumber;
+- QCoreApplication::sendPostedEvents();
+- source->d->runTimersOnceWithNormalPriority();
++ QEventLoop::ProcessEventsFlags excludeAllFlags
++ = QEventLoop::ExcludeUserInputEvents
++ | QEventLoop::ExcludeSocketNotifiers
++ | QEventLoop::X11ExcludeTimers;
++ if ((source->processEventsFlags & excludeAllFlags) != excludeAllFlags) {
++ QCoreApplication::sendPostedEvents();
++ source->d->runTimersOnceWithNormalPriority();
++ }
+ return true; // i dunno, george...
+ }
+
+@@ -329,6 +343,7 @@ QEventDispatcherGlibPrivate::QEventDispa
+ postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
+ sizeof(GPostEventSource)));
+ postEventSource->serialNumber = 1;
++ postEventSource->processEventsFlags = QEventLoop::AllEvents;
+ postEventSource->d = this;
+ g_source_set_can_recurse(&postEventSource->source, true);
+ g_source_attach(&postEventSource->source, mainContext);
+@@ -423,6 +438,7 @@ bool QEventDispatcherGlib::processEvents
+
+ // tell postEventSourcePrepare() and timerSource about any new flags
+ QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
++ d->postEventSource->processEventsFlags = flags;
+ d->timerSource->processEventsFlags = flags;
+ d->socketNotifierSource->processEventsFlags = flags;
+
+@@ -435,6 +451,7 @@ bool QEventDispatcherGlib::processEvents
+ while (!result && canWait)
+ result = g_main_context_iteration(d->mainContext, canWait);
+
++ d->postEventSource->processEventsFlags = savedFlags;
+ d->timerSource->processEventsFlags = savedFlags;
+ d->socketNotifierSource->processEventsFlags = savedFlags;
+
+--- a/src/corelib/kernel/qeventdispatcher_unix.cpp.sav 2013-06-07 07:16:52.000000000 +0200
++++ b/src/corelib/kernel/qeventdispatcher_unix.cpp 2014-04-24 09:43:06.927589535 +0200
+@@ -905,7 +905,15 @@ bool QEventDispatcherUNIX::processEvents
+
+ // we are awake, broadcast it
+ emit awake();
+- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
++
++ QEventLoop::ProcessEventsFlags excludeAllFlags
++ = QEventLoop::ExcludeUserInputEvents
++ | QEventLoop::ExcludeSocketNotifiers
++ | QEventLoop::X11ExcludeTimers;
++ if ((flags & excludeAllFlags) == excludeAllFlags)
++ return false;
++ if(( flags & excludeAllFlags ) != excludeAllFlags )
++ QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+
+ int nevents = 0;
+ const bool canWait = (d->threadData->canWaitLocked()
diff --git a/source/l/qt/qt.qsystemtrayicon-plugin-system.diff b/source/l/qt/qt.qsystemtrayicon-plugin-system.diff
new file mode 100644
index 000000000..2466a16b4
--- /dev/null
+++ b/source/l/qt/qt.qsystemtrayicon-plugin-system.diff
@@ -0,0 +1,1466 @@
+Description: Introduce a plugin system for QSystemTrayIcon.
+ Designed to be used with sni-qt (https://launchpad.net/sni-qt)
+Author: agateau@kde.org
+Forwarded: no
+
+Introduce a plugin system for QSystemTrayIcon. Designed to be used with sni-qt
+(https://launchpad.net/sni-qt)
+---
+ examples/desktop/systray/window.cpp | 40 ++
+ examples/desktop/systray/window.h | 6
+ src/gui/util/qabstractsystemtrayiconsys.cpp | 65 +++
+ src/gui/util/qabstractsystemtrayiconsys_p.h | 106 ++++++
+ src/gui/util/qsystemtrayicon.cpp | 6
+ src/gui/util/qsystemtrayicon_p.h | 85 ++---
+ src/gui/util/qsystemtrayicon_x11.cpp | 356 ++++-----------------
+ src/gui/util/qxembedsystemtrayicon_x11.cpp | 469 ++++++++++++++++++++++++++++
+ src/gui/util/qxembedsystemtrayicon_x11_p.h | 104 ++++++
+ src/gui/util/util.pri | 7
+ 10 files changed, 916 insertions(+), 328 deletions(-)
+
+--- a/examples/desktop/systray/window.cpp
++++ b/examples/desktop/systray/window.cpp
+@@ -158,15 +158,23 @@
+ iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad"));
+ iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart"));
+ iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash"));
++ iconComboBox->addItem(QIcon::fromTheme("system-file-manager"), tr("File Manager"));
+
+ showIconCheckBox = new QCheckBox(tr("Show icon"));
+ showIconCheckBox->setChecked(true);
+
++#if defined(Q_WS_X11)
++ jitToolTipCheckBox = new QCheckBox(tr("Just In Time Tooltip"));
++#endif
++
+ QHBoxLayout *iconLayout = new QHBoxLayout;
+ iconLayout->addWidget(iconLabel);
+ iconLayout->addWidget(iconComboBox);
+ iconLayout->addStretch();
+ iconLayout->addWidget(showIconCheckBox);
++#if defined(Q_WS_X11)
++ iconLayout->addWidget(jitToolTipCheckBox);
++#endif
+ iconGroupBox->setLayout(iconLayout);
+ }
+
+@@ -254,5 +262,37 @@
+ trayIconMenu->addAction(quitAction);
+
+ trayIcon = new QSystemTrayIcon(this);
++ QByteArray category = qgetenv("SNI_CATEGORY");
++ if (!category.isEmpty()) {
++ trayIcon->setProperty("_qt_sni_category", QString::fromLocal8Bit(category));
++ }
+ trayIcon->setContextMenu(trayIconMenu);
++
++#if defined(Q_WS_X11)
++ trayIcon->installEventFilter(this);
++#endif
++}
++
++#if defined(Q_WS_X11)
++bool Window::eventFilter(QObject *, QEvent *event)
++{
++ switch(event->type()) {
++ case QEvent::ToolTip:
++ if (jitToolTipCheckBox->isChecked()) {
++ QString timeString = QTime::currentTime().toString();
++ trayIcon->setToolTip(tr("Current Time: %1").arg(timeString));
++ }
++ break;
++ case QEvent::Wheel: {
++ QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
++ int delta = wheelEvent->delta() > 0 ? 1 : -1;
++ int index = (iconComboBox->currentIndex() + delta) % iconComboBox->count();
++ iconComboBox->setCurrentIndex(index);
++ break;
++ }
++ default:
++ break;
++ }
++ return false;
+ }
++#endif
+--- a/examples/desktop/systray/window.h
++++ b/examples/desktop/systray/window.h
+@@ -69,6 +69,9 @@
+
+ protected:
+ void closeEvent(QCloseEvent *event);
++#if defined(Q_WS_X11)
++ bool eventFilter(QObject *object, QEvent *event);
++#endif
+
+ private slots:
+ void setIcon(int index);
+@@ -86,6 +89,9 @@
+ QLabel *iconLabel;
+ QComboBox *iconComboBox;
+ QCheckBox *showIconCheckBox;
++#if defined(Q_WS_X11)
++ QCheckBox *jitToolTipCheckBox;
++#endif
+
+ QGroupBox *messageGroupBox;
+ QLabel *typeLabel;
+--- /dev/null
++++ b/src/gui/util/qabstractsystemtrayiconsys.cpp
+@@ -0,0 +1,65 @@
++/****************************************************************************
++**
++** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
++** All rights reserved.
++** Contact: Nokia Corporation (qt-info@nokia.com)
++**
++** This file is part of the QtGui module of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** GNU Lesser General Public License Usage
++** This file may be used under the terms of the GNU Lesser General Public
++** License version 2.1 as published by the Free Software Foundation and
++** appearing in the file LICENSE.LGPL included in the packaging of this
++** file. Please review the following information to ensure the GNU Lesser
++** General Public License version 2.1 requirements will be met:
++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** In addition, as a special exception, Nokia gives you certain additional
++** rights. These rights are described in the Nokia Qt LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU General
++** Public License version 3.0 as published by the Free Software Foundation
++** and appearing in the file LICENSE.GPL included in the packaging of this
++** file. Please review the following information to ensure the GNU General
++** Public License version 3.0 requirements will be met:
++** http://www.gnu.org/copyleft/gpl.html.
++**
++** Other Usage
++** Alternatively, this file may be used in accordance with the terms and
++** conditions contained in a signed written agreement between you and Nokia.
++**
++**
++**
++**
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++#ifndef QT_NO_SYSTEMTRAYICON
++
++#include "qabstractsystemtrayiconsys_p.h"
++
++
++QSystemTrayIconSysFactoryInterface::QSystemTrayIconSysFactoryInterface()
++{
++}
++
++/////////////////////////////////////////////////
++QAbstractSystemTrayIconSys::QAbstractSystemTrayIconSys(QSystemTrayIcon *icon)
++: trayIcon(icon)
++{
++}
++
++QAbstractSystemTrayIconSys::~QAbstractSystemTrayIconSys()
++{
++}
++
++void QAbstractSystemTrayIconSys::sendActivated(QSystemTrayIcon::ActivationReason reason)
++{
++ qtsystray_sendActivated(trayIcon, reason);
++}
++
++#endif
+--- /dev/null
++++ b/src/gui/util/qabstractsystemtrayiconsys_p.h
+@@ -0,0 +1,106 @@
++/****************************************************************************
++**
++** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
++** All rights reserved.
++** Contact: Nokia Corporation (qt-info@nokia.com)
++**
++** This file is part of the QtGui module of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** GNU Lesser General Public License Usage
++** This file may be used under the terms of the GNU Lesser General Public
++** License version 2.1 as published by the Free Software Foundation and
++** appearing in the file LICENSE.LGPL included in the packaging of this
++** file. Please review the following information to ensure the GNU Lesser
++** General Public License version 2.1 requirements will be met:
++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** In addition, as a special exception, Nokia gives you certain additional
++** rights. These rights are described in the Nokia Qt LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU General
++** Public License version 3.0 as published by the Free Software Foundation
++** and appearing in the file LICENSE.GPL included in the packaging of this
++** file. Please review the following information to ensure the GNU General
++** Public License version 3.0 requirements will be met:
++** http://www.gnu.org/copyleft/gpl.html.
++**
++** Other Usage
++** Alternatively, this file may be used in accordance with the terms and
++** conditions contained in a signed written agreement between you and Nokia.
++**
++**
++**
++**
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++#ifndef QABSTRACTSYSTEMTRAYICONSYS_P_H
++#define QABSTRACTSYSTEMTRAYICONSYS_P_H
++
++//
++// W A R N I N G
++// -------------
++//
++// This file is not part of the Qt API. It exists for the convenience
++// of a number of Qt sources files. This header file may change from
++// version to version without notice, or even be removed.
++//
++// We mean it.
++//
++
++#ifndef QT_NO_SYSTEMTRAYICON
++
++#include <qfactoryinterface.h>
++#include <qsystemtrayicon.h>
++
++class QAbstractSystemTrayIconSys;
++
++class Q_GUI_EXPORT QSystemTrayIconSysFactoryInterface : public QObject, public QFactoryInterface
++{
++ Q_OBJECT
++public:
++ QSystemTrayIconSysFactoryInterface();
++ virtual QAbstractSystemTrayIconSys * create(QSystemTrayIcon *) = 0;
++ virtual bool isAvailable() const = 0;
++
++ // \reimp
++ virtual QStringList keys() const { return QStringList() << QLatin1String("default"); }
++
++Q_SIGNALS:
++ void availableChanged(bool);
++};
++
++#define QSystemTrayIconSysFactoryInterface_iid "com.nokia.qt.QSystemTrayIconSysFactoryInterface"
++Q_DECLARE_INTERFACE(QSystemTrayIconSysFactoryInterface, QSystemTrayIconSysFactoryInterface_iid)
++
++class QRect;
++
++class Q_GUI_EXPORT QAbstractSystemTrayIconSys
++{
++public:
++ QAbstractSystemTrayIconSys(QSystemTrayIcon *icon);
++ virtual ~QAbstractSystemTrayIconSys();
++
++ virtual QRect geometry() const = 0;
++ virtual void updateVisibility() = 0;
++ virtual void updateIcon() = 0;
++ virtual void updateToolTip() = 0;
++ virtual void updateMenu() = 0;
++ virtual void showMessage(const QString &title, const QString &message,
++ QSystemTrayIcon::MessageIcon icon, int msecs) = 0;
++
++ void sendActivated(QSystemTrayIcon::ActivationReason);
++
++protected:
++ QSystemTrayIcon *trayIcon;
++};
++
++#endif // QT_NO_SYSTEMTRAYICON
++
++#endif // QABSTRACTSYSTEMTRAYICONSYS_P_H
++
+--- a/src/gui/util/qsystemtrayicon.cpp
++++ b/src/gui/util/qsystemtrayicon.cpp
+@@ -287,12 +287,6 @@
+ */
+ bool QSystemTrayIcon::event(QEvent *e)
+ {
+-#if defined(Q_WS_X11)
+- if (e->type() == QEvent::ToolTip) {
+- Q_D(QSystemTrayIcon);
+- return d->sys->deliverToolTipEvent(e);
+- }
+-#endif
+ return QObject::event(e);
+ }
+
+--- a/src/gui/util/qsystemtrayicon_p.h
++++ b/src/gui/util/qsystemtrayicon_p.h
+@@ -62,10 +62,17 @@
+ #include "QtGui/qpixmap.h"
+ #include "QtCore/qstring.h"
+ #include "QtCore/qpointer.h"
++#if defined(Q_WS_X11)
++#include "QtCore/qset.h"
++#endif
+
+ QT_BEGIN_NAMESPACE
+
++#if defined(Q_WS_X11)
++class QAbstractSystemTrayIconSys;
++#else
+ class QSystemTrayIconSys;
++#endif
+ class QToolButton;
+ class QLabel;
+
+@@ -75,6 +82,9 @@
+
+ public:
+ QSystemTrayIconPrivate() : sys(0), visible(false) { }
++ #if defined(Q_WS_X11)
++ ~QSystemTrayIconPrivate();
++ #endif
+
+ void install_sys();
+ void remove_sys();
+@@ -90,7 +100,11 @@
+ QPointer<QMenu> menu;
+ QIcon icon;
+ QString toolTip;
++ #if defined(Q_WS_X11)
++ QAbstractSystemTrayIconSys *sys;
++ #else
+ QSystemTrayIconSys *sys;
++ #endif
+ bool visible;
+ };
+
+@@ -123,60 +137,37 @@
+ };
+
+ #if defined(Q_WS_X11)
+-QT_BEGIN_INCLUDE_NAMESPACE
+-#include <QtCore/qcoreapplication.h>
+-#include <X11/Xlib.h>
+-#include <X11/Xatom.h>
+-#include <X11/Xutil.h>
+-QT_END_INCLUDE_NAMESPACE
++class QSystemTrayIconSysFactoryInterface;
+
+-class QSystemTrayIconSys : public QWidget
++/**
++ * This class acts as a composite QSystemTrayIconSysFactory: It can create
++ * instances of QAbstractSystemTrayIconSys* using either a plugin or the
++ * builtin factory and will cause QSystemTrayIconPrivate to recreate their
++ * 'sys' instances if the plugin availability changes.
++ */
++class QSystemTrayIconSysFactory : public QObject
+ {
+- friend class QSystemTrayIconPrivate;
+-
++ Q_OBJECT
+ public:
+- QSystemTrayIconSys(QSystemTrayIcon *q);
+- ~QSystemTrayIconSys();
+- enum {
+- SYSTEM_TRAY_REQUEST_DOCK = 0,
+- SYSTEM_TRAY_BEGIN_MESSAGE = 1,
+- SYSTEM_TRAY_CANCEL_MESSAGE =2
+- };
+-
+- void addToTray();
+- void updateIcon();
+- XVisualInfo* getSysTrayVisualInfo();
+-
+- // QObject::event is public but QWidget's ::event() re-implementation
+- // is protected ;(
+- inline bool deliverToolTipEvent(QEvent *e)
+- { return QWidget::event(e); }
+-
+- static Window sysTrayWindow;
+- static QList<QSystemTrayIconSys *> trayIcons;
+- static QCoreApplication::EventFilter oldEventFilter;
+- static bool sysTrayTracker(void *message, long *result);
+- static Window locateSystemTray();
+- static Atom sysTraySelection;
+- static XVisualInfo sysTrayVisual;
++ QSystemTrayIconSysFactory();
++ void registerSystemTrayIconPrivate(QSystemTrayIconPrivate *iconPrivate);
++ void unregisterSystemTrayIconPrivate(QSystemTrayIconPrivate *iconPrivate);
+
+-protected:
+- void paintEvent(QPaintEvent *pe);
+- void resizeEvent(QResizeEvent *re);
+- bool x11Event(XEvent *event);
+- void mousePressEvent(QMouseEvent *event);
+- void mouseDoubleClickEvent(QMouseEvent *event);
+-#ifndef QT_NO_WHEELEVENT
+- void wheelEvent(QWheelEvent *event);
+-#endif
+- bool event(QEvent *e);
++ QAbstractSystemTrayIconSys *create(QSystemTrayIcon *) const;
++
++ bool isAvailable() const;
++
++private Q_SLOTS:
++ void refreshTrayIconPrivates();
+
+ private:
+- QPixmap background;
+- QSystemTrayIcon *q;
+- Colormap colormap;
++ QSystemTrayIconSysFactoryInterface *factory() const;
++ void loadPluginFactory();
++
++ QSystemTrayIconSysFactoryInterface *pluginFactory;
++ QSet<QSystemTrayIconPrivate *> trayIconPrivates;
+ };
+-#endif // Q_WS_X11
++#endif
+
+ QT_END_NAMESPACE
+
+--- a/src/gui/util/qsystemtrayicon_x11.cpp
++++ b/src/gui/util/qsystemtrayicon_x11.cpp
+@@ -38,311 +38,122 @@
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
++#ifndef QT_NO_SYSTEMTRAYICON
++
++#include <private/qfactoryloader_p.h>
+
+-#include "private/qt_x11_p.h"
+-#include "qlabel.h"
+-#include "qx11info_x11.h"
+-#include "qpainter.h"
+-#include "qpixmap.h"
+-#include "qbitmap.h"
+-#include "qevent.h"
+-#include "qapplication.h"
+-#include "qlist.h"
+-#include "qmenu.h"
+-#include "qtimer.h"
+ #include "qsystemtrayicon_p.h"
+-#include "qpaintengine.h"
++#include "qabstractsystemtrayiconsys_p.h"
++#include "qcoreapplication.h"
++#include "qxembedsystemtrayicon_x11_p.h"
+
+-#ifndef QT_NO_SYSTEMTRAYICON
+ QT_BEGIN_NAMESPACE
+
+-Window QSystemTrayIconSys::sysTrayWindow = XNone;
+-QList<QSystemTrayIconSys *> QSystemTrayIconSys::trayIcons;
+-QCoreApplication::EventFilter QSystemTrayIconSys::oldEventFilter = 0;
+-Atom QSystemTrayIconSys::sysTraySelection = XNone;
+-XVisualInfo QSystemTrayIconSys::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+-
+-// Locate the system tray
+-Window QSystemTrayIconSys::locateSystemTray()
+-{
+- Display *display = QX11Info::display();
+- if (sysTraySelection == XNone) {
+- int screen = QX11Info::appScreen();
+- QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
+- sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
+- }
+-
+- return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
+-}
++Q_GLOBAL_STATIC(QSystemTrayIconSysFactory, qt_guiSystemTrayIconSysFactory)
+
+-XVisualInfo* QSystemTrayIconSys::getSysTrayVisualInfo()
++QSystemTrayIconSysFactory::QSystemTrayIconSysFactory()
++: pluginFactory(0)
+ {
+- Display *display = QX11Info::display();
+-
+- if (!sysTrayVisual.visual) {
+- Window win = locateSystemTray();
+- if (win != XNone) {
+- Atom actual_type;
+- int actual_format;
+- ulong nitems, bytes_remaining;
+- uchar *data = 0;
+- int result = XGetWindowProperty(display, win, ATOM(_NET_SYSTEM_TRAY_VISUAL), 0, 1,
+- False, XA_VISUALID, &actual_type,
+- &actual_format, &nitems, &bytes_remaining, &data);
+- VisualID vid = 0;
+- if (result == Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
+- nitems == 1 && bytes_remaining == 0)
+- vid = *(VisualID*)data;
+- if (data)
+- XFree(data);
+- if (vid == 0)
+- return 0;
+-
+- uint mask = VisualIDMask;
+- XVisualInfo *vi, rvi;
+- int count;
+- rvi.visualid = vid;
+- vi = XGetVisualInfo(display, mask, &rvi, &count);
+- if (vi) {
+- sysTrayVisual = vi[0];
+- XFree((char*)vi);
+- }
+- if (sysTrayVisual.depth != 32)
+- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
+- }
+- }
+-
+- return sysTrayVisual.visual ? &sysTrayVisual : 0;
+ }
+
+-bool QSystemTrayIconSys::sysTrayTracker(void *message, long *result)
++void QSystemTrayIconSysFactory::loadPluginFactory()
+ {
+- bool retval = false;
+- if (QSystemTrayIconSys::oldEventFilter)
+- retval = QSystemTrayIconSys::oldEventFilter(message, result);
+-
+- if (trayIcons.isEmpty())
+- return retval;
+-
+- Display *display = QX11Info::display();
+- XEvent *ev = (XEvent *)message;
+- if (ev->type == DestroyNotify && ev->xany.window == sysTrayWindow) {
+- sysTrayWindow = locateSystemTray();
+- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
+- for (int i = 0; i < trayIcons.count(); i++) {
+- if (sysTrayWindow == XNone) {
+- QBalloonTip::hideBalloon();
+- trayIcons[i]->hide(); // still no luck
+- trayIcons[i]->destroy();
+- trayIcons[i]->create();
+- } else
+- trayIcons[i]->addToTray(); // add it to the new tray
+- }
+- retval = true;
+- } else if (ev->type == ClientMessage && sysTrayWindow == XNone) {
+- static Atom manager_atom = XInternAtom(display, "MANAGER", False);
+- XClientMessageEvent *cm = (XClientMessageEvent *)message;
+- if ((cm->message_type == manager_atom) && ((Atom)cm->data.l[1] == sysTraySelection)) {
+- sysTrayWindow = cm->data.l[2];
+- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
+- XSelectInput(display, sysTrayWindow, StructureNotifyMask);
+- for (int i = 0; i < trayIcons.count(); i++) {
+- trayIcons[i]->addToTray();
+- }
+- retval = true;
+- }
+- } else if (ev->type == PropertyNotify && ev->xproperty.atom == ATOM(_NET_SYSTEM_TRAY_VISUAL) &&
+- ev->xproperty.window == sysTrayWindow) {
+- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
+- for (int i = 0; i < trayIcons.count(); i++) {
+- trayIcons[i]->addToTray();
+- }
+- }
+-
+- return retval;
+-}
+-
+-QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *q)
+- : QWidget(0, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint),
+- q(q), colormap(0)
+-{
+- setAttribute(Qt::WA_AlwaysShowToolTips);
+- setAttribute(Qt::WA_QuitOnClose, false);
+- setAttribute(Qt::WA_NoSystemBackground, true);
+- setAttribute(Qt::WA_PaintOnScreen);
+-
+- static bool eventFilterAdded = false;
+- Display *display = QX11Info::display();
+- if (!eventFilterAdded) {
+- oldEventFilter = qApp->setEventFilter(sysTrayTracker);
+- eventFilterAdded = true;
+- Window root = QX11Info::appRootWindow();
+- XWindowAttributes attr;
+- XGetWindowAttributes(display, root, &attr);
+- if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
+- (void) QApplication::desktop(); // lame trick to ensure our event mask is not overridden
+- XSelectInput(display, root, attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
+- }
++ if (pluginFactory) {
++ return;
+ }
+- if (trayIcons.isEmpty()) {
+- sysTrayWindow = locateSystemTray();
+- if (sysTrayWindow != XNone)
+- XSelectInput(display, sysTrayWindow, StructureNotifyMask); // track tray events
++#ifndef QT_NO_LIBRARY
++ QFactoryLoader loader(QSystemTrayIconSysFactoryInterface_iid, QLatin1String("/systemtrayicon"));
++ pluginFactory = qobject_cast<QSystemTrayIconSysFactoryInterface *>(loader.instance(QLatin1String("default")));
++ if (pluginFactory) {
++ // Set parent to ensure factory destructor is called when application
++ // is closed
++ pluginFactory->setParent(QCoreApplication::instance());
++ connect(pluginFactory, SIGNAL(availableChanged(bool)), SLOT(refreshTrayIconPrivates()));
+ }
+- trayIcons.append(this);
+- setMouseTracking(true);
+-#ifndef QT_NO_TOOLTIP
+- setToolTip(q->toolTip());
+-#endif
+- if (sysTrayWindow != XNone)
+- addToTray();
++#endif // QT_NO_LIBRARY
+ }
+
+-QSystemTrayIconSys::~QSystemTrayIconSys()
++QSystemTrayIconSysFactoryInterface *QSystemTrayIconSysFactory::factory() const
+ {
+- trayIcons.removeAt(trayIcons.indexOf(this));
+- Display *display = QX11Info::display();
+- if (trayIcons.isEmpty()) {
+- if (sysTrayWindow == XNone)
+- return;
+- if (display)
+- XSelectInput(display, sysTrayWindow, 0); // stop tracking the tray
+- sysTrayWindow = XNone;
++ if (!pluginFactory) {
++ const_cast<QSystemTrayIconSysFactory*>(this)->loadPluginFactory();
+ }
+- if (colormap)
+- XFreeColormap(display, colormap);
++ if (pluginFactory && pluginFactory->isAvailable()) {
++ return pluginFactory;
++ }
++ static QXEmbedSystemTrayIconSysFactory def;
++ return def.isAvailable() ? &def : 0;
+ }
+
+-void QSystemTrayIconSys::addToTray()
++void QSystemTrayIconSysFactory::refreshTrayIconPrivates()
+ {
+- Q_ASSERT(sysTrayWindow != XNone);
+- Display *display = QX11Info::display();
+-
+- XVisualInfo *vi = getSysTrayVisualInfo();
+- if (vi && vi->visual) {
+- Window root = RootWindow(display, vi->screen);
+- Window p = root;
+- if (QWidget *pw = parentWidget())
+- p = pw->effectiveWinId();
+- colormap = XCreateColormap(display, root, vi->visual, AllocNone);
+- XSetWindowAttributes wsa;
+- wsa.background_pixmap = 0;
+- wsa.colormap = colormap;
+- wsa.background_pixel = 0;
+- wsa.border_pixel = 0;
+- Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
+- 0, vi->depth, InputOutput, vi->visual,
+- CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa);
+- create(wid);
+- } else {
+- XSetWindowBackgroundPixmap(display, winId(), ParentRelative);
+- }
+-
+- // GNOME, NET WM Specification
+- static Atom netwm_tray_atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False);
+- long l[5] = { CurrentTime, SYSTEM_TRAY_REQUEST_DOCK, static_cast<long>(winId()), 0, 0 };
+- XEvent ev;
+- memset(&ev, 0, sizeof(ev));
+- ev.xclient.type = ClientMessage;
+- ev.xclient.window = sysTrayWindow;
+- ev.xclient.message_type = netwm_tray_atom;
+- ev.xclient.format = 32;
+- memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l));
+- XSendEvent(display, sysTrayWindow, False, 0, &ev);
+- setMinimumSize(22, 22); // required at least on GNOME
+-}
+-
+-void QSystemTrayIconSys::updateIcon()
+-{
+- update();
+-}
+-
+-void QSystemTrayIconSys::resizeEvent(QResizeEvent *re)
+-{
+- QWidget::resizeEvent(re);
+- updateIcon();
+-}
+-
+-void QSystemTrayIconSys::paintEvent(QPaintEvent*)
+-{
+- QPainter p(this);
+- if (!getSysTrayVisualInfo()) {
+- const QRegion oldSystemClip = p.paintEngine()->systemClip();
+- const QRect clearedRect = oldSystemClip.boundingRect();
+- XClearArea(QX11Info::display(), winId(), clearedRect.x(), clearedRect.y(),
+- clearedRect.width(), clearedRect.height(), False);
+- QPaintEngine *pe = p.paintEngine();
+- pe->setSystemClip(clearedRect);
+- q->icon().paint(&p, rect());
+- pe->setSystemClip(oldSystemClip);
+- } else {
+- p.setCompositionMode(QPainter::CompositionMode_Source);
+- p.fillRect(rect(), Qt::transparent);
+- p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+- q->icon().paint(&p, rect());
++ Q_FOREACH(QSystemTrayIconPrivate *trayIconPrivate, trayIconPrivates) {
++ if (trayIconPrivate->sys) {
++ delete trayIconPrivate->sys;
++ trayIconPrivate->sys = 0;
++ }
++ // When visible is true, sys is usually not 0 but it can be 0 if the
++ // call to install_sys() failed.
++ if (trayIconPrivate->visible) {
++ trayIconPrivate->install_sys();
++ }
+ }
+ }
+
+-void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
++void QSystemTrayIconSysFactory::registerSystemTrayIconPrivate(QSystemTrayIconPrivate* trayIconPrivate)
+ {
+- QPoint globalPos = ev->globalPos();
+- if (ev->button() == Qt::RightButton && q->contextMenu())
+- q->contextMenu()->popup(globalPos);
+-
+- if (QBalloonTip::isBalloonVisible()) {
+- emit q->messageClicked();
+- QBalloonTip::hideBalloon();
+- }
+-
+- if (ev->button() == Qt::LeftButton)
+- emit q->activated(QSystemTrayIcon::Trigger);
+- else if (ev->button() == Qt::RightButton)
+- emit q->activated(QSystemTrayIcon::Context);
+- else if (ev->button() == Qt::MidButton)
+- emit q->activated(QSystemTrayIcon::MiddleClick);
++ trayIconPrivates.insert(trayIconPrivate);
+ }
+
+-void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev)
++void QSystemTrayIconSysFactory::unregisterSystemTrayIconPrivate(QSystemTrayIconPrivate* trayIconPrivate)
+ {
+- if (ev->button() == Qt::LeftButton)
+- emit q->activated(QSystemTrayIcon::DoubleClick);
++ trayIconPrivates.remove(trayIconPrivate);
+ }
+
+-#ifndef QT_NO_WHEELEVENT
+-void QSystemTrayIconSys::wheelEvent(QWheelEvent *e)
++QAbstractSystemTrayIconSys *QSystemTrayIconSysFactory::create(QSystemTrayIcon *trayIcon) const
+ {
+- QApplication::sendEvent(q, e);
++ QSystemTrayIconSysFactoryInterface *f = factory();
++ if (!f) {
++ qWarning("No systemtrayicon available");
++ return 0;
++ }
++ return f->create(trayIcon);
+ }
+-#endif
+
+-bool QSystemTrayIconSys::event(QEvent *e)
++bool QSystemTrayIconSysFactory::isAvailable() const
+ {
+- if (e->type() == QEvent::ToolTip) {
+- return QApplication::sendEvent(q, e);
+- }
+- return QWidget::event(e);
++ return factory();
+ }
+
+-bool QSystemTrayIconSys::x11Event(XEvent *event)
++////////////////////////////////////////////////
++QSystemTrayIconPrivate::~QSystemTrayIconPrivate()
+ {
+- if (event->type == ReparentNotify)
+- show();
+- return QWidget::x11Event(event);
++ qt_guiSystemTrayIconSysFactory()->unregisterSystemTrayIconPrivate(this);
++ delete sys;
+ }
+
+-////////////////////////////////////////////////////////////////////////////
+ void QSystemTrayIconPrivate::install_sys()
+ {
+ Q_Q(QSystemTrayIcon);
+- if (!sys)
+- sys = new QSystemTrayIconSys(q);
++ if (!sys) {
++ // Register ourself even if create() fails: our "sys" will get created
++ // later by refreshTrayIconPrivates() if a systemtray becomes
++ // available. This situation can happen for applications which are
++ // started at login time, while the desktop itself is starting up.
++ qt_guiSystemTrayIconSysFactory()->registerSystemTrayIconPrivate(this);
++ sys = qt_guiSystemTrayIconSysFactory()->create(q);
++ if (!sys) {
++ return;
++ }
++ }
++ sys->updateVisibility();
+ }
+
+ QRect QSystemTrayIconPrivate::geometry_sys() const
+ {
+- if (!sys)
+- return QRect();
+- return QRect(sys->mapToGlobal(QPoint(0, 0)), sys->size());
++ if (!sys || !visible)
++ return QRect();
++ return sys->geometry();
+ }
+
+ void QSystemTrayIconPrivate::remove_sys()
+@@ -350,35 +161,35 @@
+ if (!sys)
+ return;
+ QBalloonTip::hideBalloon();
+- sys->hide(); // this should do the trick, but...
+- delete sys; // wm may resize system tray only for DestroyEvents
+- sys = 0;
++ sys->updateVisibility();
+ }
+
+ void QSystemTrayIconPrivate::updateIcon_sys()
+ {
+- if (!sys)
++ if (!sys || !visible)
+ return;
+ sys->updateIcon();
+ }
+
+ void QSystemTrayIconPrivate::updateMenu_sys()
+ {
+-
++ if (!sys || !visible)
++ return;
++ sys->updateMenu();
+ }
+
+ void QSystemTrayIconPrivate::updateToolTip_sys()
+ {
+- if (!sys)
++ if (!sys || !visible)
+ return;
+ #ifndef QT_NO_TOOLTIP
+- sys->setToolTip(toolTip);
++ sys->updateToolTip();
+ #endif
+ }
+
+ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
+ {
+- return QSystemTrayIconSys::locateSystemTray() != XNone;
++ return qt_guiSystemTrayIconSysFactory()->isAvailable();
+ }
+
+ bool QSystemTrayIconPrivate::supportsMessages_sys()
+@@ -389,12 +200,9 @@
+ void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QString &title,
+ QSystemTrayIcon::MessageIcon icon, int msecs)
+ {
+- if (!sys)
++ if (!sys || !visible)
+ return;
+- QPoint g = sys->mapToGlobal(QPoint(0, 0));
+- QBalloonTip::showBalloon(icon, message, title, sys->q,
+- QPoint(g.x() + sys->width()/2, g.y() + sys->height()/2),
+- msecs);
++ sys->showMessage(message, title, icon, msecs);
+ }
+
+ QT_END_NAMESPACE
+--- /dev/null
++++ b/src/gui/util/qxembedsystemtrayicon_x11.cpp
+@@ -0,0 +1,469 @@
++/****************************************************************************
++**
++** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
++** All rights reserved.
++** Contact: Nokia Corporation (qt-info@nokia.com)
++**
++** This file is part of the QtGui module of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** GNU Lesser General Public License Usage
++** This file may be used under the terms of the GNU Lesser General Public
++** License version 2.1 as published by the Free Software Foundation and
++** appearing in the file LICENSE.LGPL included in the packaging of this
++** file. Please review the following information to ensure the GNU Lesser
++** General Public License version 2.1 requirements will be met:
++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** In addition, as a special exception, Nokia gives you certain additional
++** rights. These rights are described in the Nokia Qt LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU General
++** Public License version 3.0 as published by the Free Software Foundation
++** and appearing in the file LICENSE.GPL included in the packaging of this
++** file. Please review the following information to ensure the GNU General
++** Public License version 3.0 requirements will be met:
++** http://www.gnu.org/copyleft/gpl.html.
++**
++** Other Usage
++** Alternatively, this file may be used in accordance with the terms and
++** conditions contained in a signed written agreement between you and Nokia.
++**
++**
++**
++**
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++#include "qxembedsystemtrayicon_x11_p.h"
++
++#ifndef QT_NO_SYSTEMTRAYICON
++
++#include "private/qt_x11_p.h"
++#include "qapplication.h"
++#include "qevent.h"
++#include "qlist.h"
++#include "qmenu.h"
++#include "qpainter.h"
++#include "qpaintengine.h"
++#include "qsystemtrayicon_p.h"
++#include "qx11info_x11.h"
++
++QT_BEGIN_INCLUDE_NAMESPACE
++#include <QtCore/qcoreapplication.h>
++#include <X11/Xlib.h>
++#include <X11/Xatom.h>
++#include <X11/Xutil.h>
++QT_END_INCLUDE_NAMESPACE
++
++QT_BEGIN_NAMESPACE
++
++class QSystemTrayIconWidget : public QWidget
++{
++public:
++ QSystemTrayIconWidget(QSystemTrayIcon *q, QXEmbedSystemTrayIconSys *s);
++ ~QSystemTrayIconWidget();
++
++ static Window locateSystemTray();
++
++protected:
++ void paintEvent(QPaintEvent *pe);
++ void resizeEvent(QResizeEvent *re);
++ bool x11Event(XEvent *event);
++ void mousePressEvent(QMouseEvent *event);
++ void mouseDoubleClickEvent(QMouseEvent *event);
++#ifndef QT_NO_WHEELEVENT
++ void wheelEvent(QWheelEvent *event);
++#endif
++ bool event(QEvent *e);
++
++private:
++ enum {
++ SYSTEM_TRAY_REQUEST_DOCK = 0,
++ SYSTEM_TRAY_BEGIN_MESSAGE = 1,
++ SYSTEM_TRAY_CANCEL_MESSAGE =2
++ };
++
++ void addToTray();
++ static XVisualInfo* getSysTrayVisualInfo();
++
++ static Window sysTrayWindow;
++ static QList<QSystemTrayIconWidget *> trayIcons;
++ static QCoreApplication::EventFilter oldEventFilter;
++ static bool sysTrayTracker(void *message, long *result);
++ static Atom sysTraySelection;
++ static XVisualInfo sysTrayVisual;
++
++ QSystemTrayIcon *q;
++ QXEmbedSystemTrayIconSys *sys;
++ Colormap colormap;
++};
++
++Window QSystemTrayIconWidget::sysTrayWindow = XNone;
++QList<QSystemTrayIconWidget *> QSystemTrayIconWidget::trayIcons;
++QCoreApplication::EventFilter QSystemTrayIconWidget::oldEventFilter = 0;
++Atom QSystemTrayIconWidget::sysTraySelection = XNone;
++XVisualInfo QSystemTrayIconWidget::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
++
++QSystemTrayIconWidget::QSystemTrayIconWidget(QSystemTrayIcon* q, QXEmbedSystemTrayIconSys* sys)
++: QWidget(0, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint)
++, q(q)
++, sys(sys)
++, colormap(0)
++{
++ setAttribute(Qt::WA_AlwaysShowToolTips);
++ setAttribute(Qt::WA_QuitOnClose, false);
++ setAttribute(Qt::WA_NoSystemBackground, true);
++ setAttribute(Qt::WA_PaintOnScreen);
++ setMouseTracking(true);
++#ifndef QT_NO_TOOLTIP
++ setToolTip(q->toolTip());
++#endif
++
++ static bool eventFilterAdded = false;
++ Display *display = QX11Info::display();
++ if (!eventFilterAdded) {
++ oldEventFilter = qApp->setEventFilter(sysTrayTracker);
++ eventFilterAdded = true;
++ Window root = QX11Info::appRootWindow();
++ XWindowAttributes attr;
++ XGetWindowAttributes(display, root, &attr);
++ if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
++ (void) QApplication::desktop(); // lame trick to ensure our event mask is not overridden
++ XSelectInput(display, root, attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
++ }
++ }
++ if (trayIcons.isEmpty()) {
++ sysTrayWindow = locateSystemTray();
++ if (sysTrayWindow != XNone)
++ XSelectInput(display, sysTrayWindow, StructureNotifyMask); // track tray events
++ }
++ trayIcons.append(this);
++ if (sysTrayWindow != XNone)
++ addToTray();
++}
++
++QSystemTrayIconWidget::~QSystemTrayIconWidget()
++{
++ trayIcons.removeAt(trayIcons.indexOf(this));
++ Display *display = QX11Info::display();
++ if (trayIcons.isEmpty()) {
++ if (sysTrayWindow == XNone)
++ return;
++ if (display)
++ XSelectInput(display, sysTrayWindow, 0); // stop tracking the tray
++ sysTrayWindow = XNone;
++ }
++ if (colormap)
++ XFreeColormap(display, colormap);
++}
++
++void QSystemTrayIconWidget::resizeEvent(QResizeEvent *re)
++{
++ QWidget::resizeEvent(re);
++ update();
++}
++
++void QSystemTrayIconWidget::paintEvent(QPaintEvent*)
++{
++ QPainter p(this);
++ if (!getSysTrayVisualInfo()) {
++ const QRegion oldSystemClip = p.paintEngine()->systemClip();
++ const QRect clearedRect = oldSystemClip.boundingRect();
++ XClearArea(QX11Info::display(), winId(), clearedRect.x(), clearedRect.y(),
++ clearedRect.width(), clearedRect.height(), False);
++ QPaintEngine *pe = p.paintEngine();
++ pe->setSystemClip(clearedRect);
++ q->icon().paint(&p, rect());
++ pe->setSystemClip(oldSystemClip);
++ } else {
++ p.setCompositionMode(QPainter::CompositionMode_Source);
++ p.fillRect(rect(), Qt::transparent);
++ p.setCompositionMode(QPainter::CompositionMode_SourceOver);
++ q->icon().paint(&p, rect());
++ }
++}
++
++void QSystemTrayIconWidget::mousePressEvent(QMouseEvent *ev)
++{
++ QPoint globalPos = ev->globalPos();
++ if (ev->button() == Qt::RightButton && q->contextMenu())
++ q->contextMenu()->popup(globalPos);
++
++ if (QBalloonTip::isBalloonVisible()) {
++ QMetaObject::invokeMethod(q, "messageClicked");
++ QBalloonTip::hideBalloon();
++ }
++
++ if (ev->button() == Qt::LeftButton)
++ qtsystray_sendActivated(q, QSystemTrayIcon::Trigger);
++ else if (ev->button() == Qt::RightButton)
++ qtsystray_sendActivated(q, QSystemTrayIcon::Context);
++ else if (ev->button() == Qt::MidButton)
++ qtsystray_sendActivated(q, QSystemTrayIcon::MiddleClick);
++}
++
++void QSystemTrayIconWidget::mouseDoubleClickEvent(QMouseEvent *ev)
++{
++ if (ev->button() == Qt::LeftButton)
++ qtsystray_sendActivated(q, QSystemTrayIcon::DoubleClick);
++}
++
++#ifndef QT_NO_WHEELEVENT
++void QSystemTrayIconWidget::wheelEvent(QWheelEvent *e)
++{
++ sys->sendWheelEventToTrayIcon(e->delta(), e->orientation());
++}
++#endif
++
++bool QSystemTrayIconWidget::event(QEvent *e)
++{
++ if (e->type() == QEvent::ToolTip) {
++ sys->sendToolTipEventToTrayIcon();
++ }
++ return QWidget::event(e);
++}
++
++bool QSystemTrayIconWidget::x11Event(XEvent *event)
++{
++ if (event->type == ReparentNotify)
++ show();
++ return QWidget::x11Event(event);
++}
++
++// Locate the system tray
++Window QSystemTrayIconWidget::locateSystemTray()
++{
++ Display *display = QX11Info::display();
++ if (sysTraySelection == XNone) {
++ int screen = QX11Info::appScreen();
++ QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
++ sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
++ }
++
++ return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
++}
++
++XVisualInfo* QSystemTrayIconWidget::getSysTrayVisualInfo()
++{
++ Display *display = QX11Info::display();
++
++ if (!sysTrayVisual.visual) {
++ Window win = locateSystemTray();
++ if (win != XNone) {
++ Atom actual_type;
++ int actual_format;
++ ulong nitems, bytes_remaining;
++ uchar *data = 0;
++ int result = XGetWindowProperty(display, win, ATOM(_NET_SYSTEM_TRAY_VISUAL), 0, 1,
++ False, XA_VISUALID, &actual_type,
++ &actual_format, &nitems, &bytes_remaining, &data);
++ VisualID vid = 0;
++ if (result == Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
++ nitems == 1 && bytes_remaining == 0)
++ vid = *(VisualID*)data;
++ if (data)
++ XFree(data);
++ if (vid == 0)
++ return 0;
++
++ uint mask = VisualIDMask;
++ XVisualInfo *vi, rvi;
++ int count;
++ rvi.visualid = vid;
++ vi = XGetVisualInfo(display, mask, &rvi, &count);
++ if (vi) {
++ sysTrayVisual = vi[0];
++ XFree((char*)vi);
++ }
++ if (sysTrayVisual.depth != 32)
++ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
++ }
++ }
++
++ return sysTrayVisual.visual ? &sysTrayVisual : 0;
++}
++
++bool QSystemTrayIconWidget::sysTrayTracker(void *message, long *result)
++{
++ bool retval = false;
++ if (QSystemTrayIconWidget::oldEventFilter)
++ retval = QSystemTrayIconWidget::oldEventFilter(message, result);
++
++ if (trayIcons.isEmpty())
++ return retval;
++
++ Display *display = QX11Info::display();
++ XEvent *ev = (XEvent *)message;
++ if (ev->type == DestroyNotify && ev->xany.window == sysTrayWindow) {
++ sysTrayWindow = locateSystemTray();
++ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
++ for (int i = 0; i < trayIcons.count(); i++) {
++ if (sysTrayWindow == XNone) {
++ QBalloonTip::hideBalloon();
++ trayIcons[i]->hide(); // still no luck
++ trayIcons[i]->destroy();
++ trayIcons[i]->create();
++ } else
++ trayIcons[i]->addToTray(); // add it to the new tray
++ }
++ retval = true;
++ } else if (ev->type == ClientMessage && sysTrayWindow == XNone) {
++ static Atom manager_atom = XInternAtom(display, "MANAGER", False);
++ XClientMessageEvent *cm = (XClientMessageEvent *)message;
++ if ((cm->message_type == manager_atom) && ((Atom)cm->data.l[1] == sysTraySelection)) {
++ sysTrayWindow = cm->data.l[2];
++ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
++ XSelectInput(display, sysTrayWindow, StructureNotifyMask);
++ for (int i = 0; i < trayIcons.count(); i++) {
++ trayIcons[i]->addToTray();
++ }
++ retval = true;
++ }
++ } else if (ev->type == PropertyNotify && ev->xproperty.atom == ATOM(_NET_SYSTEM_TRAY_VISUAL) &&
++ ev->xproperty.window == sysTrayWindow) {
++ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
++ for (int i = 0; i < trayIcons.count(); i++) {
++ trayIcons[i]->addToTray();
++ }
++ }
++
++ return retval;
++}
++
++void QSystemTrayIconWidget::addToTray()
++{
++ Q_ASSERT(sysTrayWindow != XNone);
++ Display *display = QX11Info::display();
++
++ XVisualInfo *vi = getSysTrayVisualInfo();
++ if (vi && vi->visual) {
++ Window root = RootWindow(display, vi->screen);
++ Window p = root;
++ if (QWidget *pw = parentWidget())
++ p = pw->effectiveWinId();
++ colormap = XCreateColormap(display, root, vi->visual, AllocNone);
++ XSetWindowAttributes wsa;
++ wsa.background_pixmap = 0;
++ wsa.colormap = colormap;
++ wsa.background_pixel = 0;
++ wsa.border_pixel = 0;
++ Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
++ 0, vi->depth, InputOutput, vi->visual,
++ CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa);
++ create(wid);
++ } else {
++ XSetWindowBackgroundPixmap(display, winId(), ParentRelative);
++ }
++
++ // GNOME, NET WM Specification
++ static Atom netwm_tray_atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False);
++ long l[5] = { CurrentTime, SYSTEM_TRAY_REQUEST_DOCK, static_cast<long>(winId()), 0, 0 };
++ XEvent ev;
++ memset(&ev, 0, sizeof(ev));
++ ev.xclient.type = ClientMessage;
++ ev.xclient.window = sysTrayWindow;
++ ev.xclient.message_type = netwm_tray_atom;
++ ev.xclient.format = 32;
++ memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l));
++ XSendEvent(display, sysTrayWindow, False, 0, &ev);
++ setMinimumSize(22, 22); // required at least on GNOME
++}
++
++////////////////////////////////////////////////////////////////////////////
++QXEmbedSystemTrayIconSys::QXEmbedSystemTrayIconSys(QSystemTrayIcon *q)
++: QAbstractSystemTrayIconSys(q)
++, widget(0)
++{
++}
++
++QXEmbedSystemTrayIconSys::~QXEmbedSystemTrayIconSys()
++{
++ delete widget;
++}
++
++QRect QXEmbedSystemTrayIconSys::geometry() const
++{
++ if (!widget)
++ return QRect();
++ return QRect(widget->mapToGlobal(QPoint(0, 0)), widget->size());
++}
++
++void QXEmbedSystemTrayIconSys::updateIcon()
++{
++ if (!widget)
++ return;
++ widget->update();
++}
++
++void QXEmbedSystemTrayIconSys::updateToolTip()
++{
++ if (!widget)
++ return;
++ widget->setToolTip(trayIcon->toolTip());
++}
++
++void QXEmbedSystemTrayIconSys::showMessage(const QString &message, const QString &title,
++ QSystemTrayIcon::MessageIcon icon, int msecs)
++{
++ if (!widget)
++ return;
++ QPoint point = geometry().center();
++ QBalloonTip::showBalloon(icon, message, title, trayIcon, point, msecs);
++}
++
++void QXEmbedSystemTrayIconSys::updateVisibility()
++{
++ bool visible = trayIcon->isVisible();
++ if (visible && !widget)
++ widget = new QSystemTrayIconWidget(trayIcon, this);
++ else if (!visible && widget) {
++ delete widget;
++ widget = 0;
++ }
++}
++
++void QXEmbedSystemTrayIconSys::sendToolTipEventToTrayIcon()
++{
++#ifndef QT_NO_TOOLTIP
++ // Pass the event through QSystemTrayIcon so that it gets a chance to
++ // update the tooltip, then asks widget to show the tooltip
++ Q_ASSERT(widget);
++ QPoint globalPos = QCursor::pos();
++ QPoint pos = widget->mapFromGlobal(globalPos);
++ QHelpEvent event(QEvent::ToolTip, pos, globalPos);
++ QApplication::sendEvent(trayIcon, &event);
++#endif
++}
++
++void QXEmbedSystemTrayIconSys::sendWheelEventToTrayIcon(int delta, Qt::Orientation orientation)
++{
++#ifndef QT_NO_WHEELEVENT
++ Q_ASSERT(widget);
++ QPoint globalPos = QCursor::pos();
++ QPoint pos = widget->mapFromGlobal(globalPos);
++ QWheelEvent event(pos, globalPos, delta, Qt::NoButton, Qt::NoModifier, orientation);
++ QApplication::sendEvent(trayIcon, &event);
++#endif
++}
++
++void QXEmbedSystemTrayIconSys::updateMenu()
++{
++}
++
++/////////////////////////////////////////////////////////////
++QAbstractSystemTrayIconSys * QXEmbedSystemTrayIconSysFactory::create(QSystemTrayIcon *icon)
++{
++ return new QXEmbedSystemTrayIconSys(icon);
++}
++
++bool QXEmbedSystemTrayIconSysFactory::isAvailable() const
++{
++ return QSystemTrayIconWidget::locateSystemTray() != XNone;
++}
++
++QT_END_NAMESPACE
++#endif //QT_NO_SYSTEMTRAYICON
+--- /dev/null
++++ b/src/gui/util/qxembedsystemtrayicon_x11_p.h
+@@ -0,0 +1,104 @@
++/****************************************************************************
++**
++** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
++** All rights reserved.
++** Contact: Nokia Corporation (qt-info@nokia.com)
++**
++** This file is part of the QtGui module of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** GNU Lesser General Public License Usage
++** This file may be used under the terms of the GNU Lesser General Public
++** License version 2.1 as published by the Free Software Foundation and
++** appearing in the file LICENSE.LGPL included in the packaging of this
++** file. Please review the following information to ensure the GNU Lesser
++** General Public License version 2.1 requirements will be met:
++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** In addition, as a special exception, Nokia gives you certain additional
++** rights. These rights are described in the Nokia Qt LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU General
++** Public License version 3.0 as published by the Free Software Foundation
++** and appearing in the file LICENSE.GPL included in the packaging of this
++** file. Please review the following information to ensure the GNU General
++** Public License version 3.0 requirements will be met:
++** http://www.gnu.org/copyleft/gpl.html.
++**
++** Other Usage
++** Alternatively, this file may be used in accordance with the terms and
++** conditions contained in a signed written agreement between you and Nokia.
++**
++**
++**
++**
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++#ifndef QXEMBEDSYSTEMTRAYICON_X11_P_H
++#define QXEMBEDSYSTEMTRAYICON_X11_P_H
++
++//
++// W A R N I N G
++// -------------
++//
++// This file is not part of the Qt API. It exists for the convenience
++// of a number of Qt sources files. This header file may change from
++// version to version without notice, or even be removed.
++//
++// We mean it.
++//
++
++#ifndef QT_NO_SYSTEMTRAYICON
++
++#include "qabstractsystemtrayiconsys_p.h"
++
++QT_BEGIN_NAMESPACE
++
++class QSystemTrayIconWidget;
++
++class QXEmbedSystemTrayIconSys : public QAbstractSystemTrayIconSys
++{
++public:
++ QXEmbedSystemTrayIconSys(QSystemTrayIcon *);
++ ~QXEmbedSystemTrayIconSys();
++
++ QRect geometry() const;
++
++ void updateVisibility();
++
++ void updateIcon();
++
++ void updateToolTip();
++
++ void updateMenu();
++
++ void showMessage(const QString &message, const QString &title,
++ QSystemTrayIcon::MessageIcon icon, int msecs);
++
++private:
++ friend class QSystemTrayIconWidget;
++ QSystemTrayIconWidget *widget;
++
++ void sendToolTipEventToTrayIcon();
++
++ void sendWheelEventToTrayIcon(int delta, Qt::Orientation orientation);
++};
++
++struct QXEmbedSystemTrayIconSysFactory : public QSystemTrayIconSysFactoryInterface
++{
++ QAbstractSystemTrayIconSys * create(QSystemTrayIcon *trayIcon);
++ bool isAvailable() const;
++};
++
++
++QT_END_NAMESPACE
++
++#endif // QT_NO_SYSTEMTRAYICON
++
++#endif // QXEMBEDSYSTEMTRAYICON_X11_P_H
++
+--- a/src/gui/util/util.pri
++++ b/src/gui/util/util.pri
+@@ -29,8 +29,13 @@
+ }
+
+ unix:x11 {
++ HEADERS += \
++ util/qabstractsystemtrayiconsys_p.h \
++ util/qxembedsystemtrayicon_x11_p.h
+ SOURCES += \
+- util/qsystemtrayicon_x11.cpp
++ util/qabstractsystemtrayiconsys.cpp \
++ util/qsystemtrayicon_x11.cpp \
++ util/qxembedsystemtrayicon_x11.cpp
+ }
+
+ embedded|qpa {
diff --git a/source/l/qt/qtwebkit/doinst.sh b/source/l/qt/qtwebkit/doinst.sh
new file mode 100644
index 000000000..6f7c5df07
--- /dev/null
+++ b/source/l/qt/qtwebkit/doinst.sh
@@ -0,0 +1,5 @@
+
+if [ -x sbin/ldconfig ]; then
+ chroot . /sbin/ldconfig 2> /dev/null
+fi
+
diff --git a/source/l/qt/qtwebkit/qtwebkit.SlackBuild b/source/l/qt/qtwebkit/qtwebkit.SlackBuild
new file mode 100755
index 000000000..9524d836f
--- /dev/null
+++ b/source/l/qt/qtwebkit/qtwebkit.SlackBuild
@@ -0,0 +1,165 @@
+#!/bin/sh
+
+# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2015 Heinz Wiesinger, Amsterdam, The Netherlands
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Derived from the main qt SlackBuild
+
+PKGNAM=qtwebkit
+VERSION=$(ls qtwebkit-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
+BUILD=${BUILD:-1}
+
+NUMJOBS=${NUMJOBS:--j7}
+
+# Automatically determine the architecture we're building on:
+MARCH=$( uname -m )
+if [ -z "$ARCH" ]; then
+ case "$MARCH" in
+ i?86) export ARCH=i586 ;;
+ armv7hl) export ARCH=$MARCH ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$MARCH ;;
+ esac
+fi
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+ WEBKITFLAGS="--no-force-sse2"
+elif [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+ WEBKITFLAGS="--no-force-sse2"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ WEBKITFLAGS="--no-force-sse2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+ WEBKITFLAGS=""
+elif [ "$ARCH" = "armv7hl" ]; then
+ # To prevent "qatomic_armv6.h error: output number 2 not directly addressable"
+ # More permanent solution is to patch gcc:
+ # http://bazaar.launchpad.net/~linaro-toolchain-dev/gcc-linaro/4.6/revision/106731
+ SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -fno-strict-volatile-bitfields"
+ LIBDIRSUFFIX=""
+ WEBKITFLAGS="--no-force-sse2"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ WEBKITFLAGS="--no-force-sse2"
+fi
+
+case "$ARCH" in
+ arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+ *) TARGET=$ARCH-slackware-linux ;;
+esac
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-${PKGNAM}
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf qtwebkit-$VERSION
+tar xvf $CWD/qtwebkit-$VERSION.tar.xz
+cd qtwebkit-$VERSION || exit 1
+
+# Patch to fix compiling with gcc5:
+zcat $CWD/qtwebkit.putByIndexBeyondVectorLengthWithArrayStorage.diff.gz | patch -p1 --verbose || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+QTDIR="/usr/lib$LIBDIRSUFFIX/qt" \
+Tools/Scripts/build-webkit \
+ --qt \
+ --prefix=/usr/lib${LIBDIRSUFFIX}/qt \
+ --release \
+ --no-webkit2 \
+ --makeargs="$NUMJOBS" \
+ --qmakearg="CONFIG+=production_build QMAKE_CFLAGS=\"$SLKCFLAGS\" QMAKE_CXXFLAGS=\"$SLKCFLAGS\"" \
+ $WEBKITFLAGS || exit 1
+
+# To add support for WebP images add this to --qmakearg
+# DEFINES+=HAVE_LIBWEBP=1
+
+make INSTALL_ROOT=$PKG -C WebKitBuild/Release install || exit 1
+
+# libjscore is used internally. Prevent a false dependency on this in the .pc files:
+sed -i "s,-ljscore,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
+sed -i "s,-L../JavaScriptCore/release,,g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/*.pc
+
+# libwebcore is used internally. Prevent a false dependency on this in the .pc files:
+sed -i \
+ -e "s#-L/usr/lib${LIBDIRSUFFIX}/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib$LIBDIRSUFFIX -lwebcore##g" \
+ -e "s#-L/usr/lib${LIBDIRSUFFIX}/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib -lwebcore##g" \
+ -e "s#-L$TMP/qtwebkit-$VERSION/WebKitBuild/Release/Source/WebKit/release##g" \
+ -e "s#-L$TMP/qtwebkit-$VERSION/WebKitBuild/Release/Source/WebCore/release##g" \
+ -e "s#-L$TMP/qtwebkit-$VERSION/WebKitBuild/Release/Source/ThirdParty/ANGLE/release##g" \
+ -e "s#-L$TMP/qtwebkit-$VERSION/WebKitBuild/Release/Source/JavaScriptCore/release##g" \
+ -e "s#-L$TMP/qtwebkit-$VERSION/WebKitBuild/Release/Source/WTF/release##g" \
+ -e "s# -lwebcore##g" \
+ $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/QtWebKit.pc
+
+# Link the shared libraries into /usr/lib:
+( cd $PKG/usr/lib${LIBDIRSUFFIX}
+ for file in qt/lib/*.so* ; do
+ ln -sf $file .
+ done
+)
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig
+ for file in *.pc ; do
+ ( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/$file . )
+ done
+)
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a ChangeLog $PKG/usr/doc/$PKGNAM-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
+mkdir -p $PKG/install
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/l/qt/qtwebkit/qtwebkit.putByIndexBeyondVectorLengthWithArrayStorage.diff b/source/l/qt/qtwebkit/qtwebkit.putByIndexBeyondVectorLengthWithArrayStorage.diff
new file mode 100644
index 000000000..94696b769
--- /dev/null
+++ b/source/l/qt/qtwebkit/qtwebkit.putByIndexBeyondVectorLengthWithArrayStorage.diff
@@ -0,0 +1,13 @@
+--- ./Source/JavaScriptCore/runtime/JSObject.cpp.orig 2014-09-24 06:42:05.000000000 -0500
++++ ./Source/JavaScriptCore/runtime/JSObject.cpp 2015-11-18 22:41:05.673463626 -0600
+@@ -1922,6 +1922,10 @@
+ }
+ }
+
++template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes<Int32Shape>(ExecState* exec, unsigned i, JSValue value);
++template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes<DoubleShape>(ExecState* exec, unsigned i, JSValue value);
++template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes<ContiguousShape>(ExecState* exec, unsigned i, JSValue value);
++
+ void JSObject::putByIndexBeyondVectorLengthWithArrayStorage(ExecState* exec, unsigned i, JSValue value, bool shouldThrow, ArrayStorage* storage)
+ {
+ JSGlobalData& globalData = exec->globalData();
diff --git a/source/l/qt/qtwebkit/qtwebkit.url b/source/l/qt/qtwebkit/qtwebkit.url
new file mode 100644
index 000000000..4e832e125
--- /dev/null
+++ b/source/l/qt/qtwebkit/qtwebkit.url
@@ -0,0 +1 @@
+http://download.kde.org/stable/qtwebkit-2.3/2.3.4/src/qtwebkit-2.3.4.tar.gz
diff --git a/source/l/qt/qtwebkit/slack-desc b/source/l/qt/qtwebkit/slack-desc
new file mode 100644
index 000000000..0bd175744
--- /dev/null
+++ b/source/l/qt/qtwebkit/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+qtwebkit: QtWebKit (Qt bindings for the WebKit browser engine)
+qtwebkit:
+qtwebkit: WebKit is an open source web browser engine. WebKit's HTML and
+qtwebkit: JavaScript code began as a branch of the KHTML and KJS libraries from
+qtwebkit: KDE. As part of KDE framework KHTML was based on Qt but during their
+qtwebkit: porting efforts Apple's engineers made WebKit toolkit independent.
+qtwebkit: QtWebKit is a project aiming at porting this fabulous engine back
+qtwebkit: to Qt.
+qtwebkit:
+qtwebkit: Homepage: http://www.qt.io/
+qtwebkit:
diff --git a/source/l/qt/slack-desc b/source/l/qt/slack-desc
index 0a42d4a32..4ebd42dfa 100644..100755
--- a/source/l/qt/slack-desc
+++ b/source/l/qt/slack-desc
@@ -11,7 +11,7 @@ qt:
qt: Qt is a complete and well-developed object-oriented framework for
qt: developing graphical user interface (GUI) applications using C++.
qt:
-qt: Homepage: http://qt-project.org/
+qt: Homepage: http://www.qt.io/
qt:
qt:
qt: