From 03e1ed04d7a06d039e5dc317638aa5a6b4773f8c Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 24 Jan 2015 19:37:30 +0100 Subject: Add support for Qt4 applications to dock to the Plasma 5 systray. qt-4.8.6: added dep; compared to the Slackware original, I have applied several patches to impement qsystemtrayicon support. sni-qt: added dep; this application actually provides the systray support for Qt4 apps in Plasma 5. --- README | 1 + deps/alldeps.SlackBuild | 2 + deps/qt/Qt.pc | 16 + deps/qt/RCS/qt.SlackBuild,v | 1353 ++++++++++++++++++ deps/qt/README | 9 + deps/qt/doinst.sh | 10 + deps/qt/profile.d/qt4.csh | 22 + deps/qt/profile.d/qt4.sh | 23 + deps/qt/qt.SlackBuild | 311 +++++ deps/qt/qt.fix.broken.gif.crash.diff | 16 + .../qt.glib-honor-ExcludeSocketNotifiers-flag.diff | 63 + deps/qt/qt.mysql.h.diff | 12 + deps/qt/qt.qclipboard_delay.patch | 12 + deps/qt/qt.qclipboard_fix_recursive.patch | 94 ++ deps/qt/qt.qsystemtrayicon-plugin-system.diff | 1466 ++++++++++++++++++++ deps/qt/qt.webkit-no_Werror.patch | 11 + deps/qt/slack-desc | 19 + deps/sni-qt/doinst.sh | 23 + deps/sni-qt/slack-desc | 19 + deps/sni-qt/sni-qt.SlackBuild | 106 ++ deps/sni-qt/sni-qt.conf | 6 + deps/updates.SlackBuild | 2 + 22 files changed, 3596 insertions(+) create mode 100644 deps/qt/Qt.pc create mode 100755 deps/qt/RCS/qt.SlackBuild,v create mode 100644 deps/qt/README create mode 100644 deps/qt/doinst.sh create mode 100644 deps/qt/profile.d/qt4.csh create mode 100644 deps/qt/profile.d/qt4.sh create mode 100755 deps/qt/qt.SlackBuild create mode 100644 deps/qt/qt.fix.broken.gif.crash.diff create mode 100644 deps/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff create mode 100644 deps/qt/qt.mysql.h.diff create mode 100644 deps/qt/qt.qclipboard_delay.patch create mode 100644 deps/qt/qt.qclipboard_fix_recursive.patch create mode 100644 deps/qt/qt.qsystemtrayicon-plugin-system.diff create mode 100644 deps/qt/qt.webkit-no_Werror.patch create mode 100644 deps/qt/slack-desc create mode 100644 deps/sni-qt/doinst.sh create mode 100644 deps/sni-qt/slack-desc create mode 100755 deps/sni-qt/sni-qt.SlackBuild create mode 100644 deps/sni-qt/sni-qt.conf diff --git a/README b/README index dc7586b..cf70e9b 100644 --- a/README +++ b/README @@ -50,6 +50,7 @@ Preliminary build procedure: # removepkg /var/log/packages/*-4.10.5-* # removepkg libkscreen # removepkg kscreen + # removepkg networkmanagement # removepkg polkit-kde-agent-1 # removepkg polkit-kde-kcmodules-1 # removepkg polkit-qt-1 diff --git a/deps/alldeps.SlackBuild b/deps/alldeps.SlackBuild index 8b84144..2ec2c2a 100755 --- a/deps/alldeps.SlackBuild +++ b/deps/alldeps.SlackBuild @@ -14,6 +14,8 @@ TMP=${TMP:-/tmp} QTDIR=/usr/lib${LIBDIRSUFFIX}/qt ; export QTDIR ALLDEPS=" \ + qt \ + sni-qt \ cmake \ extra-cmake-modules \ harfbuzz \ diff --git a/deps/qt/Qt.pc b/deps/qt/Qt.pc new file mode 100644 index 0000000..29d1131 --- /dev/null +++ b/deps/qt/Qt.pc @@ -0,0 +1,16 @@ +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=/etc +translationdir=${prefix}/translations + +Name: Qt +Description: Qt Configuration +Version: 4.8.6 diff --git a/deps/qt/RCS/qt.SlackBuild,v b/deps/qt/RCS/qt.SlackBuild,v new file mode 100755 index 0000000..d73d3e8 --- /dev/null +++ b/deps/qt/RCS/qt.SlackBuild,v @@ -0,0 +1,1353 @@ +head 1.42; +access; +symbols; +locks + eha:1.42; strict; +comment @# @; + + +1.42 +date 2014.04.26.12.06.01; author eha; state Exp; +branches; +next 1.41; + +1.41 +date 2013.10.21.07.29.16; author eha; state Exp; +branches; +next 1.40; + +1.40 +date 2013.08.19.15.31.38; author eha; state Exp; +branches; +next 1.39; + +1.39 +date 2013.04.24.07.22.32; author eha; state Exp; +branches; +next 1.38; + +1.38 +date 2013.04.05.07.03.47; author eha; state Exp; +branches; +next 1.37; + +1.37 +date 2013.03.27.14.39.50; author eha; state Exp; +branches; +next 1.36; + +1.36 +date 2013.03.24.12.53.32; author eha; state Exp; +branches; +next 1.35; + +1.35 +date 2013.02.11.10.57.19; author eha; state Exp; +branches; +next 1.34; + +1.34 +date 2012.08.30.19.16.57; author eha; state Exp; +branches; +next 1.33; + +1.33 +date 2012.08.20.19.22.49; author eha; state Exp; +branches; +next 1.32; + +1.32 +date 2012.08.07.09.43.03; author eha; state Exp; +branches; +next 1.31; + +1.31 +date 2012.07.05.13.41.07; author eha; state Exp; +branches; +next 1.30; + +1.30 +date 2012.05.17.10.01.44; author eha; state Exp; +branches; +next 1.29; + +1.29 +date 2012.04.14.11.45.05; author eha; state Exp; +branches; +next 1.28; + +1.28 +date 2011.03.25.21.18.04; author eha; state Exp; +branches; +next 1.27; + +1.27 +date 2011.03.24.23.50.18; author eha; state Exp; +branches; +next 1.26; + +1.26 +date 2011.03.23.10.16.40; author eha; state Exp; +branches; +next 1.25; + +1.25 +date 2011.01.08.00.58.35; author eha; state Exp; +branches; +next 1.24; + +1.24 +date 2010.11.21.12.44.50; author eha; state Exp; +branches; +next 1.23; + +1.23 +date 2010.05.06.18.14.12; author eha; state Exp; +branches; +next 1.22; + +1.22 +date 2010.02.19.21.20.37; author eha; state Exp; +branches; +next 1.21; + +1.21 +date 2009.11.07.23.09.18; author eha; state Exp; +branches; +next 1.20; + +1.20 +date 2009.11.04.11.01.41; author eha; state Exp; +branches; +next 1.19; + +1.19 +date 2009.10.21.14.03.38; author eha; state Exp; +branches; +next 1.18; + +1.18 +date 2009.10.09.16.16.28; author eha; state Exp; +branches; +next 1.17; + +1.17 +date 2009.08.09.20.37.01; author eha; state Exp; +branches; +next 1.16; + +1.16 +date 2009.08.07.07.56.02; author eha; state Exp; +branches; +next 1.15; + +1.15 +date 2009.08.05.12.14.36; author eha; state Exp; +branches; +next 1.14; + +1.14 +date 2009.05.20.20.16.22; author eha; state Exp; +branches; +next 1.13; + +1.13 +date 2009.05.06.21.54.11; author eha; state Exp; +branches; +next 1.12; + +1.12 +date 2009.05.06.20.42.22; author eha; state Exp; +branches; +next 1.11; + +1.11 +date 2009.05.06.20.39.25; author eha; state Exp; +branches; +next 1.10; + +1.10 +date 2009.04.03.10.00.52; author eha; state Exp; +branches; +next 1.9; + +1.9 +date 2009.03.14.10.30.56; author eha; state Exp; +branches; +next 1.8; + +1.8 +date 2009.03.01.00.08.34; author eha; state Exp; +branches; +next 1.7; + +1.7 +date 2008.12.28.20.11.06; author eha; state Exp; +branches; +next 1.6; + +1.6 +date 2008.12.18.20.55.39; author eha; state Exp; +branches; +next 1.5; + +1.5 +date 2008.12.15.12.20.20; author eha; state Exp; +branches; +next 1.4; + +1.4 +date 2008.11.26.22.54.18; author eha; state Exp; +branches; +next 1.3; + +1.3 +date 2008.10.10.11.44.33; author eha; state Exp; +branches; +next 1.2; + +1.2 +date 2008.10.10.07.54.39; author eha; state Exp; +branches; +next 1.1; + +1.1 +date 2008.10.09.08.57.43; author eha; state Exp; +branches; +next ; + + +desc +@Not adapted yet +@ + + +1.42 +log +@Mass check-in of updated SlackBuilds on Sat Apr 26 12:05:59 UTC 2014 +@ +text +@#!/bin/sh + +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 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 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:-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=i486 ;; + 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" = "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 +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 + +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 < $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 +) + +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: +# 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 < $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 < $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 < $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 < $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 + +@ + + +1.41 +log +@Mass check-in of updated SlackBuilds on Mon Oct 21 07:29:12 UTC 2013 +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA +d44 1 +a44 1 +BUILD=${BUILD:-2} +a109 3 +# gcc doesn't support flag "-fuse-ld=gold": +zcat $CWD/qt.ld-gold.patch.gz | patch -p1 --verbose || exit 1 + +d112 3 +@ + + +1.40 +log +@Mass check-in of updated SlackBuilds on Mon Aug 19 15:31:35 UTC 2013 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-1} +d173 5 +a177 1 +sed -i "s#-L/usr/lib${LIBDIRSUFFIX}/qt/lib -L../../WebCore/release -L../../JavaScriptCore/release -L/usr/X11R6/lib$LIBDIRSUFFIX -lwebcore##g" $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/libQtWebKit.la $PKG/usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/QtWebKit.pc +@ + + +1.39 +log +@Mass check-in of updated SlackBuilds on Wed Apr 24 07:22:29 UTC 2013 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-5} +a114 6 + +# Patch for boost-1.53: +zcat $CWD/qt-everywhere-opensource-src-4.8.4-QTBUG-22829.diff.gz | patch -p1 --verbose || exit 1 + +# Fix call to QMetaObject::metaCall from updateProperty (QTBUG-29082): +zcat $CWD/qt-fix-qvmemetadata-crash.patch.gz | patch -p1 --verbose || exit 1 +@ + + +1.38 +log +@Mass check-in of updated SlackBuilds on Fri Apr 5 07:03:44 UTC 2013 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-4} +d118 3 +@ + + +1.37 +log +@Mass check-in of updated SlackBuilds on Wed Mar 27 14:39:47 UTC 2013 +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 Patrick J. Volkerding, Sebeka, MN, USA +d44 1 +a44 1 +BUILD=${BUILD:-3} +d289 5 +a293 3 +( cd $PKG/usr/doc/$PKGNAM-$VERSION + ln -sf /usr/lib${LIBDIRSUFFIX}/qt/doc/html . +) +@ + + +1.36 +log +@Mass check-in of updated SlackBuilds on Sun Mar 24 12:53:28 UTC 2013 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-2} +d115 3 +@ + + +1.35 +log +@Mass check-in of updated SlackBuilds on Mon Feb 11 10:57:15 UTC 2013 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-1} +@ + + +1.34 +log +@Mass check-in of updated SlackBuilds on Thu Aug 30 19:16:54 UTC 2012 +@ +text +@d40 1 +a40 1 +# qt 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2 are built from original nokia sources. +d44 1 +a44 1 +BUILD=${BUILD:-4} +a115 14 +# Fix cursor position bug within tables: +zcat $CWD/qt.ca89c49.cursor.position.diff.gz | patch -p1 --verbose || exit 1 + +# Fix assistant crash: +zcat $CWD/qt.assistant.memcpy-crash.diff.gz | patch -p0 --verbose || exit 1 + +# Fix webkit compiling with recent glib: +zcat $CWD/qt.webkit.glib.diff.gz | patch -p1 --verbose || exit 1 + +# Some patches from upstream: +zcat $CWD/QElfParser-fix-type-of-sh_size.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/QTBUG-14724_close_orphaned_file_descriptors_after_printing.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/QTBUG-21900_Buttons_in_Qt_applications_not_clickable_when_run_under_gnome-shell.patch.gz | patch -p1 --verbose || exit 1 + +d134 1 +d208 8 +@ + + +1.33 +log +@Mass check-in of updated SlackBuilds on Mon Aug 20 19:22:46 UTC 2012 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-3} +a123 3 + +# Fix JIT crashes affecting Kate, KDevelop, maybe others: +zcat $CWD/qt.fix.jit.crash.diff.gz | patch -p1 --verbose || exit 1 +@ + + +1.32 +log +@Mass check-in of updated SlackBuilds on Tue Aug 7 09:43:00 UTC 2012 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-2} +d124 3 +@ + + +1.31 +log +@Mass check-in of updated SlackBuilds on Thu Jul 5 13:41:05 UTC 2012 +@ +text +@d44 1 +a44 1 +BUILD=${BUILD:-1} +d122 3 +d181 1 +a181 1 +# libjscore is used internally. Prevent a false dependency on this in the .la files: +d184 3 +@ + + +1.30 +log +@Mass check-in of updated SlackBuilds on Thu May 17 10:01:33 UTC 2012 +@ +text +@d40 1 +a40 1 +# qt 4.7.3, 4.7.4, 4.8.0, 4.8.1 are built from original nokia sources. +d44 1 +a44 1 +BUILD=${BUILD:-2} +d104 1 +a104 2 + sed -i -e "s/QMAKE_CFLAGS_RELEASE += -O2/QMAKE_CFLAGS_RELEASE += $SLKCFLAGS/" mkspecs/common/g++.conf || exit 1 + #zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 || exit 1 +a109 10 +## Fix broken QUrl_toLocalFile function which disables KDE sound (QTBUG-22382): +# Fixed in qt 4.8.1 +#zcat $CWD/qt.QUrl_toLocalFile.patch.gz | patch -p1 --verbose || exit 1 + +## Patch for security issue CVE-2011-3922: +#zcat $CWD/qt.CVE-2011-3922.patch.gz | patch -p1 --verbose || exit 1 + +# Patch for the use of gcc 4.7: +zcat $CWD/qt.gcc47.patch.gz | patch -p1 --verbose || exit 1 + +d116 10 +a125 2 +# Fix for a crash bug which affects Qt 4.8.0 and 4.8.1: +zcat $CWD/qt.qtbug-24718.patch.gz | patch -p1 --verbose || exit 1 +a187 5 + +if [ $ARCH = "i486" ]; then + # Put this back as shipped: + zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 -R +fi +@ + + +1.29 +log +@Mass check-in of updated SlackBuilds on Sat Apr 14 11:45:03 UTC 2012 +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, USA +d44 1 +a44 1 +BUILD=${BUILD:-1} +@ + + +1.28 +log +@Mass check-in of updated SlackBuilds on Fri Mar 25 21:18:02 UTC 2011 +@ +text +@d38 3 +d43 4 +a46 2 +VERSION=$(ls qt-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev) +BUILD=${BUILD:-3} +d49 1 +d51 4 +a54 3 + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; +d56 1 +a56 1 + *) export ARCH=$( uname -m ) ;; +a59 2 +NUMJOBS=${NUMJOBS:--j7} + +d69 6 +d80 5 +d92 3 +a94 17 +#rm -rf qt-x11-opensource-src-$VERSION +#tar xvf $CWD/qt-x11-opensource-src-$VERSION.tar.gz # For qt releases +#cd qt-x11-opensource-src-$VERSION || exit 1 + +rm -rf qt-$VERSION +if [ -r $CWD/qt-$VERSION.tar.gz ]; then + tar xvf $CWD/qt-$VERSION.tar.gz || exit 1 +elif [ -r $CWD/qt-$VERSION.tar.bz2 ]; then + tar xvf $CWD/qt-$VERSION.tar.bz2 || exit 1 +elif [ -r $CWD/qt-$VERSION.tar.xz ]; then + tar xvf $CWD/qt-$VERSION.tar.xz || exit 1 +elif [ -r $CWD/qt-$VERSION.tar.lzma ]; then + tar xvf $CWD/qt-$VERSION.tar.lzma || exit 1 +else + exit 1 +fi +cd qt-$VERSION || exit 1 +a102 9 +# apply_patches looks for a ".svn" directory, which doesn't exist in the used snapshot. +# removing the check from apply_patches to not try to apply already applied patches +sed -i "s| test -d .svn &&||" apply_patches + +# This is only needed/wanted for qt-copy (the r###### version) that we're +# building right now. It might require manual intervention, so don't walk +# away during the build +./apply_patches + +d104 2 +a105 1 + zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 || exit 1 +d111 12 +a122 2 +# Upstream patch required for upcoming kdepim-4.6.x: +zcat $CWD/qt.QSortFilterProxyModel.reformatted.diff.gz | patch -p1 --verbose || exit 1 +d124 5 +a128 3 +# Blacklist compromised certificates: +zcat $CWD/qt.blacklist.bad.certs.diff.gz | patch -p1 --verbose || exit 1 +zcat $CWD/qt.blacklist.bad.certs.patch02.diff.gz | patch -p1 --verbose || exit 1 +a136 1 + -qt-gif \ +d160 21 +d223 65 +@ + + +1.27 +log +@Mass check-in of updated SlackBuilds on Thu Mar 24 23:50:16 UTC 2011 +@ +text +@d122 1 +@ + + +1.26 +log +@Mass check-in of updated SlackBuilds on Wed Mar 23 10:16:37 UTC 2011 +@ +text +@d120 3 +@ + + +1.25 +log +@Mass check-in of updated SlackBuilds on Sat Jan 8 00:58:32 UTC 2011 +@ +text +@d41 1 +a41 1 +BUILD=${BUILD:-2} +d151 4 +@ + + +1.24 +log +@Mass check-in of updated SlackBuilds on Sun Nov 21 12:44:48 UTC 2010 +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA +d41 1 +a41 1 +BUILD=${BUILD:-1} +d115 4 +a118 1 +zcat $CWD/qt.mysql.h.diff.gz | patch -p1 || exit 1 +@ + + +1.23 +log +@Mass check-in of updated SlackBuilds on Thu May 6 18:14:09 UTC 2010 +@ +text +@d34 3 +@ + + +1.22 +log +@Mass check-in of updated SlackBuilds on Fri Feb 19 21:20:35 UTC 2010 +@ +text +@d32 3 +d38 1 +a38 1 +BUILD=${BUILD:-4} +d61 3 +d111 1 +a111 1 +# Fix path to mysql header: +a113 5 +# libpng 1.4.0 support (backported from the qt-4.6 branch): +zcat $CWD/qt.png14.diff.gz | patch -p1 || exit 1 + +# The "o" selects the Open Source edition of Qt. +# The "yes" agrees to the GPL, so don't run this script if you don't agree. :-) +d117 3 +a119 2 +echo "o +yes" | ./configure \ +d125 1 +d127 1 +a127 1 + -system-zlib \ +d130 1 +a130 2 + -phonon \ + -no-phonon-backend \ +d133 3 +a135 1 + -no-separate-debug-info +@ + + +1.21 +log +@Mass check-in of updated SlackBuilds on Sat Nov 7 23:09:08 UTC 2009 +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA +d35 1 +a35 1 +BUILD=${BUILD:-3} +d105 1 +a105 1 +# Fix path to mysql header +d108 3 +@ + + +1.20 +log +@Mass check-in of updated SlackBuilds on Wed Nov 4 11:01:39 UTC 2009 +@ +text +@d35 1 +a35 1 +BUILD=${BUILD:-2} +d37 1 +a37 1 +# Automatically determine architecture for build & packaging: +d41 1 +d43 1 +a43 1 + *) export ARCH=$( uname -m ) ;; +d124 2 +@ + + +1.19 +log +@Mass check-in of updated SlackBuilds on Wed Oct 21 14:03:36 UTC 2009 +@ +text +@d35 10 +a44 2 +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-1} +a122 1 + -no-phonon \ +@ + + +1.18 +log +@Mass check-in of updated SlackBuilds on Fri Oct 9 16:16:24 UTC 2009 +@ +text +@d26 6 +a31 2 +# We're using qt-copy instead of a released qt version, as this svn release +# has at least one bugfix strongly recommended by the kde developers +d111 1 +@ + + +1.17 +log +@Mass check-in of updated SlackBuilds on Sun Aug 9 20:36:59 UTC 2009 +@ +text +@d30 1 +a30 1 +VERSION=$(ls qt-r*.tar.?z* | cut -d - -f 2 | cut -f 1 -d . | tail -1) +@ + + +1.16 +log +@Mass check-in of updated SlackBuilds on Fri Aug 7 07:55:59 UTC 2009 +@ +text +@d149 3 +a151 8 +( cd $PKG/usr/bin + for file in \ + assistant assistant_adp designer lconvert linguist lrelease \ + lupdate moc pixeltool qcollectiongenerator qdbus qdbuscpp2xml qdbusviewer \ + qdbusxml2cpp qhelpconverter qhelpgenerator qmake qt3to4 qtconfig rcc uic \ + uic3 xmlpatterns ; + do + ln -sf /usr/lib${LIBDIRSUFFIX}/qt/bin/$file . +d156 3 +a158 7 +( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig + for file in Qt3Support.pc QtAssistantClient.pc QtCLucene.pc \ + QtCore.pc QtDBus.pc QtDesigner.pc QtDesignerComponents QtGui.pc \ + QtHelp.pc QtNetwork.pc QtOpenGL.pc QtScript.pc QtScriptTools.pc QtSql.pc \ + QtSvg.pc QtTest.pc QtUiTools.pc QtWebKit.pc QtXml.pc QtXmlPatterns.pc ; + do + ln -sf /usr/lib${LIBDIRSUFFIX}/qt/lib/pkgconfig/$file . ; +@ + + +1.15 +log +@Mass check-in of updated SlackBuilds on Wed Aug 5 12:14:34 UTC 2009 +@ +text +@d79 3 +a81 5 +# Just skip the patches it complains about... easy enough. +## Get rid of already applied patches (if any): +#if [ -r $CWD/remove-already-applied-patches.diff.gz ]; then +# zcat $CWD/remove-already-applied-patches.diff.gz | patch -p1 --verbose || exit 1 +#fi +d95 1 +d112 2 +a113 1 + -nomake demos +d151 4 +a154 2 + assistant designer linguist lrelease lupdate moc pixeltool qdbus \ + qdbuscpp2xml qdbusviewer qdbusxml2cpp qmake qt3to4 qtconfig rcc uic uic3 ; +d162 4 +a165 3 + for file in Qt3Support.pc QtAssistantClient.pc QtCore.pc \ + QtDBus.pc QtGui.pc QtNetwork.pc QtOpenGL.pc QtScript.pc \ + QtSql.pc QtSvg.pc QtTest.pc QtUiTools.pc QtXml.pc ; +@ + + +1.14 +log +@Auto-import of Pat's changes after public release of slackware64, Wed May 20 20:16:21 UTC 2009 +@ +text +@d125 1 +a125 1 + for file in qt-$VERSION/lib/*.so* ; do +d154 1 +a154 1 + ln -sf /usr/lib${LIBDIRSUFFIX}/qt-$VERSION/bin/$file . +d164 1 +a164 1 + ln -sf /usr/lib${LIBDIRSUFFIX}/qt-$VERSION/lib/pkgconfig/$file . ; +@ + + +1.13 +log +@Some doc filenames changed +@ +text +@a44 6 +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv4 -mtune=xscale" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "armel" ]; then + SLKCFLAGS="-O2 -march=armv4t" + LIBDIRSUFFIX="" +@ + + +1.12 +log +@Add ARM flags +@ +text +@d176 1 +a176 2 +cp -a GPL_EXCEPTION.TXT GPL_EXCEPTION_ADDENDUM.TXT INSTALL LICENSE.GPL \ + LICENSE.QPL OPENSOURCE-NOTICE.TXT README changes-$VERSION \ +d187 1 +a187 1 +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.tgz +@ + + +1.11 +log +@Updated for r964497 +@ +text +@d45 6 +@ + + +1.10 +log +@Updated to r948357 +@ +text +@d57 1 +d59 11 +a69 1 +tar xvf $CWD/qt-$VERSION.tar.bz2 || exit 1 +d101 2 +a102 1 +echo "yes" | ./configure \ +@ + + +1.9 +log +@Rebuild against freetype-2.3.9 +@ +text +@d32 1 +a32 1 +BUILD=${BUILD:-2} +@ + + +1.8 +log +@Added 2009 to the copyright line +@ +text +@d32 2 +a33 1 +BUILD=${BUILD:-1} +@ + + +1.7 +log +@Update to 895466; get rid of phonon +@ +text +@d3 1 +a3 1 +# Copyright 2006, 2007, 2008 Patrick J. Volkerding, Sebeka, MN, USA +@ + + +1.6 +log +@Add phonon support +@ +text +@d98 1 +a98 1 + -phonon \ +@ + + +1.5 +log +@Only use most recent snapshot if we have more +@ +text +@d98 1 +a98 1 + -no-phonon \ +@ + + +1.4 +log +@Update to qt-copy-r887099 +@ +text +@d30 1 +a30 1 +VERSION=$(ls qt-r*.tar.?z* | cut -d - -f 2 | cut -f 1 -d .) +@ + + +1.3 +log +@Missed one '${LIBDIRSUFFIX}' +@ +text +@d67 5 +a71 4 +# Get rid of already applied patches (if any): +if [ -r $CWD/remove-already-applied-patches.diff.gz ]; then + zcat $CWD/remove-already-applied-patches.diff.gz | patch -p1 --verbose || exit 1 +fi +@ + + +1.2 +log +@Skip qt3, move to qt4 +@ +text +@d159 3 +a161 1 +( cd $PKG/usr/doc/$PKGNAM-$VERSION ; ln -sf /usr/lib/qt/doc/html . ) +@ + + +1.1 +log +@Fix NUMJOBS definition +@ +text +@d2 1 +d23 6 +d30 1 +a30 1 +VERSION=${VERSION:-3.3.8b} +d32 2 +a33 7 +BUILD=${BUILD:-2} + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-${PKGNAM} +rm -rf $PKG +mkdir -p $TMP $PKG +d46 30 +a75 12 +#cd $TMP +# I have *many* times tried building this package in /tmp, and it always +# ends up with a "/tmp" directory embedded in some wrong place. Hopefully +# the next time I see this comment I'll remember that and not make the +# same mistake again just for the sake of doing things "right" (but having +# the package come out wrong...) +#rm -rf ${PKGNAM}-${VERSION} +cd /usr/lib${LIBDIRSUFFIX} +rm -rf qt qt-3.* +tar xjvf $CWD/qt-x11-free-$VERSION.tar.bz2 || exit 1 +mv qt-x11-free-$VERSION qt +cd qt +d81 1 +a81 1 +zcat $CWD/qt-x11.diff.gz | patch -p1 || exit 1 +d84 20 +a103 38 +# Make sure ownerships and permissions are sane: +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 {} \; + +# And here's what we are currently using. The "yes" agrees to the GPL, +# so don't run this script if you don't agree. :-) +echo "yes" | CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" ./configure \ + -prefix /usr/lib${LIBDIRSUFFIX}/qt-${VERSION} \ + -release \ + -system-zlib \ + -system-libpng \ + -qt-imgfmt-png \ + -system-libmng \ + -qt-imgfmt-mng \ + -system-libjpeg \ + -qt-imgfmt-jpeg \ + -qt-gif \ + -thread \ + -stl \ + -no-g++-exceptions \ + -xft \ + -plugin-sql-mysql \ + -plugin-style-cde \ + -plugin-style-compact \ + -qt-style-motif \ + -plugin-style-motifplus \ + -plugin-style-platinum \ + -plugin-style-sgi \ + -plugin-style-windows \ + -enable-opengl + +# We're using '-i' to work around a bug where the build tries to strip html files. +# Build the important stuff: +make -j5 -i symlinks sub-src sub-tools || exit 1 +d106 2 +a107 2 +# The infamous qt -> qt-${VERSION} link that lets us cheat on the QTDIR ;-) +( cd $PKG/usr/lib${LIBDIRSUFFIX} ; ln -sf qt-${VERSION} qt) +d109 1 +a109 1 +# Link the shared libraries into /usr/lib${LIBDIRSUFFIX}: +d111 1 +a111 1 + for file in qt/lib/*.so* ; do # _no_ ${LIBDIRSUFFIX} +a115 5 +# Add man pages: +mkdir -p $PKG/usr/man +cp -a doc/man/* $PKG/usr/man +find $PKG/usr/man -type f -exec gzip -9 "{}" \; + +d118 1 +a118 2 + ( cd $PKG/usr/lib/qt + zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 -R ) +d121 4 +d126 5 +a130 12 +cat $CWD/profile.d/qt.sh > $PKG/etc/profile.d/qt.sh +cat $CWD/profile.d/qt.csh > $PKG/etc/profile.d/qt.csh +chmod 755 $PKG/etc/profile.d/* + +# Strip binaries: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +# 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... +d132 2 +d136 5 +a140 2 + for file in assistant designer linguist lrelease lupdate moc qm2ts qmake qtconfig uic ; do + ln -sf /usr/lib${LIBDIRSUFFIX}/qt/bin/$file . +d146 6 +a151 1 + ln -sf /usr/lib${LIBDIRSUFFIX}/qt-${VERSION}/lib/pkgconfig/qt-mt.pc . +d155 5 +a159 5 +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +cp -a \ + FAQ INSTALL LICENSE.GPL* LICENSE.QPL MANIFEST PLATFORMS README* changes* \ + $PKG/usr/doc/${PKGNAM}-$VERSION +( cd $PKG/usr/doc/${PKGNAM}-$VERSION ; ln -sf /usr/lib${LIBDIRSUFFIX}/qt-${VERSION}/doc/html . ) +d166 1 +a166 1 +makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.tgz +@ diff --git a/deps/qt/README b/deps/qt/README new file mode 100644 index 0000000..9bbcb34 --- /dev/null +++ b/deps/qt/README @@ -0,0 +1,9 @@ +qt-_ is actually KDE's version of Qt from git +that includes important patches not yet present in mainline Qt. + +The recommended version of Qt for KDE may be obtained from the +repository with this command: + +git clone git://gitorious.org/+kde-developers/qt/kde-qt.git + +(see the SlackBuild for more details) diff --git a/deps/qt/doinst.sh b/deps/qt/doinst.sh new file mode 100644 index 0000000..b9a2c53 --- /dev/null +++ b/deps/qt/doinst.sh @@ -0,0 +1,10 @@ + +if [ -x sbin/ldconfig ]; then + chroot . /sbin/ldconfig 2> /dev/null +fi + +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database /usr/share/applications >/dev/null 2>&1 +fi + + diff --git a/deps/qt/profile.d/qt4.csh b/deps/qt/profile.d/qt4.csh new file mode 100644 index 0000000..6e2c726 --- /dev/null +++ b/deps/qt/profile.d/qt4.csh @@ -0,0 +1,22 @@ +#!/bin/csh +# Environment path variables for the Qt package: +if ( ! $?QT4DIR ) then + # It's best to use the generic directory to avoid + # compiling in a version-containing path: + if ( -d /usr/lib/qt ) then + setenv QT4DIR /usr/lib/qt + else + # Find the newest Qt directory and set $QT4DIR to that: + foreach qtd ( /usr/lib/qt-* ) + if ( -d $qtd ) then + setenv QT4DIR $qtd + endif + end + endif +endif +set path = ( $path $QT4DIR/bin ) +if ( $?CPLUS_INCLUDE_PATH ) then + setenv CPLUS_INCLUDE_PATH $QT4DIR/include:$CPLUS_INCLUDE_PATH +else + setenv CPLUS_INCLUDE_PATH $QT4DIR/include +endif diff --git a/deps/qt/profile.d/qt4.sh b/deps/qt/profile.d/qt4.sh new file mode 100644 index 0000000..5b4b830 --- /dev/null +++ b/deps/qt/profile.d/qt4.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Environment variables for the Qt package. +# +# It's best to use the generic directory to avoid +# compiling in a version-containing path: +if [ -d /usr/lib/qt ]; then + QT4DIR=/usr/lib/qt +else + # Find the newest Qt directory and set $QT4DIR to that: + for qtd in /usr/lib/qt-* ; do + if [ -d $qtd ]; then + QT4DIR=$qtd + fi + done +fi +if [ ! "$CPLUS_INCLUDE_PATH" = "" ]; then + CPLUS_INCLUDE_PATH=$QT4DIR/include:$CPLUS_INCLUDE_PATH +else + CPLUS_INCLUDE_PATH=$QT4DIR/include +fi +PATH="$PATH:$QT4DIR/bin" +export QT4DIR +export CPLUS_INCLUDE_PATH diff --git a/deps/qt/qt.SlackBuild b/deps/qt/qt.SlackBuild new file mode 100755 index 0000000..e70fa66 --- /dev/null +++ b/deps/qt/qt.SlackBuild @@ -0,0 +1,311 @@ +#!/bin/sh + +# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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 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, 2015 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} + +# Automatically determine the architecture we're building on: +MARCH=$( uname -m ) +if [ -z "$ARCH" ]; then + case "$MARCH" in + i?86) export ARCH=i486 ;; + 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" = "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 +fi + +# Fix path to mysql header +cat $CWD/qt.mysql.h.diff | patch -p1 --verbose || exit 1 + +# Stupid idea - remove it: +cat $CWD/qt.webkit-no_Werror.patch | patch -p1 --verbose || exit 1 + +# Fix crash on malformed GIF images (CVE-2014-0190): +cat $CWD/qt.fix.broken.gif.crash.diff | patch -p1 --verbose || exit 1 + +# Implement qsystemtrayicon support for Qt4 applications in Plasma 5: +cat $CWD/qt.qsystemtrayicon-plugin-system.diff | patch -p1 --verbose || exit 1 + +# Apply LibreOffice fixes (QTBUG-37380, QTBUG-34614, QTBUG-38585), +# Native KDE4 file pickers will be disabled at runtime otherwise. +cat $CWD/qt.glib-honor-ExcludeSocketNotifiers-flag.diff | patch -p1 --verbose || exit 1 +cat $CWD/qt.qclipboard_fix_recursive.patch | patch -p1 --verbose || exit 1 +cat $CWD/qt.qclipboard_delay.patch | 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 < $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 +) + +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: +# 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 < $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 < $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 < $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 < $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 +cat $CWD/doinst.sh > $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/deps/qt/qt.fix.broken.gif.crash.diff b/deps/qt/qt.fix.broken.gif.crash.diff new file mode 100644 index 0000000..7f74d71 --- /dev/null +++ b/deps/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/deps/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff b/deps/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff new file mode 100644 index 0000000..6949bbf --- /dev/null +++ b/deps/qt/qt.glib-honor-ExcludeSocketNotifiers-flag.diff @@ -0,0 +1,63 @@ +Author: Jan-Marek Glogowski +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 pollfds; + }; + +@@ -80,6 +81,9 @@ static gboolean socketNotifierSourceChec + GSocketNotifierSource *src = reinterpret_cast(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(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(g_source_new(&socketNotifierSourceFuncs, + sizeof(GSocketNotifierSource))); + (void) new (&socketNotifierSource->pollfds) QList(); ++ 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/deps/qt/qt.mysql.h.diff b/deps/qt/qt.mysql.h.diff new file mode 100644 index 0000000..7a41be5 --- /dev/null +++ b/deps/qt/qt.mysql.h.diff @@ -0,0 +1,12 @@ +diff -Nur qt-x11-opensource-src-4.3.4.orig/src/sql/drivers/mysql/qsql_mysql.h qt-x11-opensource-src-4.3.4/src/sql/drivers/mysql/qsql_mysql.h +--- qt-x11-opensource-src-4.3.4.orig/src/sql/drivers/mysql/qsql_mysql.h 2008-04-02 20:52:11.739343004 -0500 ++++ qt-x11-opensource-src-4.3.4/src/sql/drivers/mysql/qsql_mysql.h 2008-04-02 20:52:05.970610574 -0500 +@@ -51,7 +51,7 @@ + #include + #endif + +-#include ++#include + + #ifdef QT_PLUGIN + #define Q_EXPORT_SQLDRIVER_MYSQL diff --git a/deps/qt/qt.qclipboard_delay.patch b/deps/qt/qt.qclipboard_delay.patch new file mode 100644 index 0000000..dcdf51c --- /dev/null +++ b/deps/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/deps/qt/qt.qclipboard_fix_recursive.patch b/deps/qt/qt.qclipboard_fix_recursive.patch new file mode 100644 index 0000000..d9fe24b --- /dev/null +++ b/deps/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(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(s); + return (!canWait + || (source->serialNumber != source->lastSerialNumber)); + } +@@ -284,8 +292,14 @@ static gboolean postEventSourceDispatch( + { + GPostEventSource *source = reinterpret_cast(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(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/deps/qt/qt.qsystemtrayicon-plugin-system.diff b/deps/qt/qt.qsystemtrayicon-plugin-system.diff new file mode 100644 index 0000000..2466a16 --- /dev/null +++ b/deps/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(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 ++#include ++ ++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 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 +-#include +-#include +-#include +-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 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 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 + +-#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::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(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(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(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 ++#include ++#include ++#include ++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 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::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(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/deps/qt/qt.webkit-no_Werror.patch b/deps/qt/qt.webkit-no_Werror.patch new file mode 100644 index 0000000..c8d730e --- /dev/null +++ b/deps/qt/qt.webkit-no_Werror.patch @@ -0,0 +1,11 @@ +--- qt-everywhere-opensource-src-4.8.4/src/3rdparty/webkit/Source/WebKit.pri.no_Werror 2012-12-02 15:59:44.891550783 +0100 ++++ qt-everywhere-opensource-src-4.8.4/src/3rdparty/webkit/Source/WebKit.pri 2012-12-02 16:52:47.384406539 +0100 +@@ -102,8 +102,6 @@ + + # Treat warnings as errors on x86/Linux/GCC + linux-g++* { +- !CONFIG(standalone_package):if(isEqual(QT_ARCH,x86_64)|isEqual(QT_ARCH,i386)): QMAKE_CXXFLAGS += -Werror +- + greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) { + if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) { + # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr). diff --git a/deps/qt/slack-desc b/deps/qt/slack-desc new file mode 100644 index 0000000..0a42d4a --- /dev/null +++ b/deps/qt/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------------------------------------------------------| +qt: Qt (a multi-platform C++ graphical user interface toolkit) +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: +qt: +qt: +qt: +qt: diff --git a/deps/sni-qt/doinst.sh b/deps/sni-qt/doinst.sh new file mode 100644 index 0000000..16c59eb --- /dev/null +++ b/deps/sni-qt/doinst.sh @@ -0,0 +1,23 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/sni-qt.conf.new + diff --git a/deps/sni-qt/slack-desc b/deps/sni-qt/slack-desc new file mode 100644 index 0000000..bff69f8 --- /dev/null +++ b/deps/sni-qt/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------------------------------------------------------| +sni-qt: sni-qt (provide systray support for Qt4 apps in Plasma 5) +sni-qt: +sni-qt: Qt4 plugin which turns all QSystemTrayIcon into StatusNotifierItems +sni-qt: (appindicators). +sni-qt: Similar to libappindicator for GTK apps. +sni-qt: +sni-qt: +sni-qt: +sni-qt: +sni-qt: +sni-qt: See also: https://launchpad.net/sni-qt diff --git a/deps/sni-qt/sni-qt.SlackBuild b/deps/sni-qt/sni-qt.SlackBuild new file mode 100755 index 0000000..3f492df --- /dev/null +++ b/deps/sni-qt/sni-qt.SlackBuild @@ -0,0 +1,106 @@ +#!/bin/sh + +# Copyright 2015 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2015 Eric Hameleers, Eindhoven, NL +# 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. + +PKGNAM=sni-qt +VERSION=${VERSION:-0.2.6} +BUILD=${BUILD:-1} +NUMJOBS=${NUMJOBS:--j6} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i486 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7lh ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$(uname -m) ;; + esac + export ARCH +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" +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-${PKGNAM} + +rm -rf $PKG +mkdir -p $TMP $PKG +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1 +cd $PKGNAM-$VERSION || exit 1 + +# Disable building tests: +sed -i '/tests/ d' CMakeLists.txt + +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 {} \; + +mkdir -p build +cd build + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DMAN_INSTALL_DIR=/usr/man \ + -DLIB_SUFFIX=${LIBDIRSUFFIX} \ + .. + make $NUMJOBS || make || exit 1 + make install DESTDIR=$PKG || exit 1 +cd - + +# Install config file for apps that need "Activate" action: +install -Dm644 $CWD/sni-qt.conf $PKG/etc/sni-qt.conf.new + +find $PKG | xargs file | grep -e "executable" -e "shared object" \ + | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +mv $PKG/usr/share/man $PKG/usr/ +gzip -9 $PKG/usr/man/man?/*.1 + +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION +cp -a \ + COPYING* LGPL_EXCEPTION.txt NEWS README \ + $PKG/usr/doc/$PKGNAM-$VERSION + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n /tmp/$PKGNAM-$VERSION-$ARCH-$BUILD.txz + diff --git a/deps/sni-qt/sni-qt.conf b/deps/sni-qt/sni-qt.conf new file mode 100644 index 0000000..421dcad --- /dev/null +++ b/deps/sni-qt/sni-qt.conf @@ -0,0 +1,6 @@ +[need-activate-action] +clementine=1 +mumble=1 +skype=1 +speedcrunch=1 +keepassx=1 diff --git a/deps/updates.SlackBuild b/deps/updates.SlackBuild index b34b07c..3e3c2a7 100755 --- a/deps/updates.SlackBuild +++ b/deps/updates.SlackBuild @@ -14,6 +14,8 @@ TMP=${TMP:-/tmp} QTDIR=/usr/lib${LIBDIRSUFFIX}/qt ; export QTDIR ALLDEPS=" \ + qt \ + sni-qt \ cmake \ extra-cmake-modules \ strigi \ -- cgit v1.2.3