[Pkg-kde-commits] rev 1277 - in trunk/packages/qt-x11-free/debian: . patches
Adeodato Simó
adeodato@costa.debian.org
Tue, 12 Jul 2005 20:46:54 +0000
Author: adeodato
Date: 2005-07-12 20:46:53 +0000 (Tue, 12 Jul 2005)
New Revision: 1277
Added:
trunk/packages/qt-x11-free/debian/patches/25_qtc_qpixmap_mitshm.dpatch
trunk/packages/qt-x11-free/debian/patches/26_qtc_qpixmap_constants.dpatch
trunk/packages/qt-x11-free/debian/patches/27_qtc_qscrollview-windowactivate-fix.dpatch
trunk/packages/qt-x11-free/debian/patches/28_qtc_png-gamma-fix.dpatch
Modified:
trunk/packages/qt-x11-free/debian/changelog
trunk/packages/qt-x11-free/debian/patches/00list
Log:
Included from Christopher's changes:
* Add sundry fixes from KDE's qt-copy. (Closes: #303065)
Modified: trunk/packages/qt-x11-free/debian/changelog
===================================================================
--- trunk/packages/qt-x11-free/debian/changelog 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/changelog 2005-07-12 20:46:53 UTC (rev 1277)
@@ -18,6 +18,8 @@
+++ Changes by Christopher Martin:
+ * Add sundry fixes from KDE's qt-copy. (Closes: #303065)
+
* Fix qt3-designer's appearance in the KDE menu. (Closes: #290402)
* Don't use lib64 on amd64. (Closes: #311562)
Modified: trunk/packages/qt-x11-free/debian/patches/00list
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/00list 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/patches/00list 2005-07-12 20:46:53 UTC (rev 1277)
@@ -11,3 +11,7 @@
22_fix_ftbfs_amd64
23_qtc_qclipboard_hack
24_qtc_qscrollview
+25_qtc_qpixmap_mitshm
+26_qtc_qpixmap_constants
+27_qtc_qscrollview-windowactivate-fix
+28_qtc_png-gamma-fix
Added: trunk/packages/qt-x11-free/debian/patches/25_qtc_qpixmap_mitshm.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/25_qtc_qpixmap_mitshm.dpatch 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/patches/25_qtc_qpixmap_mitshm.dpatch 2005-07-12 20:46:53 UTC (rev 1277)
@@ -0,0 +1,548 @@
+#! /bin/sh -e
+## 24_qtc_qscrollview.dpatch by Germain Garand <germain@ebooksfrance.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix the qscrollview stuff
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+--- qt.orig/src/kernel/qpixmap_x11.cpp
++++ qt.patched/src/kernel/qpixmap_x11.cpp
+@@ -37,7 +37,19 @@
+
+ // NOT REVISED
+
++#include "qplatformdefs.h"
++
++#if defined(Q_OS_WIN32) && defined(QT_MITSHM)
++#undef QT_MITSHM
++#endif
++
++#ifdef QT_MITSHM
++
++// Use the MIT Shared Memory extension for pixmap<->image conversions
++#define QT_MITSHM_CONVERSIONS
++
+ // Uncomment the next line to enable the MIT Shared Memory extension
++// for QPixmap::xForm()
+ //
+ // WARNING: This has some problems:
+ //
+@@ -45,14 +57,13 @@
+ // 2. Qt does not handle the ShmCompletion message, so you will
+ // get strange effects if you xForm() repeatedly.
+ //
+-// #define QT_MITSHM
++// #define QT_MITSHM_XFORM
+
+-#if defined(Q_OS_WIN32) && defined(QT_MITSHM)
+-#undef QT_MITSHM
++#else
++#undef QT_MITSHM_CONVERSIONS
++#undef QT_MITSHM_XFORM
+ #endif
+
+-#include "qplatformdefs.h"
+-
+ #include "qbitmap.h"
+ #include "qpaintdevicemetrics.h"
+ #include "qimage.h"
+@@ -91,7 +102,7 @@ inline static void qSafeXDestroyImage( X
+ MIT Shared Memory Extension support: makes xForm noticeably (~20%) faster.
+ *****************************************************************************/
+
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+
+ static bool xshminit = FALSE;
+ static XShmSegmentInfo xshminfo;
+@@ -173,8 +184,100 @@ static bool qt_create_mitshm_buffer( con
+ // return FALSE;
+ // }
+
+-#endif // QT_MITSHM
++#endif // QT_MITSHM_XFORM
+
++#ifdef QT_MITSHM_CONVERSIONS
++
++static bool qt_mitshm_error = false;
++static int qt_mitshm_errorhandler( Display*, XErrorEvent* )
++{
++ qt_mitshm_error = true;
++ return 0;
++}
++
++static XImage* qt_XShmCreateImage( Display* dpy, Visual* visual, unsigned int depth,
++ int format, int /*offset*/, char* /*data*/, unsigned int width, unsigned int height,
++ int /*bitmap_pad*/, int /*bytes_per_line*/, XShmSegmentInfo* shminfo )
++{
++ if( width * height * depth < 100*100*32 )
++ return NULL;
++ static int shm_inited = -1;
++ if( shm_inited == -1 ) {
++ if( XShmQueryExtension( dpy ))
++ shm_inited = 1;
++ else
++ shm_inited = 0;
++ }
++ if( shm_inited == 0 )
++ return NULL;
++ XImage* xi = XShmCreateImage( dpy, visual, depth, format, NULL, shminfo, width,
++ height );
++ if( xi == NULL )
++ return NULL;
++ shminfo->shmid = shmget( IPC_PRIVATE, xi->bytes_per_line * xi->height,
++ IPC_CREAT|0600);
++ if( shminfo->shmid < 0 ) {
++ XDestroyImage( xi );
++ return NULL;
++ }
++ shminfo->readOnly = False;
++ shminfo->shmaddr = (char*)shmat( shminfo->shmid, 0, 0 );
++ if( shminfo->shmaddr == (char*)-1 ) {
++ XDestroyImage( xi );
++ shmctl( shminfo->shmid, IPC_RMID, 0 );
++ return NULL;
++ }
++ xi->data = shminfo->shmaddr;
++#ifndef QT_MITSHM_RMID_IGNORES_REFCOUNT
++ // mark as deleted to automatically free the memory in case
++ // of a crash (but this doesn't work e.g. on Solaris)
++ shmctl( shminfo->shmid, IPC_RMID, 0 );
++#endif
++ if( shm_inited == 1 ) { // first time
++ XErrorHandler old_h = XSetErrorHandler( qt_mitshm_errorhandler );
++ XShmAttach( dpy, shminfo );
++ shm_inited = 2;
++ XSync( dpy, False );
++ XSetErrorHandler( old_h );
++ if( qt_mitshm_error ) { // oops ... perhaps we are remote?
++ shm_inited = 0;
++ XDestroyImage( xi );
++ shmdt( shminfo->shmaddr );
++#ifdef QT_MITSHM_RMID_IGNORES_REFCOUNT
++ shmctl( shminfo->shmid, IPC_RMID, 0 );
++#endif
++ return NULL;
++ }
++ } else
++ XShmAttach( dpy, shminfo );
++ return xi;
++}
++
++static void qt_XShmDestroyImage( XImage* xi, XShmSegmentInfo* shminfo )
++{
++ XShmDetach( QPaintDevice::x11AppDisplay(), shminfo );
++ XDestroyImage( xi );
++ shmdt( shminfo->shmaddr );
++#ifdef QT_MITSHM_RMID_IGNORES_REFCOUNT
++ shmctl( shminfo->shmid, IPC_RMID, 0 );
++#endif
++}
++
++static XImage* qt_XShmGetImage( const QPixmap* pix, int format,
++ XShmSegmentInfo* shminfo )
++{
++ XImage* xi = qt_XShmCreateImage( pix->x11Display(), (Visual*)pix->x11Visual(),
++ pix->depth(), format, 0, 0, pix->width(), pix->height(), 32, 0, shminfo );
++ if( xi == NULL )
++ return NULL;
++ if( XShmGetImage( pix->x11Display(), pix->handle(), xi, 0, 0, AllPlanes ) == False ) {
++ qt_XShmDestroyImage( xi, shminfo );
++ return NULL;
++ }
++ return xi;
++}
++
++#endif // QT_MITSHM_CONVERSIONS
+
+ /*****************************************************************************
+ Internal functions
+@@ -625,9 +728,20 @@ QImage QPixmap::convertToImage() const
+ d = 32; // > 8 ==> 32
+
+ XImage *xi = (XImage *)data->ximage; // any cached ximage?
+- if ( !xi ) // fetch data from X server
+- xi = XGetImage( x11Display(), hd, 0, 0, w, h, AllPlanes,
++#ifdef QT_MITSHM_CONVERSIONS
++ bool mitshm_ximage = false;
++ XShmSegmentInfo shminfo;
++#endif
++ if ( !xi ) { // fetch data from X server
++#ifdef QT_MITSHM_CONVERSIONS
++ xi = qt_XShmGetImage( this, mono ? XYPixmap : ZPixmap, &shminfo );
++ if( xi ) {
++ mitshm_ximage = true;
++ } else
++#endif
++ xi = XGetImage( x11Display(), hd, 0, 0, w, h, AllPlanes,
+ mono ? XYPixmap : ZPixmap );
++ }
+ Q_CHECK_PTR( xi );
+
+ QImage::Endian bitOrder = QImage::IgnoreEndian;
+@@ -636,15 +750,31 @@ QImage QPixmap::convertToImage() const
+ QImage::LittleEndian : QImage::BigEndian;
+ }
+ image.create( w, h, d, 0, bitOrder );
+- if ( image.isNull() ) // could not create image
++ if ( image.isNull() ) { // could not create image
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ qt_XShmDestroyImage( xi, &shminfo );
++ else
++#endif
++ qSafeXDestroyImage( xi );
+ return image;
++ }
+
+ const QPixmap* msk = mask();
+ const QPixmap *alf = data->alphapm;
+
+ QImage alpha;
+ if (alf) {
+- XImage *axi = XGetImage(x11Display(), alf->hd, 0, 0, w, h, AllPlanes, ZPixmap);
++ XImage* axi;
++#ifdef QT_MITSHM_CONVERSIONS
++ bool mitshm_aximage = false;
++ XShmSegmentInfo ashminfo;
++ axi = qt_XShmGetImage( alf, ZPixmap, &ashminfo );
++ if( axi ) {
++ mitshm_aximage = true;
++ } else
++#endif
++ axi = XGetImage(x11Display(), alf->hd, 0, 0, w, h, AllPlanes, ZPixmap);
+
+ if (axi) {
+ image.setAlphaBuffer( TRUE );
+@@ -658,7 +788,12 @@ QImage QPixmap::convertToImage() const
+ src += axi->bytes_per_line;
+ }
+
+- qSafeXDestroyImage( axi );
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_aximage )
++ qt_XShmDestroyImage( axi, &ashminfo );
++ else
++#endif
++ qSafeXDestroyImage( axi );
+ }
+ } else if (msk) {
+ image.setAlphaBuffer( TRUE );
+@@ -800,6 +935,12 @@ QImage QPixmap::convertToImage() const
+ xi->bits_per_pixel );
+ #endif
+ image.reset();
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ qt_XShmDestroyImage( xi, &shminfo );
++ else
++#endif
++ qSafeXDestroyImage( xi );
+ return image;
+ }
+
+@@ -905,10 +1046,22 @@ QImage QPixmap::convertToImage() const
+ delete [] carr;
+ }
+ if ( data->optim != BestOptim ) { // throw away image data
+- qSafeXDestroyImage( xi );
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ qt_XShmDestroyImage( xi, &shminfo );
++ else
++#endif
++ qSafeXDestroyImage( xi );
+ ((QPixmap*)this)->data->ximage = 0;
+- } else // keep ximage data
++ } else { // keep ximage data
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage ) { // copy the XImage?
++ qt_XShmDestroyImage( xi, &shminfo );
++ xi = 0;
++ }
++#endif
+ ((QPixmap*)this)->data->ximage = xi;
++ }
+
+ return image;
+ }
+@@ -1078,6 +1231,11 @@ bool QPixmap::convertFromImage( const QI
+ bool trucol = (visual->c_class == TrueColor);
+ int nbytes = image.numBytes();
+ uchar *newbits= 0;
++ int newbits_size = 0;
++#ifdef QT_MITSHM_CONVERSIONS
++ bool mitshm_ximage = false;
++ XShmSegmentInfo shminfo;
++#endif
+
+ if ( trucol ) { // truecolor display
+ QRgb pix[256]; // pixel translation table
+@@ -1106,9 +1264,18 @@ bool QPixmap::convertFromImage( const QI
+ }
+ }
+
+- xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
++#ifdef QT_MITSHM_CONVERSIONS
++ xi = qt_XShmCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0, &shminfo );
++ if( xi != NULL ) {
++ mitshm_ximage = true;
++ newbits = (uchar*)xi->data;
++ }
++ else
++#endif
++ xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
+ Q_CHECK_PTR( xi );
+- newbits = (uchar *)malloc( xi->bytes_per_line*h );
++ if( newbits == NULL )
++ newbits = (uchar *)malloc( xi->bytes_per_line*h );
+ Q_CHECK_PTR( newbits );
+ if ( !newbits ) // no memory
+ return FALSE;
+@@ -1314,6 +1481,7 @@ bool QPixmap::convertFromImage( const QI
+ }
+
+ newbits = (uchar *)malloc( nbytes ); // copy image into newbits
++ newbits_size = nbytes;
+ Q_CHECK_PTR( newbits );
+ if ( !newbits ) // no memory
+ return FALSE;
+@@ -1431,11 +1599,18 @@ bool QPixmap::convertFromImage( const QI
+ }
+
+ if ( !xi ) { // X image not created
+- xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
++#ifdef QT_MITSHM_CONVERSIONS
++ xi = qt_XShmCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0, &shminfo );
++ if( xi != NULL )
++ mitshm_ximage = true;
++ else
++#endif
++ xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
+ if ( xi->bits_per_pixel == 16 ) { // convert 8 bpp ==> 16 bpp
+ ushort *p2;
+ int p2inc = xi->bytes_per_line/sizeof(ushort);
+ ushort *newerbits = (ushort *)malloc( xi->bytes_per_line * h );
++ newbits_size = xi->bytes_per_line * h;
+ Q_CHECK_PTR( newerbits );
+ if ( !newerbits ) // no memory
+ return FALSE;
+@@ -1453,7 +1628,15 @@ bool QPixmap::convertFromImage( const QI
+ "(bpp=%d)", xi->bits_per_pixel );
+ #endif
+ }
+- xi->data = (char *)newbits;
++#ifdef QT_MITSHM_CONVERSIONS
++ if( newbits_size > 0 && mitshm_ximage ) { // need to copy to shared memory
++ memcpy( xi->data, newbits, newbits_size );
++ free( newbits );
++ newbits = (uchar*)xi->data;
++ }
++ else
++#endif
++ xi->data = (char *)newbits;
+ }
+
+ if ( hd && (width() != (int)w || height() != (int)h || this->depth() != dd) ) {
+@@ -1486,19 +1669,24 @@ bool QPixmap::convertFromImage( const QI
+
+ }
+
+- XPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ),
+- xi, 0, 0, 0, 0, w, h );
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ XShmPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ),
++ xi, 0, 0, 0, 0, w, h, False );
++ else
++#endif
++ XPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ),
++ xi, 0, 0, 0, 0, w, h );
+
+- if ( data->optim != BestOptim ) { // throw away image
+- qSafeXDestroyImage( xi );
+- data->ximage = 0;
+- } else { // keep ximage that we created
+- data->ximage = xi;
+- }
+ data->w = w;
+ data->h = h;
+ data->d = dd;
+
++ XImage* axi = NULL;
++#ifdef QT_MITSHM_CONVERSIONS
++ bool mitshm_aximage = false;
++ XShmSegmentInfo ashminfo;
++#endif
+ if ( image.hasAlphaBuffer() ) {
+ QBitmap m;
+ m = image.createAlphaMask( conversion_flags );
+@@ -1534,13 +1722,22 @@ bool QPixmap::convertFromImage( const QI
+ data->alphapm->rendhd =
+ (HANDLE) XftDrawCreateAlpha( x11Display(), data->alphapm->hd, 8 );
+
+- XImage *axi = XCreateImage(x11Display(), (Visual *) x11Visual(),
+- 8, ZPixmap, 0, 0, w, h, 8, 0);
++#ifdef QT_MITSHM_CONVERSIONS
++ axi = qt_XShmCreateImage( x11Display(), (Visual*)x11Visual(),
++ 8, ZPixmap, 0, 0, w, h, 8, 0, &ashminfo );
++ if( axi != NULL )
++ mitshm_aximage = true;
++ else
++#endif
++ axi = XCreateImage(x11Display(), (Visual *) x11Visual(),
++ 8, ZPixmap, 0, 0, w, h, 8, 0);
+
+ if (axi) {
+- // the data is deleted by qSafeXDestroyImage
+- axi->data = (char *) malloc(h * axi->bytes_per_line);
+- Q_CHECK_PTR( axi->data );
++ if( axi->data==NULL ) {
++ // the data is deleted by qSafeXDestroyImage
++ axi->data = (char *) malloc(h * axi->bytes_per_line);
++ Q_CHECK_PTR( axi->data );
++ }
+ char *aptr = axi->data;
+
+ if (image.depth() == 32) {
+@@ -1558,14 +1755,48 @@ bool QPixmap::convertFromImage( const QI
+ }
+
+ GC gc = XCreateGC(x11Display(), data->alphapm->hd, 0, 0);
+- XPutImage(dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h);
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_aximage )
++ XShmPutImage( dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h, False );
++ else
++#endif
++ XPutImage(dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h);
+ XFreeGC(x11Display(), gc);
+- qSafeXDestroyImage(axi);
+ }
+ }
+ #endif // QT_NO_XFTFREETYPE
+ }
+
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage || mitshm_aximage )
++ XSync( x11Display(), False ); // wait until processed
++#endif
++
++ if ( data->optim != BestOptim ) { // throw away image
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ qt_XShmDestroyImage( xi, &shminfo );
++ else
++#endif
++ qSafeXDestroyImage( xi );
++ data->ximage = 0;
++ } else { // keep ximage that we created
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage ) { // copy the XImage?
++ qt_XShmDestroyImage( xi, &shminfo );
++ xi = 0;
++ }
++#endif
++ data->ximage = xi;
++ }
++ if( axi ) {
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_aximage )
++ qt_XShmDestroyImage( axi, &ashminfo );
++ else
++#endif
++ qSafeXDestroyImage(axi);
++ }
+ return TRUE;
+ }
+
+@@ -1722,7 +1953,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ return pm;
+ }
+
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ static bool try_once = TRUE;
+ if (try_once) {
+ try_once = FALSE;
+@@ -1755,7 +1986,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ dbpl = ((w*bpp+31)/32)*4;
+ dbytes = dbpl*h;
+
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ if ( use_mitshm ) {
+ dptr = (uchar *)xshmimg->data;
+ uchar fillbyte = bpp == 8 ? white.pixel() : 0xff;
+@@ -1771,7 +2002,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ memset( dptr, Qt::white.pixel( x11Screen() ), dbytes );
+ else
+ memset( dptr, 0xff, dbytes );
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ }
+ #endif
+
+@@ -1802,7 +2033,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ } else {
+ xbpl = (w*bpp)/8;
+ p_inc = dbpl - xbpl;
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ if ( use_mitshm )
+ p_inc = xshmimg->bytes_per_line - xbpl;
+ #endif
+@@ -1839,7 +2070,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ QPixmap pm( w, h );
+ pm.data->uninit = FALSE;
+ pm.x11SetScreen( x11Screen() );
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ if ( use_mitshm ) {
+ XCopyArea( dpy, xshmpm, pm.handle(), gc, 0, 0, w, h, 0, 0 );
+ } else {
+@@ -1848,7 +2079,7 @@ QPixmap QPixmap::xForm( const QWMatrix &
+ ZPixmap, 0, (char *)dptr, w, h, 32, 0 );
+ XPutImage( dpy, pm.handle(), gc, xi, 0, 0, 0, 0, w, h);
+ qSafeXDestroyImage( xi );
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ }
+ #endif
+
+--- qt.orig/mkspecs/linux-g++/qplatformdefs.h
++++ qt.patched/mkspecs/linux-g++/qplatformdefs.h
+@@ -102,5 +102,6 @@
+ #define QT_VSNPRINTF ::vsnprintf
+ #endif
+
++#define QT_MITSHM
+
+ #endif // QPLATFORMDEFS_H
+--- qt.orig/mkspecs/linux-g++/qplatformdefs.h
++++ qt.patched/mkspecs/linux-g++/qplatformdefs.h
+@@ -102,5 +102,6 @@
+ #define QT_VSNPRINTF ::vsnprintf
+ #endif
+
++#define QT_MITSHM
+
+ #endif // QPLATFORMDEFS_H
Added: trunk/packages/qt-x11-free/debian/patches/26_qtc_qpixmap_constants.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/26_qtc_qpixmap_constants.dpatch 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/patches/26_qtc_qpixmap_constants.dpatch 2005-07-12 20:46:53 UTC (rev 1277)
@@ -0,0 +1,402 @@
+#! /bin/sh -e
+## 24_qtc_qscrollview.dpatch by Germain Garand <germain@ebooksfrance.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix the qscrollview stuff
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+--- qt.orig/src/kernel/qpixmap_x11.cpp
++++ qt.patch/src/kernel/qpixmap_x11.cpp
+@@ -1278,9 +1278,6 @@ bool QPixmap::convertFromImage( const QI
+ return FALSE;
+ int bppc = xi->bits_per_pixel;
+
+- if ( bppc > 8 && xi->byte_order == LSBFirst )
+- bppc++;
+-
+ bool contig_bits = n_bits(red_mask) == rbits &&
+ n_bits(green_mask) == gbits &&
+ n_bits(blue_mask) == bbits;
+@@ -1329,32 +1326,70 @@ bool QPixmap::convertFromImage( const QI
+ }
+ init=TRUE;
+ }
++
++ enum { BPP8,
++ BPP16_8_3_M3, BPP16_7_2_M3, BPP16_MSB, BPP16_LSB,
++ BPP24_MSB, BPP24_LSB,
++ BPP32_16_8_0, BPP32_MSB, BPP32_LSB
++ } mode = BPP8;
+
+- for ( uint y=0; y<h; y++ ) {
+- uchar* src = image.scanLine( y );
+- uchar* dst = newbits + xi->bytes_per_line*y;
+- QRgb* p = (QRgb *)src;
++ if ( bppc > 8 && xi->byte_order == LSBFirst )
++ bppc++;
+
+-#define GET_RGB \
+- int r = qRed ( *p ); \
+- int g = qGreen( *p ); \
+- int b = qBlue ( *p++ ); \
+- r = red_shift > 0 \
+- ? r << red_shift : r >> -red_shift; \
+- g = green_shift > 0 \
+- ? g << green_shift : g >> -green_shift; \
+- b = blue_shift > 0 \
+- ? b << blue_shift : b >> -blue_shift;
++ int wordsize;
++ bool bigendian;
++ qSysInfo( &wordsize, &bigendian );
++ bool same_msb_lsb = ( xi->byte_order == MSBFirst ) == ( bigendian );
++
++ if( bppc == 8 ) // 8 bit
++ mode = BPP8;
++ else if( bppc == 16 || bppc == 17 ) { // 16 bit MSB/LSB
++ if( red_shift == 8 && green_shift == 3 && blue_shift == -3
++ && !d8 && same_msb_lsb )
++ mode = BPP16_8_3_M3;
++ else if( red_shift == 7 && green_shift == 2 && blue_shift == -3
++ && !d8 && same_msb_lsb )
++ mode = BPP16_7_2_M3;
++ else
++ mode = bppc == 17 ? BPP16_LSB : BPP16_MSB;
++ } else if( bppc == 24 || bppc == 25 ) { // 24 bit MSB/LSB
++ mode = bppc == 25 ? BPP24_LSB : BPP24_MSB;
++ } else if( bppc == 32 || bppc == 33 ) { // 32 bit MSB/LSB
++ if( red_shift == 16 && green_shift == 8 && blue_shift == 0
++ && !d8 && same_msb_lsb )
++ mode = BPP32_16_8_0;
++ else
++ mode = bppc == 33 ? BPP32_LSB : BPP32_MSB;
++ } else
++ qFatal("Logic error 3");
+
+ #define GET_PIXEL \
+ int pixel; \
+ if ( d8 ) pixel = pix[*src++]; \
+ else { \
+- GET_RGB \
+- pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask) \
++ int r = qRed ( *p ); \
++ int g = qGreen( *p ); \
++ int b = qBlue ( *p++ ); \
++ r = red_shift > 0 \
++ ? r << red_shift : r >> -red_shift; \
++ g = green_shift > 0 \
++ ? g << green_shift : g >> -green_shift; \
++ b = blue_shift > 0 \
++ ? b << blue_shift : b >> -blue_shift; \
++ pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask) \
+ | ~(blue_mask | green_mask | red_mask); \
+ }
+
++// optimized case - no d8 case, shift only once instead of twice, mask only once instead of twice,
++// use direct values instead of variables, and use only one statement
++// (*p >> 16), (*p >> 8 ) and (*p) are qRed(),qGreen() and qBlue() without masking
++// shifts have to be passed including the shift operator (e.g. '>>3'), because of the direction
++#define GET_PIXEL_OPT(red_shift,green_shift,blue_shift,red_mask,green_mask,blue_mask) \
++ int pixel = ((( *p >> 16 ) red_shift ) & red_mask ) \
++ | ((( *p >> 8 ) green_shift ) & green_mask ) \
++ | ((( *p ) blue_shift ) & blue_mask ); \
++ ++p;
++
+ #define GET_PIXEL_DITHER_TC \
+ int r = qRed ( *p ); \
+ int g = qGreen( *p ); \
+@@ -1374,91 +1409,177 @@ bool QPixmap::convertFromImage( const QI
+ ? g << green_shift : g >> -green_shift; \
+ b = blue_shift > 0 \
+ ? b << blue_shift : b >> -blue_shift; \
+- int pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask);
++ int pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask);
+
+- if ( dither_tc ) {
+- uint x;
+- switch ( bppc ) {
+- case 16: // 16 bit MSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL_DITHER_TC
+- *dst++ = (pixel >> 8);
+- *dst++ = pixel;
+- }
++// again, optimized case
++// can't be optimized that much :(
++#define GET_PIXEL_DITHER_TC_OPT(red_shift,green_shift,blue_shift,red_mask,green_mask,blue_mask, \
++ rbits,gbits,bbits) \
++ const int thres = D[x%16][y%16]; \
++ int r = qRed ( *p ); \
++ if ( r <= (255-(1<<(8-rbits))) && ((r<<rbits) & 255) \
++ > thres) \
++ r += (1<<(8-rbits)); \
++ int g = qGreen( *p ); \
++ if ( g <= (255-(1<<(8-gbits))) && ((g<<gbits) & 255) \
++ > thres) \
++ g += (1<<(8-gbits)); \
++ int b = qBlue ( *p++ ); \
++ if ( b <= (255-(1<<(8-bbits))) && ((b<<bbits) & 255) \
++ > thres) \
++ b += (1<<(8-bbits)); \
++ int pixel = (( r red_shift ) & red_mask ) \
++ | (( g green_shift ) & green_mask ) \
++ | (( b blue_shift ) & blue_mask );
++
++#define CYCLE(body) \
++ for ( uint y=0; y<h; y++ ) { \
++ uchar* src = image.scanLine( y ); \
++ uchar* dst = newbits + xi->bytes_per_line*y; \
++ QRgb* p = (QRgb *)src; \
++ body \
++ }
++
++ if ( dither_tc ) {
++ switch ( mode ) {
++ case BPP16_8_3_M3:
++ CYCLE(
++ Q_INT16* dst16 = (Q_INT16*)dst;
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_DITHER_TC_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f,5,6,5)
++ *dst16++ = pixel;
++ }
++ )
+ break;
+- case 17: // 16 bit LSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL_DITHER_TC
+- *dst++ = pixel;
+- *dst++ = pixel >> 8;
+- }
++ case BPP16_7_2_M3:
++ CYCLE(
++ Q_INT16* dst16 = (Q_INT16*)dst;
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_DITHER_TC_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f,5,5,5)
++ *dst16++ = pixel;
++ }
++ )
++ break;
++ case BPP16_MSB: // 16 bit MSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_DITHER_TC
++ *dst++ = (pixel >> 8);
++ *dst++ = pixel;
++ }
++ )
++ break;
++ case BPP16_LSB: // 16 bit LSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_DITHER_TC
++ *dst++ = pixel;
++ *dst++ = pixel >> 8;
++ }
++ )
+ break;
+ default:
+ qFatal("Logic error");
+ }
+- } else {
+- uint x;
+- switch ( bppc ) {
+- case 8: // 8 bit
+- for ( x=0; x<w; x++ ) {
+- int pixel = pix[*src++];
+- *dst++ = pixel;
+- }
++ } else {
++ switch ( mode ) {
++ case BPP8: // 8 bit
++ CYCLE(
++ Q_UNUSED(p);
++ for ( uint x=0; x<w; x++ ) {
++ int pixel = pix[*src++];
++ *dst++ = pixel;
++ }
++ )
+ break;
+- case 16: // 16 bit MSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = (pixel >> 8);
+- *dst++ = pixel;
+- }
++ case BPP16_8_3_M3:
++ CYCLE(
++ Q_INT16* dst16 = (Q_INT16*)dst;
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f)
++ *dst16++ = pixel;
++ }
++ )
+ break;
+- case 17: // 16 bit LSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = pixel;
+- *dst++ = pixel >> 8;
+- }
++ case BPP16_7_2_M3:
++ CYCLE(
++ Q_INT16* dst16 = (Q_INT16*)dst;
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f)
++ *dst16++ = pixel;
++ }
++ )
+ break;
+- case 24: // 24 bit MSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = pixel >> 16;
+- *dst++ = pixel >> 8;
+- *dst++ = pixel;
+- }
++ case BPP16_MSB: // 16 bit MSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = (pixel >> 8);
++ *dst++ = pixel;
++ }
++ )
+ break;
+- case 25: // 24 bit LSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = pixel;
+- *dst++ = pixel >> 8;
+- *dst++ = pixel >> 16;
+- }
++ case BPP16_LSB: // 16 bit LSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = pixel;
++ *dst++ = pixel >> 8;
++ }
++ )
+ break;
+- case 32: // 32 bit MSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = pixel >> 24;
+- *dst++ = pixel >> 16;
+- *dst++ = pixel >> 8;
+- *dst++ = pixel;
+- }
++ case BPP24_MSB: // 24 bit MSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = pixel >> 16;
++ *dst++ = pixel >> 8;
++ *dst++ = pixel;
++ }
++ )
+ break;
+- case 33: // 32 bit LSB
+- for ( x=0; x<w; x++ ) {
+- GET_PIXEL
+- *dst++ = pixel;
+- *dst++ = pixel >> 8;
+- *dst++ = pixel >> 16;
+- *dst++ = pixel >> 24;
+- }
++ case BPP24_LSB: // 24 bit LSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = pixel;
++ *dst++ = pixel >> 8;
++ *dst++ = pixel >> 16;
++ }
++ )
+ break;
+- default:
+- qFatal("Logic error 2");
+- }
+- }
+- }
+- xi->data = (char *)newbits;
++ case BPP32_16_8_0:
++ CYCLE(
++ memcpy( dst, p, w * 4 );
++ )
++ break;
++ case BPP32_MSB: // 32 bit MSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = pixel >> 24;
++ *dst++ = pixel >> 16;
++ *dst++ = pixel >> 8;
++ *dst++ = pixel;
++ }
++ )
++ break;
++ case BPP32_LSB: // 32 bit LSB
++ CYCLE(
++ for ( uint x=0; x<w; x++ ) {
++ GET_PIXEL
++ *dst++ = pixel;
++ *dst++ = pixel >> 8;
++ *dst++ = pixel >> 16;
++ *dst++ = pixel >> 24;
++ }
++ )
++ break;
++ default:
++ qFatal("Logic error 2");
++ }
++ }
++ xi->data = (char *)newbits;
+ }
+
+ if ( d == 8 && !trucol ) { // 8 bit pixmap
+@@ -1738,15 +1859,24 @@ bool QPixmap::convertFromImage( const QI
+
+ if (image.depth() == 32) {
+ const int *iptr = (const int *) image.bits();
+- int max = w * h;
+- while (max--)
+- *aptr++ = *iptr++ >> 24; // squirt
++ if( axi->bytes_per_line == (int)w ) {
++ int max = w * h;
++ while (max--)
++ *aptr++ = *iptr++ >> 24; // squirt
++ } else {
++ for (uint i = 0; i < h; ++i ) {
++ for (uint j = 0; j < w; ++j )
++ *aptr++ = *iptr++ >> 24; // squirt
++ aptr += ( axi->bytes_per_line - w );
++ }
++ }
+ } else if (image.depth() == 8) {
+ const QRgb * const rgb = image.colorTable();
+ for (uint y = 0; y < h; ++y) {
+ const uchar *iptr = image.scanLine(y);
+ for (uint x = 0; x < w; ++x)
+ *aptr++ = qAlpha(rgb[*iptr++]);
++ aptr += ( axi->bytes_per_line - w );
+ }
+ }
+
Added: trunk/packages/qt-x11-free/debian/patches/27_qtc_qscrollview-windowactivate-fix.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/27_qtc_qscrollview-windowactivate-fix.dpatch 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/patches/27_qtc_qscrollview-windowactivate-fix.dpatch 2005-07-12 20:46:53 UTC (rev 1277)
@@ -0,0 +1,37 @@
+#! /bin/sh -e
+## 24_qtc_qscrollview.dpatch by Germain Garand <germain@ebooksfrance.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix the qscrollview stuff
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+--- qt.orig/src/widgets/qscrollview.cpp
++++ qt.patch/src/widgets/qscrollview.cpp
+@@ -1551,6 +1551,9 @@
+ case QEvent::LayoutHint:
+ d->autoResizeHint(this);
+ break;
++ case QEvent::WindowActivate:
++ case QEvent::WindowDeactivate:
++ return TRUE;
+ default:
+ break;
+ }
Added: trunk/packages/qt-x11-free/debian/patches/28_qtc_png-gamma-fix.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/28_qtc_png-gamma-fix.dpatch 2005-07-12 20:39:57 UTC (rev 1276)
+++ trunk/packages/qt-x11-free/debian/patches/28_qtc_png-gamma-fix.dpatch 2005-07-12 20:46:53 UTC (rev 1277)
@@ -0,0 +1,51 @@
+#! /bin/sh -e
+## 24_qtc_qscrollview.dpatch by Germain Garand <germain@ebooksfrance.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix the qscrollview stuff
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+--- qt.orig/src/kernel/qpngio.cpp
++++ qt.patch/src/kernel/qpngio.cpp
+@@ -109,12 +109,20 @@ void CALLBACK_CALL_TYPE qpiw_flush_fn( p
+
+ static
+ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr, float screen_gamma=0.0 )
+ {
+- if ( screen_gamma != 0.0 && png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) ) {
++ if ( 0.0 == screen_gamma )
++ // PNG docs say this is a good guess for a PC monitor
++ // in a dark room
++ screen_gamma = 2.2;
++ if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) ) {
++ // the file has a gAMA attribute
+ double file_gamma;
+- png_get_gAMA(png_ptr, info_ptr, &file_gamma);
+- png_set_gamma( png_ptr, screen_gamma, file_gamma );
++ if ( png_get_gAMA(png_ptr, info_ptr, &file_gamma))
++ png_set_gamma( png_ptr, screen_gamma, file_gamma );
++ } else {
++ // no file gamma, use a reasonable default
++ png_set_gamma( png_ptr, screen_gamma, 0.45455 );
+ }
+
+ png_uint_32 width;
+ png_uint_32 height;