rev 9363 - trunk/packages/qt-x11-free/debian/patches
Fathi Boudra
fabo at alioth.debian.org
Sat Feb 9 10:40:03 UTC 2008
Author: fabo
Date: 2008-02-09 10:40:03 +0000 (Sat, 09 Feb 2008)
New Revision: 9363
Added:
trunk/packages/qt-x11-free/debian/patches/0001-dnd_optimization.diff
trunk/packages/qt-x11-free/debian/patches/0002-dnd_active_window_fix.diff
trunk/packages/qt-x11-free/debian/patches/0005-qpixmap_mitshm.diff
trunk/packages/qt-x11-free/debian/patches/0007-qpixmap_constants.diff
trunk/packages/qt-x11-free/debian/patches/0032-fix_rotated_randr.diff
trunk/packages/qt-x11-free/debian/patches/0038-dragobject-dont-prefer-unknown.diff
trunk/packages/qt-x11-free/debian/patches/0044-qscrollview-windowactivate-fix.diff
trunk/packages/qt-x11-free/debian/patches/0047-fix-kmenu-width.diff
trunk/packages/qt-x11-free/debian/patches/0048-qclipboard_hack_80072.diff
trunk/packages/qt-x11-free/debian/patches/0056-khotkeys_input_84434.diff
trunk/packages/qt-x11-free/debian/patches/0059-qpopup_has_mouse.diff
trunk/packages/qt-x11-free/debian/patches/0060-qpopup_ignore_mousepos.diff
trunk/packages/qt-x11-free/debian/patches/0061-qscrollview-propagate-horizontal-wheelevent.diff
trunk/packages/qt-x11-free/debian/patches/0073-xinerama-aware-qpopup.diff
trunk/packages/qt-x11-free/debian/patches/0079-compositing-types.diff
trunk/packages/qt-x11-free/debian/patches/0080-net-wm-sync-request.diff
trunk/packages/qt-x11-free/debian/patches/0083-CVE-2007-4137.diff
trunk/packages/qt-x11-free/debian/patches/0085-fix-buildkey.diff
Log:
Add qt-copy patches we had previously but with a modified name.
It will be easier to track changes if any ;)
Added: trunk/packages/qt-x11-free/debian/patches/0001-dnd_optimization.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0001-dnd_optimization.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0001-dnd_optimization.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,188 @@
+qt-bugs@ issue : 16115
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+See http://lists.kde.org/?t=104388858900001&r=1&w=2
+
+
+
+--- a/src/kernel/qdnd_x11.cpp
++++ b/src/kernel/qdnd_x11.cpp
+@@ -52,13 +52,15 @@
+ #include "qdragobject.h"
+ #include "qobjectlist.h"
+ #include "qcursor.h"
++#include "qbitmap.h"
++#include "qpainter.h"
+
+ #include "qt_x11_p.h"
+
+ // conflict resolution
+
+-// unused, may be used again later: const int XKeyPress = KeyPress;
+-// unused, may be used again later: const int XKeyRelease = KeyRelease;
++const int XKeyPress = KeyPress;
++const int XKeyRelease = KeyRelease;
+ #undef KeyPress
+ #undef KeyRelease
+
+@@ -256,20 +258,47 @@
+ public:
+ QShapedPixmapWidget(int screen = -1) :
+ QWidget(QApplication::desktop()->screen( screen ),
+- 0, WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM )
++ 0, WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM ), oldpmser( 0 ), oldbmser( 0 )
+ {
+ }
+
+- void setPixmap(QPixmap pm)
++ void setPixmap(QPixmap pm, QPoint hot)
+ {
+- if ( pm.mask() ) {
++ int bmser = pm.mask() ? pm.mask()->serialNumber() : 0;
++ if( oldpmser == pm.serialNumber() && oldbmser == bmser
++ && oldhot == hot )
++ return;
++ oldpmser = pm.serialNumber();
++ oldbmser = bmser;
++ oldhot = hot;
++ bool hotspot_in = !(hot.x() < 0 || hot.y() < 0 || hot.x() >= pm.width() || hot.y() >= pm.height());
++// if the pixmap has hotspot in its area, make a "hole" in it at that position
++// this will allow XTranslateCoordinates() to find directly the window below the cursor instead
++// of finding this pixmap, and therefore there won't be needed any (slow) search for the window
++// using findRealWindow()
++ if( hotspot_in ) {
++ QBitmap mask = pm.mask() ? *pm.mask() : QBitmap( pm.width(), pm.height());
++ if( !pm.mask())
++ mask.fill( Qt::color1 );
++ QPainter p( &mask );
++ p.setPen( Qt::color0 );
++ p.drawPoint( hot.x(), hot.y());
++ p.end();
++ pm.setMask( mask );
++ setMask( mask );
++ } else if ( pm.mask() ) {
+ setMask( *pm.mask() );
+ } else {
+ clearMask();
+ }
+ resize(pm.width(),pm.height());
+ setErasePixmap(pm);
++ erase();
+ }
++private:
++ int oldpmser;
++ int oldbmser;
++ QPoint oldhot;
+ };
+
+ static QShapedPixmapWidget * qt_xdnd_deco = 0;
+@@ -875,6 +904,45 @@
+ move( QCursor::pos() );
+ }
+
++static bool qt_xdnd_was_move = false;
++static bool qt_xdnd_found = false;
++// check whole incoming X queue for move events
++// checking whole queue is done by always returning False in the predicate
++// if there's another move event in the queue, and there's not a mouse button
++// or keyboard or ClientMessage event before it, the current move event
++// may be safely discarded
++// this helps avoiding being overloaded by being flooded from many events
++// from the XServer
++static
++Bool qt_xdnd_predicate( Display*, XEvent* ev, XPointer )
++{
++ if( qt_xdnd_found )
++ return False;
++ if( ev->type == MotionNotify )
++ {
++ qt_xdnd_was_move = true;
++ qt_xdnd_found = true;
++ }
++ if( ev->type == ButtonPress || ev->type == ButtonRelease
++ || ev->type == XKeyPress || ev->type == XKeyRelease
++ || ev->type == ClientMessage )
++ {
++ qt_xdnd_was_move = false;
++ qt_xdnd_found = true;
++ }
++ return False;
++}
++
++static
++bool qt_xdnd_another_movement()
++{
++ qt_xdnd_was_move = false;
++ qt_xdnd_found = false;
++ XEvent dummy;
++ XCheckIfEvent( qt_xdisplay(), &dummy, qt_xdnd_predicate, NULL );
++ return qt_xdnd_was_move;
++}
++
+ bool QDragManager::eventFilter( QObject * o, QEvent * e)
+ {
+ if ( beingCancelled ) {
+@@ -897,8 +965,10 @@
+
+ if ( e->type() == QEvent::MouseMove ) {
+ QMouseEvent* me = (QMouseEvent *)e;
+- updateMode(me->stateAfter());
+- move( me->globalPos() );
++ if( !qt_xdnd_another_movement()) {
++ updateMode(me->stateAfter());
++ move( me->globalPos() );
++ }
+ return TRUE;
+ } else if ( e->type() == QEvent::MouseButtonRelease ) {
+ qApp->removeEventFilter( this );
+@@ -1139,7 +1209,7 @@
+ qt_xdnd_deco->grabMouse();
+ }
+ }
+- updatePixmap();
++ updatePixmap( globalPos );
+
+ if ( qt_xdnd_source_sameanswer.contains( globalPos ) &&
+ qt_xdnd_source_sameanswer.isValid() ) {
+@@ -1732,7 +1802,7 @@
+ // qt_xdnd_source_object persists until we get an xdnd_finish message
+ }
+
+-void QDragManager::updatePixmap()
++void QDragManager::updatePixmap( const QPoint& cursorPos )
+ {
+ if ( qt_xdnd_deco ) {
+ QPixmap pm;
+@@ -1747,9 +1817,8 @@
+ defaultPm = new QPixmap(default_pm);
+ pm = *defaultPm;
+ }
+- qt_xdnd_deco->setPixmap(pm);
+- qt_xdnd_deco->move(QCursor::pos()-pm_hot);
+- qt_xdnd_deco->repaint(FALSE);
++ qt_xdnd_deco->setPixmap(pm, pm_hot);
++ qt_xdnd_deco->move(cursorPos-pm_hot);
+ //if ( willDrop ) {
+ qt_xdnd_deco->show();
+ //} else {
+@@ -1758,4 +1827,9 @@
+ }
+ }
+
++void QDragManager::updatePixmap()
++{
++ updatePixmap( QCursor::pos());
++}
++
+ #endif // QT_NO_DRAGANDDROP
+--- a/src/kernel/qdragobject.h
++++ b/src/kernel/qdragobject.h
+@@ -248,6 +248,7 @@
+ void move( const QPoint & );
+ void drop();
+ void updatePixmap();
++ void updatePixmap( const QPoint& cursorPos );
+
+ private:
+ QDragObject * object;
Added: trunk/packages/qt-x11-free/debian/patches/0002-dnd_active_window_fix.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0002-dnd_active_window_fix.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0002-dnd_active_window_fix.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,189 @@
+qt-bugs@ issue : 25122
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+ Hello,
+
+ for example: Open Konqueror window, showing some files. Start dragging one
+ desktop icon. If you press/release Ctrl, there'll be a '+' attached to the
+ icon, showing the DND operation. Now, while still doing DND, make the
+ Konqueror window active (Alt+Tab with KDE-3.1.2+, hover over its taskbar
+ entry, Ctrl+Fn to switch to a different virtual desktop, etc.). As soon as
+ the app performing DND is not the active application, and the mouse is not
+ moving, pressing/releasing Ctrl doesn't do anything, the state only updates
+ when the mouse is moved.
+
+ This is caused by the fact that Qt has only pointer grab when doing DND, but
+ doesn't have keyboard grab. I actually consider this a good thing, because
+ the only keys important for DND are modifiers, and they come together with
+ pointer events, and not having keyboard grab allows using keyboard shortcuts
+ like Alt+Tab while DND. However, when the mouse is not moved, and only a
+ modifier key is pressed/released, the app won't get any mouse event, and
+ won't also get the keyboard event.
+
+ The attached patch changes Qt to explicitly check the modifiers state using
+ XQueryPointer() if there's wasn't recently any mouse/keyboard event, which
+ ensures the state is updated even in the situation described above.
+
+--- a/src/kernel/qapplication_x11.cpp
++++ b/src/kernel/qapplication_x11.cpp
+@@ -3975,7 +3975,7 @@
+ // Keyboard event translation
+ //
+
+-static int translateButtonState( int s )
++int qt_x11_translateButtonState( int s )
+ {
+ int bst = 0;
+ if ( s & Button1Mask )
+@@ -4041,7 +4041,7 @@
+ pos.ry() = lastMotion.y;
+ globalPos.rx() = lastMotion.x_root;
+ globalPos.ry() = lastMotion.y_root;
+- state = translateButtonState( lastMotion.state );
++ state = qt_x11_translateButtonState( lastMotion.state );
+ if ( qt_button_down && (state & (LeftButton |
+ MidButton |
+ RightButton ) ) == 0 )
+@@ -4065,7 +4065,7 @@
+ pos.ry() = xevent->xcrossing.y;
+ globalPos.rx() = xevent->xcrossing.x_root;
+ globalPos.ry() = xevent->xcrossing.y_root;
+- state = translateButtonState( xevent->xcrossing.state );
++ state = qt_x11_translateButtonState( xevent->xcrossing.state );
+ if ( qt_button_down && (state & (LeftButton |
+ MidButton |
+ RightButton ) ) == 0 )
+@@ -4077,7 +4077,7 @@
+ pos.ry() = event->xbutton.y;
+ globalPos.rx() = event->xbutton.x_root;
+ globalPos.ry() = event->xbutton.y_root;
+- state = translateButtonState( event->xbutton.state );
++ state = qt_x11_translateButtonState( event->xbutton.state );
+ switch ( event->xbutton.button ) {
+ case Button1: button = LeftButton; break;
+ case Button2: button = MidButton; break;
+@@ -5023,7 +5023,7 @@
+ XKeyEvent xkeyevent = event->xkey;
+
+ // save the modifier state, we will use the keystate uint later by passing
+- // it to translateButtonState
++ // it to qt_x11_translateButtonState
+ uint keystate = event->xkey.state;
+ // remove the modifiers where mode_switch exists... HPUX machines seem
+ // to have alt *AND* mode_switch both in Mod1Mask, which causes
+@@ -5137,7 +5137,7 @@
+ }
+ #endif // !QT_NO_XIM
+
+- state = translateButtonState( keystate );
++ state = qt_x11_translateButtonState( keystate );
+
+ static int directionKeyEvent = 0;
+ if ( qt_use_rtl_extensions && type == QEvent::KeyRelease ) {
+--- a/src/kernel/qdnd_x11.cpp
++++ b/src/kernel/qdnd_x11.cpp
+@@ -118,6 +118,8 @@
+ Atom qt_xdnd_type_list;
+ const int qt_xdnd_version = 4;
+
++extern int qt_x11_translateButtonState( int s );
++
+ // Actions
+ //
+ // The Xdnd spec allows for user-defined actions. This could be implemented
+@@ -203,6 +205,8 @@
+ static int qt_xdnd_current_screen = -1;
+ // state of dragging... true if dragging, false if not
+ bool qt_xdnd_dragging = FALSE;
++// need to check state of keyboard modifiers
++static bool need_modifiers_check = FALSE;
+
+ // dict of payload data, sorted by type atom
+ static QIntDict<QByteArray> * qt_xdnd_target_data = 0;
+@@ -900,8 +904,20 @@
+
+ void QDragManager::timerEvent( QTimerEvent* e )
+ {
+- if ( e->timerId() == heartbeat && qt_xdnd_source_sameanswer.isNull() )
+- move( QCursor::pos() );
++ if ( e->timerId() == heartbeat ) {
++ if( need_modifiers_check ) {
++ Window root, child;
++ int root_x, root_y, win_x, win_y;
++ unsigned int mask;
++ XQueryPointer( qt_xdisplay(), qt_xrootwin( qt_xdnd_current_screen ),
++ &root, &child, &root_x, &root_y, &win_x, &win_y, &mask );
++ if( updateMode( (ButtonState)qt_x11_translateButtonState( mask )))
++ qt_xdnd_source_sameanswer = QRect(); // force move
++ }
++ need_modifiers_check = TRUE;
++ if( qt_xdnd_source_sameanswer.isNull() )
++ move( QCursor::pos() );
++ }
+ }
+
+ static bool qt_xdnd_was_move = false;
+@@ -969,6 +985,7 @@
+ updateMode(me->stateAfter());
+ move( me->globalPos() );
+ }
++ need_modifiers_check = FALSE;
+ return TRUE;
+ } else if ( e->type() == QEvent::MouseButtonRelease ) {
+ qApp->removeEventFilter( this );
+@@ -1007,9 +1024,11 @@
+ beingCancelled = FALSE;
+ qApp->exit_loop();
+ } else {
+- updateMode(ke->stateAfter());
+- qt_xdnd_source_sameanswer = QRect(); // force move
+- move( QCursor::pos() );
++ if( updateMode(ke->stateAfter())) {
++ qt_xdnd_source_sameanswer = QRect(); // force move
++ move( QCursor::pos() );
++ }
++ need_modifiers_check = FALSE;
+ }
+ return TRUE; // Eat all key events
+ }
+@@ -1036,10 +1055,10 @@
+
+
+ static Qt::ButtonState oldstate;
+-void QDragManager::updateMode( ButtonState newstate )
++bool QDragManager::updateMode( ButtonState newstate )
+ {
+ if ( newstate == oldstate )
+- return;
++ return false;
+ const int both = ShiftButton|ControlButton;
+ if ( (newstate & both) == both ) {
+ global_requested_action = QDropEvent::Link;
+@@ -1063,6 +1082,7 @@
+ }
+ }
+ oldstate = newstate;
++ return true;
+ }
+
+
+@@ -1769,6 +1789,7 @@
+ qt_xdnd_source_sameanswer = QRect();
+ move(QCursor::pos());
+ heartbeat = startTimer(200);
++ need_modifiers_check = FALSE;
+
+ #ifndef QT_NO_CURSOR
+ qApp->setOverrideCursor( arrowCursor );
+--- a/src/kernel/qdragobject.h
++++ b/src/kernel/qdragobject.h
+@@ -252,7 +252,7 @@
+
+ private:
+ QDragObject * object;
+- void updateMode( ButtonState newstate );
++ bool updateMode( ButtonState newstate );
+ void updateCursor();
+ #if defined(Q_WS_X11)
+ void createCursors();
Added: trunk/packages/qt-x11-free/debian/patches/0005-qpixmap_mitshm.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0005-qpixmap_mitshm.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0005-qpixmap_mitshm.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,569 @@
+qt-bugs@ issue : 11790 (part of)
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+NOTE: Needs #define QT_MITSHM in the matching qplatformdefs.h file. This
+ patch does so only for linux-g++ and linux-g++-distcc platforms.
+
+MITSHM extension support for QPixmap<->QImage conversions.
+
+Hello,
+
+ the review and apply the attached patches that improve performance of
+QImage->QPixmap conversions. They should be applied in order
+'mitshm','more_local' and 'fast', but they're independent from each other
+(well, besides merging problems).
+
+ Mitshm patch adds MITSHM extension support for both
+QPixmap::convertFromImage() and QPixmap::convertToImage(). I've noticed there
+was some MITSHM support already, turned off by default, but it was used only
+for QPixmap::xForm() , and it used shared pixmaps (and I'd bet nobody uses
+it). My patch adds shared ximages support for faster pixmap<->image
+conversions. Since I don't understand the xForm() code much, and I didn't
+want to do anything with it, I added three #define's:
+ - QT_MITSHM generally enabling MITSHM support, which should be set in
+qplatformsdefs.h (or wherever you setup platform specific stuff), it can be
+enabled at least on Linux
+ - QT_MITSHM_CONVERSIONS - this is for my new code
+ - QT_MITSHM_XFORM - this is for the xForm() code
+ There's one more #define, QT_MITSHM_RMID_IGNORES_REFCOUNT. Glibc
+documentation of shmctl( ... IPC_RMID ) quite clearly says that the memory
+segment is freed only after the refcount increased by shmat() and decreased
+by shmdt() is 0. However, at least according to
+http://bugs.kde.org/show_bug.cgi?id=27517 , this doesn't happen on other
+platforms for some strange reason. Such platforms should have this #define if
+you ever consider supporting MITSHM on them.
+
+ The lower limit for using MITSHM for the image is about 8KiB
+(width*height*depth > 100*100*32 ). Also, BestOptim in such case doesn't keep
+the ximage, as the shared ximage is always freed before the function returns
+(I don't know if it's worth copying it).
+
+ The second patch ('more_local'), in short, does nothing. Besides improving
+performance by about 10% by making variables more "local", making few of them
+const, and also making some of them unsigned (this help gcc for some reason).
+
+ The last one, 'fast', moves some if's out of the loops, and handles some most
+common case specially (15bpp, 16bpp and 32bpp ximage depths). 32bpp case, if
+the endianess matches, is simply uses memcpy(), for the 15/16bpp depth,
+variables are replaced directly by matching values, statements are a bit
+reordered and merged when suitable, and again, in case endianess matches,
+pixels are written simply as Q_INT16. Most probably it would also help to
+process two pixels at once and write them as Q_INT32, but I didn't want to
+complicate the code too much (later >;) ).
+
+ The last snippet of 'fast' handles case when xi->bytes_per_line is not equal
+to width for 8bpp ximage. I'm not actually sure if that can ever happen, but
+since I've already written it *shrug*.
+
+ The 'more_local' and 'fast' patches change only convertFromImage(), as I
+don't think convertToImage() is that performance critical (but it's as
+unoptimized as convertFromImage() was).
+
+ Maybe some numbers. The difference is of course mainly visible with larger
+pixmaps. The two optimizations alone reduce the time to 50% for 32bpp, to 70%
+for 16bpp. The MITSHM support, when other patches are already applied too,
+for 32bpp images saves about 33%. Together, the total time is reduced to
+about 40% for 32bpp. Imlib probably still beats that, but at least this
+obsoletes KPixmapIO.
+
+
+--- a/src/kernel/qpixmap_x11.cpp
++++ b/src/kernel/qpixmap_x11.cpp
+@@ -40,7 +40,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:
+ //
+@@ -48,14 +60,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"
+@@ -94,7 +105,7 @@
+ 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;
+@@ -176,8 +187,100 @@
+ // 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
+@@ -630,9 +733,20 @@
+ d = 32; // > 8 ==> 32
+
+ XImage *xi = (XImage *)data->ximage; // any cached ximage?
+- if ( !xi ) // fetch data from X server
++#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 );
+ if (!xi)
+ return image; // null image
+@@ -643,15 +757,31 @@
+ 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 );
+@@ -665,6 +795,11 @@
+ src += axi->bytes_per_line;
+ }
+
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_aximage )
++ qt_XShmDestroyImage( axi, &ashminfo );
++ else
++#endif
+ qSafeXDestroyImage( axi );
+ }
+ } else if (msk) {
+@@ -807,6 +942,12 @@
+ xi->bits_per_pixel );
+ #endif
+ image.reset();
++#ifdef QT_MITSHM_CONVERSIONS
++ if( mitshm_ximage )
++ qt_XShmDestroyImage( xi, &shminfo );
++ else
++#endif
++ qSafeXDestroyImage( xi );
+ return image;
+ }
+
+@@ -912,10 +1053,22 @@
+ delete [] carr;
+ }
+ if ( data->optim != BestOptim ) { // throw away image data
++#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;
+ }
+@@ -1088,6 +1241,11 @@
+ bool trucol = (visual->c_class == TrueColor || visual->c_class == DirectColor);
+ 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
+@@ -1116,10 +1274,18 @@
+ }
+ }
+
++#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 );
+ if (!xi)
+ return false;
++ if( newbits == NULL )
+ newbits = (uchar *)malloc( xi->bytes_per_line*h );
+ Q_CHECK_PTR( newbits );
+ if ( !newbits ) // no memory
+@@ -1326,6 +1492,7 @@
+ }
+
+ newbits = (uchar *)malloc( nbytes ); // copy image into newbits
++ newbits_size = nbytes;
+ Q_CHECK_PTR( newbits );
+ if ( !newbits ) // no memory
+ return FALSE;
+@@ -1443,11 +1610,18 @@
+ }
+
+ if ( !xi ) { // X image not created
++#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;
+@@ -1465,6 +1639,14 @@
+ "(bpp=%d)", xi->bits_per_pixel );
+ #endif
+ }
++#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;
+ }
+
+@@ -1498,19 +1680,24 @@
+
+ }
+
++#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 );
+@@ -1546,13 +1733,22 @@
+ data->alphapm->rendhd =
+ (HANDLE) XftDrawCreateAlpha( x11Display(), data->alphapm->hd, 8 );
+
+- XImage *axi = XCreateImage(x11Display(), (Visual *) x11Visual(),
++#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) {
++ 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) {
+@@ -1570,14 +1766,48 @@
+ }
+
+ GC gc = XCreateGC(x11Display(), data->alphapm->hd, 0, 0);
++ #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;
+ }
+
+@@ -1740,7 +1970,7 @@
+ return pm;
+ }
+
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ static bool try_once = TRUE;
+ if (try_once) {
+ try_once = FALSE;
+@@ -1773,7 +2003,7 @@
+ 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;
+@@ -1789,7 +2019,7 @@
+ memset( dptr, Qt::white.pixel( x11Screen() ), dbytes );
+ else
+ memset( dptr, 0xff, dbytes );
+-#if defined(QT_MITSHM)
++#if defined(QT_MITSHM_XFORM)
+ }
+ #endif
+
+@@ -1820,7 +2050,7 @@
+ } 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
+@@ -1857,7 +2087,7 @@
+ 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 {
+@@ -1866,7 +2096,7 @@
+ 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
+
+--- a/mkspecs/linux-g++/qplatformdefs.h
++++ b/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/0007-qpixmap_constants.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0007-qpixmap_constants.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0007-qpixmap_constants.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,384 @@
+qt-bugs@ issue : 11790 (part of)
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+See 0005-qpixmap_mitshm.patch for details.
+
+
+--- a/src/kernel/qpixmap_x11.cpp
++++ b/src/kernel/qpixmap_x11.cpp
+@@ -1292,9 +1292,6 @@
+ 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;
+@@ -1343,32 +1340,70 @@
+ }
+ 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 ); \
+@@ -1389,91 +1424,177 @@
+ ? 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
+@@ -1753,15 +1874,24 @@
+
+ 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/0032-fix_rotated_randr.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0032-fix_rotated_randr.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0032-fix_rotated_randr.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,21 @@
+qt-bugs@ issue : N34454
+bugs.kde.org number : 67101, 101516
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+This patch replaces the old #0032 patch.
+The real problem is https://bugs.freedesktop.org/show_bug.cgi?id=2965 ,
+so this patch is actually just a workaround.
+
+--- a/src/kernel/qapplication_x11.cpp
++++ b/src/kernel/qapplication_x11.cpp
+@@ -3407,7 +3407,8 @@
+ #endif
+
+ #ifndef QT_NO_XRANDR
+- if (event->type == xrandr_eventbase + RRScreenChangeNotify) {
++ if (event->type == xrandr_eventbase + RRScreenChangeNotify
++ || ( event->type == ConfigureNotify && event->xconfigure.window == QPaintDevice::x11AppRootWindow())) {
+ // update Xlib internals with the latest screen configuration
+ XRRUpdateConfiguration(event);
+
Added: trunk/packages/qt-x11-free/debian/patches/0038-dragobject-dont-prefer-unknown.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0038-dragobject-dont-prefer-unknown.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0038-dragobject-dont-prefer-unknown.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,57 @@
+qt-bugs@ issue : 38642
+bugs.kde.org number : 71084
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+Hello,
+
+ start Mozilla, go e.g. to http://kde.org, start KWrite (or basically any Qt
+app that accepts text drops), select 'Conquer your Desktop!', and try to
+drag&drop it onto KWrite. The only text pasted should be 'm'.
+
+ I don't know much the related mimetype and encoding stuff, so I'm unsure
+whose fault this actually is. The text drag is provided as a lot of
+text/something targets, to list some text/_moz_htmlinfo, text/x-moz-url,
+text/unicode and similar. The problem is, Kate uses QTextDrag::decode() with
+no subtype specified, probably with the intention that as Kate is a text
+editor, it can accept any text pasted. And since the first target provided by
+mozilla is text/x-moz-url, (which moreover seems to be encoded as 16bit
+unicode), the text dropped is completely wrong. You can easily see all
+targets provided by Mozilla with see_mime.patch applied.
+
+ Solution #1: Say that Kate (any pretty much everybody else expecting text)
+should say "plain" as the subtype. In such case, I suggest you drop the
+QTextDrag::decode() variant with no subtype specified, and stress more the
+fact that not specifying a subtype can result in a lot of rubbish. It's
+simply too tempting to leave the subtype empty and try to accept anything.
+
+ Solution #2: When trying to accept anything, try to get useful data. Which
+means either sorting the subtypes available somehow, checking only the ones
+Qt knows.
+
+ To me, #1 seems to be a better choice, or possibly at least something like
+the attached QTextDrag patch, which simply always tries first "plain" subtype
+if none is specified. With this patch, Mozilla even works (that's irony, of
+course, Mozilla still pastes the text/plain text as HTML, but at least now it
+pastes something where it's easy to point at the offender).
+
+
+--- a/src/kernel/qdragobject.cpp
++++ b/src/kernel/qdragobject.cpp
+@@ -893,6 +893,16 @@
+ {
+ if(!e)
+ return FALSE;
++
++ // when subtype is not specified, try text/plain first, otherwise this may read
++ // things like text/x-moz-url even though better targets are available
++ if( subtype.isNull()) {
++ QCString subtmp = "plain";
++ if( decode( e, str, subtmp )) {
++ subtype = subtmp;
++ return true;
++ }
++ }
+
+ if ( e->cacheType == QMimeSource::Text ) {
+ str = *e->cache.txt.str;
Added: trunk/packages/qt-x11-free/debian/patches/0044-qscrollview-windowactivate-fix.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0044-qscrollview-windowactivate-fix.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0044-qscrollview-windowactivate-fix.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,38 @@
+qt-bugs@ issue : N45716
+applied: no
+author: Enrico Ros <eros.kde at email.it>
+
+QScrollView unwanted repaint fix.
+
+This fixes the 'flashing' konqueror window on activation / deactivation by
+saving 1 unwanted repaint (when konqueror window has background).
+I tracked down to the problem to the internal QViewportWidget of the
+QScrollView class.
+
+When a window is activated the activation event is recursively propagated
+to all childs triggering the windowActivationChange() functions in the
+widget it passes by.
+What happens when the event gets to the Viewport?
+At this point the event has already been handled by windowActivationChange()
+of the parent widget (a QIconView for example) and has then been propagated
+to the Viewport that will handle it with the default
+QWidget::windowActivationChange implementation, maybe raising an unwanted
+update(); so here we stop the event.
+As an addition: if the parent reimplements the windowActivationChange()
+function, mainly to block the update, it won't be happy if the child will
+trigger the update. If the parent do not reimplement the function il will
+inherits the default implementation and there is no need for the viewport's
+one.
+
+--- a/src/widgets/qscrollview.cpp
++++ b/src/widgets/qscrollview.cpp
+@@ -1553,6 +1553,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/0047-fix-kmenu-width.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0047-fix-kmenu-width.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0047-fix-kmenu-width.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,21 @@
+qt-bugs@ issue: N46882
+bugs.kde.org number: 77545
+applied: no
+author: Stephan Binner <binner at kde.org>
+
+Fix wrong K menu width for the case of enabled side pixmap and a menu title
+(like "Recently Used Applications") being longer than every other entry.
+
+Solution: Respect PanelKMenu::setMaximumSize() as up to Qt 3.2.3
+
+--- a/src/widgets/qpopupmenu.cpp
++++ b/src/widgets/qpopupmenu.cpp
+@@ -2533,7 +2533,7 @@
+ constPolish();
+ QPopupMenu* that = (QPopupMenu*) this;
+ //We do not need a resize here, just the sizeHint..
+- return that->updateSize(FALSE, FALSE).expandedTo( QApplication::globalStrut() );
++ return that->updateSize(FALSE).expandedTo( QApplication::globalStrut() );
+ }
+
+
Added: trunk/packages/qt-x11-free/debian/patches/0048-qclipboard_hack_80072.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0048-qclipboard_hack_80072.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0048-qclipboard_hack_80072.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,48 @@
+qt-bugs@ issue : none, probably even won't be
+bugs.kde.org number : 80072
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+A crude hack for KDE #80072. No good idea how to fix it properly yet :(.
+
+--- a/src/kernel/qclipboard_x11.cpp
++++ b/src/kernel/qclipboard_x11.cpp
+@@ -112,6 +112,7 @@
+ static bool pending_clipboard_changed = FALSE;
+ static bool pending_selection_changed = FALSE;
+
++Q_EXPORT bool qt_qclipboard_bailout_hack = false;
+
+ // event capture mechanism for qt_xclb_wait_for_event
+ static bool waiting_for_data = FALSE;
+@@ -464,6 +465,15 @@
+ || e->xselectionclear.selection == qt_xa_clipboard)));
+ }
+
++static bool selection_request_pending = false;
++
++static Bool check_selection_request_pending( Display*, XEvent* e, XPointer )
++ {
++ if( e->type == SelectionRequest && e->xselectionrequest.owner == owner->winId())
++ selection_request_pending = true;
++ return False;
++ }
++
+ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
+ int timeout )
+ {
+@@ -515,6 +525,14 @@
+ do {
+ if ( XCheckTypedWindowEvent(dpy,win,type,event) )
+ return TRUE;
++ if( qt_qclipboard_bailout_hack ) {
++ XEvent dummy;
++ selection_request_pending = false;
++ if ( owner != NULL )
++ XCheckIfEvent(dpy,&dummy,check_selection_request_pending,NULL);
++ if( selection_request_pending )
++ return TRUE;
++ }
+
+ // process other clipboard events, since someone is probably requesting data from us
+ XEvent e;
Added: trunk/packages/qt-x11-free/debian/patches/0056-khotkeys_input_84434.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0056-khotkeys_input_84434.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0056-khotkeys_input_84434.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,21 @@
+qt-bugs@ issue : 58251
+bugs.kde.org number : 84434
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+Fixes keyboard input action in KHotKeys (see bug #84434).
+
+--- a/src/kernel/qapplication_x11.cpp
++++ b/src/kernel/qapplication_x11.cpp
+@@ -5300,8 +5300,10 @@
+ qt_auto_repeat_data *d = (qt_auto_repeat_data *) arg;
+ if (d->error ||
+ event->xkey.window != d->window ||
+- event->xkey.keycode != d->keycode)
++ event->xkey.keycode != d->keycode) {
++ d->error = TRUE;
+ return FALSE;
++ }
+
+ if (event->type == XKeyPress) {
+ d->error = (! d->release || event->xkey.time - d->timestamp > 10);
Added: trunk/packages/qt-x11-free/debian/patches/0059-qpopup_has_mouse.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0059-qpopup_has_mouse.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0059-qpopup_has_mouse.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,68 @@
+qt-bugs@ issue : 49417
+bugs.kde.org number : 58719
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+Hello,
+
+ please consider applying the two attached QPopupMenu patches fixing KDE bugs
+ #58719 and #74778 (http://bugs.kde.org/show_bug.cgi?id=58719,
+ http://bugs.kde.org/show_bug.cgi?id=74778), which complain about keyboard
+ navigation in popup menus being very uncomfortable because of being affected
+ by mouse position despite mouse not being used at all.
+
+ - hasmouse.patch - (#58719) - use keyboard to open and navigate in any popup
+ menu and "accidentally" hit your mouse. Depending on the mouse cursor
+ position either no popup entry is selected or the random popup entry
+ happening to be at the cursor position becomes highlighted. The patch
+ basically copies the 'hasmouse' code from QMenuBar which prevents the mouse
+ having any effect on the popup if it's outside the popup geometry.
+
+ [ ... #74778 ... ]
+
+--- a/src/widgets/qpopupmenu.cpp
++++ b/src/widgets/qpopupmenu.cpp
+@@ -256,6 +256,7 @@
+ } scroll;
+ QSize calcSize;
+ QRegion mouseMoveBuffer;
++ uint hasmouse : 1;
+ };
+
+ static QPopupMenu* active_popup_menu = 0;
+@@ -275,6 +276,7 @@
+ d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0;
+ d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ d->scroll.scrolltimer = 0;
++ d->hasmouse = 0;
+ isPopupMenu = TRUE;
+ #ifndef QT_NO_ACCEL
+ autoaccel = 0;
+@@ -1744,6 +1746,11 @@
+
+ int item = itemAtPos( e->pos() );
+ if ( item == -1 ) { // no valid item
++ if( !d->hasmouse ) {
++ tryMenuBar( e );
++ return;
++ }
++ d->hasmouse = 0;
+ int lastActItem = actItem;
+ actItem = -1;
+ if ( lastActItem >= 0 )
+@@ -1755,6 +1762,7 @@
+ }
+ } else { // mouse on valid item
+ // but did not register mouse press
++ d->hasmouse = 1;
+ if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn )
+ mouseBtDn = TRUE; // so mouseReleaseEvent will pop down
+
+@@ -2163,6 +2171,7 @@
+ */
+ void QPopupMenu::leaveEvent( QEvent * )
+ {
++ d->hasmouse = 0;
+ if ( testWFlags( WStyle_Tool ) && style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this) ) {
+ int lastActItem = actItem;
+ actItem = -1;
Added: trunk/packages/qt-x11-free/debian/patches/0060-qpopup_ignore_mousepos.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0060-qpopup_ignore_mousepos.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0060-qpopup_ignore_mousepos.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,59 @@
+qt-bugs@ issue : 49417
+bugs.kde.org number : 74778
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+ Hello,
+
+ please consider applying the two attached QPopupMenu patches fixing KDE bugs
+ #58719 and #74778 (http://bugs.kde.org/show_bug.cgi?id=58719,
+ http://bugs.kde.org/show_bug.cgi?id=74778), which complain about keyboard
+ navigation in popup menus being very uncomfortable because of being affected
+ by mouse position despite mouse not being used at all.
+
+ [... #58719 ... ]
+
+ - ignoremousepos.patch - (#74778) - use keyboard to open some popup which
+ doesn't show up at mouse position (e.g. Alt+F3 with KWin or the context menu
+ key with some file selected in Konqueror). If the mouse is positioned in the
+ area where the popup shows, the random entry happening to be at the cursor
+ position becomes highlighted.
+ The patch fixes this by ignoring mouse events that happen at mouse position
+ which was current when the popup was shown, i.e. all mouse move events that
+ actually aren't triggered by mouse move are ignored. I first wanted to ignore
+ only the very first mouse move event (which should be caused by EnterNotify
+ for the popup) but I realized that Qt's event handling causes the popup to
+ possibly get more than just one initial move event, caused by LeaveNotify
+ events for normal widgets being transformed to mouse move events for the
+ popup, so I have no better idea how to solve this problem.
+
+--- a/src/widgets/qpopupmenu.cpp
++++ b/src/widgets/qpopupmenu.cpp
+@@ -257,6 +257,7 @@
+ QSize calcSize;
+ QRegion mouseMoveBuffer;
+ uint hasmouse : 1;
++ QPoint ignoremousepos;
+ };
+
+ static QPopupMenu* active_popup_menu = 0;
+@@ -1359,6 +1360,7 @@
+ popupActive = -1;
+ if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
+ d->mouseMoveBuffer = QRegion();
++ d->ignoremousepos = QCursor::pos();
+ }
+
+ /*!
+@@ -1706,6 +1708,11 @@
+
+ void QPopupMenu::mouseMoveEvent( QMouseEvent *e )
+ {
++ if( e->globalPos() == d->ignoremousepos ) {
++ return;
++ }
++ d->ignoremousepos = QPoint();
++
+ motion++;
+
+ if ( parentMenu && parentMenu->isPopupMenu ) {
Added: trunk/packages/qt-x11-free/debian/patches/0061-qscrollview-propagate-horizontal-wheelevent.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0061-qscrollview-propagate-horizontal-wheelevent.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0061-qscrollview-propagate-horizontal-wheelevent.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,18 @@
+qt-bugs@ issue : N64978
+applied: no
+author: Germain Garand <germain at ebooksfrance.org>
+
+In QScrollView, wheel events are forwarded to (viewport|contents)WheelEvent, but
+the horizontal/vertical status of the wheel event is not.
+
+--- a/src/widgets/qscrollview.cpp
++++ b/src/widgets/qscrollview.cpp
+@@ -1868,7 +1868,7 @@
+ the event itself.
+ */
+ QWheelEvent ce( viewportToContents(e->pos()),
+- e->globalPos(), e->delta(), e->state());
++ e->globalPos(), e->delta(), e->state(), e->orientation());
+ contentsWheelEvent(&ce);
+ if ( ce.isAccepted() )
+ e->accept();
Added: trunk/packages/qt-x11-free/debian/patches/0073-xinerama-aware-qpopup.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0073-xinerama-aware-qpopup.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0073-xinerama-aware-qpopup.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,111 @@
+qt-bugs@ issue : none
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+Makes QPopupMenu aware of Xinerama (see e.g. https://bugzilla.novell.com/show_bug.cgi?id=216235).
+
+
+--- a/src/widgets/qpopupmenu.cpp
++++ b/src/widgets/qpopupmenu.cpp
+@@ -460,6 +460,15 @@
+ menuContentsChanged();
+ }
+
++QRect QPopupMenu::screenRect( const QPoint& pos )
++{
++ int screen_num = QApplication::desktop()->screenNumber( pos );
++#ifdef Q_WS_MAC
++ return QApplication::desktop()->availableGeometry( screen_num );
++#else
++ return QApplication::desktop()->screenGeometry( screen_num );
++#endif
++}
+ /*!
+ Displays the popup menu so that the item number \a indexAtPoint
+ will be at the specified \e global position \a pos. To translate a
+@@ -504,6 +513,15 @@
+ // point.
+ #endif
+
++ QRect screen = screenRect( geometry().center());
++ QRect screen2 = screenRect( QApplication::reverseLayout()
++ ? pos+QPoint(width(),0) : pos );
++ // if the widget is not in the screen given by the position, move it
++ // there, so that updateSize() uses the right size of the screen
++ if( screen != screen2 ) {
++ screen = screen2;
++ move( screen.x(), screen.y());
++ }
+ if(d->scroll.scrollable) {
+ d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
+ d->scroll.topScrollableIndex = d->scroll.scrollableSize = 0;
+@@ -523,18 +541,6 @@
+ updateSize(TRUE);
+ }
+
+- int screen_num;
+- if (QApplication::desktop()->isVirtualDesktop())
+- screen_num =
+- QApplication::desktop()->screenNumber( QApplication::reverseLayout() ?
+- pos+QPoint(width(),0) : pos );
+- else
+- screen_num = QApplication::desktop()->screenNumber( this );
+-#ifdef Q_WS_MAC
+- QRect screen = QApplication::desktop()->availableGeometry( screen_num );
+-#else
+- QRect screen = QApplication::desktop()->screenGeometry( screen_num );
+-#endif
+ int sw = screen.width(); // screen width
+ int sh = screen.height(); // screen height
+ int sx = screen.x(); // screen pos
+@@ -1062,7 +1068,7 @@
+ mi->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 4 );
+ }
+
+- int dh = QApplication::desktop()->height();
++ int dh = screenRect( geometry().center()).height();
+ ncols = 1;
+
+ for ( QMenuItemListIt it2( *mitems ); it2.current(); ++it2 ) {
+@@ -2316,9 +2322,9 @@
+ bool right = FALSE;
+ if ( ( parentMenu && parentMenu->isPopupMenu &&
+ ((QPopupMenu*)parentMenu)->geometry().x() < geometry().x() ) ||
+- p.x() < 0 )
++ p.x() < screenRect( p ).left())
+ right = TRUE;
+- if ( right && (ps.width() > QApplication::desktop()->width() - mapToGlobal( r.topRight() ).x() ) )
++ if ( right && (ps.width() > screenRect( p ).right() - mapToGlobal( r.topRight() ).x() ) )
+ right = FALSE;
+ if ( right )
+ p.setX( mapToGlobal( r.topRight() ).x() );
+@@ -2329,7 +2335,7 @@
+ bool left = FALSE;
+ if ( ( parentMenu && parentMenu->isPopupMenu &&
+ ((QPopupMenu*)parentMenu)->geometry().x() > geometry().x() ) ||
+- p.x() + ps.width() > QApplication::desktop()->width() )
++ p.x() + ps.width() > screenRect( p ).right() )
+ left = TRUE;
+ if ( left && (ps.width() > mapToGlobal( r.topLeft() ).x() ) )
+ left = FALSE;
+@@ -2337,8 +2343,8 @@
+ p.setX( mapToGlobal( r.topLeft() ).x() - ps.width() );
+ }
+ QRect pr = popup->itemGeometry(popup->count() - 1);
+- if (p.y() + ps.height() > QApplication::desktop()->height() &&
+- p.y() - ps.height() + (QCOORD) pr.height() >= 0)
++ if (p.y() + ps.height() > screenRect( p ).bottom() &&
++ p.y() - ps.height() + (QCOORD) pr.height() >= screenRect( p ).top())
+ p.setY( p.y() - ps.height() + (QCOORD) pr.height());
+
+ if ( style().styleHint(QStyle::SH_PopupMenu_SloppySubMenus, this )) {
+--- a/src/widgets/qpopupmenu.h
++++ b/src/widgets/qpopupmenu.h
+@@ -155,6 +155,7 @@
+
+ QSize updateSize(bool force_recalc=FALSE, bool do_resize=TRUE);
+ void updateRow( int row );
++ QRect screenRect(const QPoint& pos);
+ #ifndef QT_NO_ACCEL
+ void updateAccel( QWidget * );
+ void enableAccel( bool );
Added: trunk/packages/qt-x11-free/debian/patches/0079-compositing-types.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0079-compositing-types.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0079-compositing-types.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,413 @@
+qt-bugs@ issue : none
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+This patch adds support for window types used for compositing (popup menu, dropdown menu,
+tooltip, combobox, dnd).
+
+--- a/src/kernel/qdnd_x11.cpp
++++ b/src/kernel/qdnd_x11.cpp
+@@ -264,6 +264,7 @@
+ QWidget(QApplication::desktop()->screen( screen ),
+ 0, WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM ), oldpmser( 0 ), oldbmser( 0 )
+ {
++ x11SetWindowType( X11WindowTypeDND );
+ }
+
+ void setPixmap(QPixmap pm, QPoint hot)
+@@ -1224,6 +1225,7 @@
+ // recreate the pixmap on the new screen...
+ delete qt_xdnd_deco;
+ qt_xdnd_deco = new QShapedPixmapWidget( screen );
++ qt_xdnd_deco->x11SetWindowTransient( dragSource->topLevelWidget());
+ if (!QWidget::mouseGrabber()) {
+ updatePixmap();
+ qt_xdnd_deco->grabMouse();
+@@ -1777,6 +1779,7 @@
+
+ dragSource = (QWidget *)(object->parent());
+
++ qt_xdnd_deco->x11SetWindowTransient( dragSource->topLevelWidget());
+ qApp->installEventFilter( this );
+ qt_xdnd_source_current_time = qt_x_time;
+ XSetSelectionOwner( QPaintDevice::x11AppDisplay(), qt_xdnd_selection,
+--- a/src/kernel/qapplication_x11.cpp
++++ b/src/kernel/qapplication_x11.cpp
+@@ -270,6 +270,11 @@
+ Atom qt_net_wm_window_type_utility = 0;
+ Atom qt_net_wm_window_type_splash = 0;
+ Atom qt_net_wm_window_type_override = 0; // KDE extension
++Atom qt_net_wm_window_type_dropdown_menu = 0;
++Atom qt_net_wm_window_type_popup_menu = 0;
++Atom qt_net_wm_window_type_tooltip = 0;
++Atom qt_net_wm_window_type_combo = 0;
++Atom qt_net_wm_window_type_dnd = 0;
+ Atom qt_net_wm_frame_strut = 0; // KDE extension
+ Atom qt_net_wm_state_stays_on_top = 0; // KDE extension
+ Atom qt_net_wm_pid = 0;
+@@ -1920,6 +1925,11 @@
+ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_UTILITY", &qt_net_wm_window_type_utility );
+ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_SPLASH", &qt_net_wm_window_type_splash );
+ qt_x11_intern_atom( "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE", &qt_net_wm_window_type_override );
++ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", &qt_net_wm_window_type_dropdown_menu );
++ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_POPUP_MENU", &qt_net_wm_window_type_popup_menu );
++ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_TOOLTIP", &qt_net_wm_window_type_tooltip );
++ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_COMBO", &qt_net_wm_window_type_combo );
++ qt_x11_intern_atom( "_NET_WM_WINDOW_TYPE_DND", &qt_net_wm_window_type_dnd );
+ qt_x11_intern_atom( "_KDE_NET_WM_FRAME_STRUT", &qt_net_wm_frame_strut );
+ qt_x11_intern_atom( "_NET_WM_STATE_STAYS_ON_TOP",
+ &qt_net_wm_state_stays_on_top );
+--- a/src/kernel/qwidget_x11.cpp
++++ b/src/kernel/qwidget_x11.cpp
+@@ -128,6 +128,11 @@
+ extern Atom qt_net_wm_window_type_utility;
+ extern Atom qt_net_wm_window_type_splash;
+ extern Atom qt_net_wm_window_type_override;
++extern Atom qt_net_wm_window_type_dropdown_menu;
++extern Atom qt_net_wm_window_type_popup_menu;
++extern Atom qt_net_wm_window_type_combo;
++extern Atom qt_net_wm_window_type_dnd;
++extern Atom qt_net_wm_window_type_tooltip;
+ extern Atom qt_net_wm_pid;
+ extern Atom qt_net_wm_user_time;
+ extern Atom qt_enlightenment_desktop;
+@@ -451,10 +456,6 @@
+ x11Colormap() );
+ #endif // QT_NO_XFTFREETYPE
+
+- // NET window types
+- long net_wintypes[7] = { 0, 0, 0, 0, 0, 0, 0 };
+- int curr_wintype = 0;
+-
+ // NET window states
+ long net_winstates[6] = { 0, 0, 0, 0, 0, 0 };
+ int curr_winstate = 0;
+@@ -476,7 +477,6 @@
+ if ( testWFlags(WStyle_Splash) ) {
+ if (qt_net_supports(qt_net_wm_window_type_splash)) {
+ clearWFlags( WX11BypassWM );
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_splash;
+ } else {
+ setWFlags( WX11BypassWM | WStyle_Tool | WStyle_NoBorder );
+ }
+@@ -485,27 +485,22 @@
+ mwmhints.decorations = 0L;
+ mwmhints.flags |= (1L << 1); // MWM_HINTS_DECORATIONS
+
+- if ( testWFlags( WStyle_NoBorder ) ) {
+- // override netwm type - quick and easy for KDE noborder
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_override;
+- } else {
+- if ( testWFlags( WStyle_NormalBorder | WStyle_DialogBorder ) ) {
+- mwmhints.decorations |= (1L << 1); // MWM_DECOR_BORDER
+- mwmhints.decorations |= (1L << 2); // MWM_DECOR_RESIZEH
+- }
++ if ( testWFlags( WStyle_NormalBorder | WStyle_DialogBorder ) ) {
++ mwmhints.decorations |= (1L << 1); // MWM_DECOR_BORDER
++ mwmhints.decorations |= (1L << 2); // MWM_DECOR_RESIZEH
++ }
+
+- if ( testWFlags( WStyle_Title ) )
+- mwmhints.decorations |= (1L << 3); // MWM_DECOR_TITLE
++ if ( testWFlags( WStyle_Title ) )
++ mwmhints.decorations |= (1L << 3); // MWM_DECOR_TITLE
+
+- if ( testWFlags( WStyle_SysMenu ) )
+- mwmhints.decorations |= (1L << 4); // MWM_DECOR_MENU
++ if ( testWFlags( WStyle_SysMenu ) )
++ mwmhints.decorations |= (1L << 4); // MWM_DECOR_MENU
+
+- if ( testWFlags( WStyle_Minimize ) )
+- mwmhints.decorations |= (1L << 5); // MWM_DECOR_MINIMIZE
++ if ( testWFlags( WStyle_Minimize ) )
++ mwmhints.decorations |= (1L << 5); // MWM_DECOR_MINIMIZE
+
+- if ( testWFlags( WStyle_Maximize ) )
+- mwmhints.decorations |= (1L << 6); // MWM_DECOR_MAXIMIZE
+- }
++ if ( testWFlags( WStyle_Maximize ) )
++ mwmhints.decorations |= (1L << 6); // MWM_DECOR_MAXIMIZE
+
+ if (testWFlags(WStyle_Tool)) {
+ wsa.save_under = True;
+@@ -525,23 +520,6 @@
+ }
+ }
+
+- // ### need a better way to do this
+- if (inherits("QPopupMenu")) {
+- // menu netwm type
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_menu;
+- } else if (inherits("QToolBar")) {
+- // toolbar netwm type
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_toolbar;
+- } else if (testWFlags(WStyle_Customize) && testWFlags(WStyle_Tool)) {
+- // utility netwm type
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_utility;
+- }
+-
+- if (dialog) // dialog netwm type
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_dialog;
+- // normal netwm type - default
+- net_wintypes[curr_wintype++] = qt_net_wm_window_type_normal;
+-
+ // stays on top
+ if (testWFlags(WStyle_StaysOnTop)) {
+ net_winstates[curr_winstate++] = qt_net_wm_state_above;
+@@ -576,6 +554,7 @@
+ wsa.save_under = True;
+ XChangeWindowAttributes( dpy, id, CWOverrideRedirect | CWSaveUnder,
+ &wsa );
++ x11SetWindowType();
+ } else if ( topLevel && !desktop ) { // top-level widget
+ QWidget *p = parentWidget(); // real parent
+ if (p)
+@@ -635,12 +614,7 @@
+ else
+ XDeleteProperty(dpy, id, qt_xa_motif_wm_hints);
+
+- // set _NET_WM_WINDOW_TYPE
+- if (curr_wintype > 0)
+- XChangeProperty(dpy, id, qt_net_wm_window_type, XA_ATOM, 32, PropModeReplace,
+- (unsigned char *) net_wintypes, curr_wintype);
+- else
+- XDeleteProperty(dpy, id, qt_net_wm_window_type);
++ x11SetWindowType();
+
+ // set _NET_WM_WINDOW_STATE
+ if (curr_winstate > 0)
+@@ -899,6 +873,64 @@
+ setMouseTracking(mouse_tracking);
+ }
+
++// Sets the EWMH (netwm) window type. Needed as a separate function
++// because create() may be too soon in some cases.
++void QWidget::x11SetWindowType( X11WindowType type )
++{
++ // NET window types
++ long net_wintypes[7] = { 0, 0, 0, 0, 0, 0, 0 };
++ int curr_wintype = 0;
++ if( testWFlags(WType_Desktop))
++ return;
++ if( type == X11WindowTypeSelect ) {
++ if ( testWFlags(WStyle_Splash)) {
++ if (qt_net_supports(qt_net_wm_window_type_splash)) {
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_splash;
++ }
++ } else if (inherits("QToolBar")) {
++ // toolbar netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_toolbar;
++ } else if (testWFlags(WStyle_Customize) && testWFlags(WStyle_Tool)) {
++ // utility netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_utility;
++ } else if (testWFlags(WType_Dialog)) {
++ // dialog netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_dialog;
++ }
++ } else if( type == X11WindowTypeCombo ) {
++ // combo netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_combo;
++ } else if( type == X11WindowTypeDND ) {
++ // dnd netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_dnd;
++ } else if( type == X11WindowTypeDropdown ) {
++ // dropdown netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_dropdown_menu;
++ } else if( type == X11WindowTypePopup ) {
++ // popup netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_popup_menu;
++ } else if( type == X11WindowTypeMenu ) {
++ // menu netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_menu;
++ } else if( type == X11WindowTypeTooltip ) {
++ // tooltip netwm type
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_tooltip;
++ }
++
++ // normal netwm type - default
++ net_wintypes[curr_wintype++] = qt_net_wm_window_type_normal;
++ // set _NET_WM_WINDOW_TYPE
++ if (curr_wintype > 0)
++ XChangeProperty(x11Display(), winId(), qt_net_wm_window_type, XA_ATOM, 32, PropModeReplace,
++ (unsigned char *) net_wintypes, curr_wintype);
++ else
++ XDeleteProperty(x11Display(), winId(), qt_net_wm_window_type);
++}
++
++void QWidget::x11SetWindowTransient( QWidget* parent )
++{
++ XSetTransientForHint( x11Display(), winId(), parent->winId());
++}
+
+ /*!
+ Translates the widget coordinate \a pos to global screen
+--- a/src/kernel/qwidget.h
++++ b/src/kernel/qwidget.h
+@@ -467,7 +467,19 @@
+ CGContextRef macCGContext(bool clipped=TRUE) const;
+ #endif
+ #endif
+-
++#if defined(Q_WS_X11)
++ enum X11WindowType {
++ X11WindowTypeSelect,
++ X11WindowTypeCombo,
++ X11WindowTypeDND,
++ X11WindowTypeTooltip,
++ X11WindowTypeMenu, // torn-off
++ X11WindowTypeDropdown,
++ X11WindowTypePopup
++ };
++ void x11SetWindowType( X11WindowType type = X11WindowTypeSelect );
++ void x11SetWindowTransient( QWidget* parent );
++#endif
+ void setWindowOpacity(double level);
+ double windowOpacity() const;
+
+--- a/src/dialogs/qdialog.cpp
++++ b/src/dialogs/qdialog.cpp
+@@ -708,7 +708,7 @@
+ && qApp->mainWidget() && qApp->mainWidget()->isVisible()
+ && !qApp->mainWidget()->isMinimized()) {
+ // make sure the transient for hint is set properly for modal dialogs
+- XSetTransientForHint( x11Display(), winId(), qApp->mainWidget()->winId() );
++ x11SetWindowTransient( qApp->mainWidget());
+ }
+ #endif // Q_WS_X11
+
+--- a/src/widgets/qtooltip.cpp
++++ b/src/widgets/qtooltip.cpp
+@@ -75,6 +75,7 @@
+ polish();
+ setText(text);
+ adjustSize();
++ x11SetWindowType( X11WindowTypeTooltip );
+ }
+ void setWidth( int w ) { resize( sizeForWidth( w ) ); }
+ };
+@@ -531,6 +532,10 @@
+ if (!widget)
+ return;
+
++#ifdef Q_WS_X11
++ label->x11SetWindowTransient( widget->topLevelWidget());
++#endif
++
+ #ifdef Q_WS_MAC
+ QRect screen = QApplication::desktop()->availableGeometry( scr );
+ #else
+--- a/src/widgets/qcombobox.cpp
++++ b/src/widgets/qcombobox.cpp
+@@ -392,12 +392,8 @@
+ inline QListBox * listBox() { return lBox; }
+ inline QComboBoxPopup * popup() { return pop; }
+ void updateLinedGeometry();
+-
+- void setListBox( QListBox *l ) { lBox = l ; usingLBox = TRUE;
+- l->setMouseTracking( TRUE );}
+-
+- void setPopupMenu( QComboBoxPopup * pm, bool isPopup=TRUE )
+- { pop = pm; if(isPopup) usingLBox = FALSE; }
++ void setListBox( QListBox *l );
++ void setPopupMenu( QComboBoxPopup * pm, bool isPopup=TRUE );
+
+ int current;
+ int maxCount;
+@@ -443,6 +439,30 @@
+ ed->setGeometry( r );
+ }
+
++void QComboBoxData::setListBox( QListBox *l )
++{
++ lBox = l;
++ usingLBox = TRUE;
++ l->setMouseTracking( TRUE );
++#ifdef Q_WS_X11
++ l->x11SetWindowType( QWidget::X11WindowTypeCombo );
++ l->x11SetWindowTransient( combo->topLevelWidget());
++#endif
++}
++
++void QComboBoxData::setPopupMenu( QComboBoxPopup * pm, bool isPopup )
++{
++ pop = pm;
++ if(isPopup)
++ usingLBox = FALSE;
++#ifdef Q_WS_X11
++ if( pm ) {
++ pm->x11SetWindowType( QWidget::X11WindowTypeCombo );
++ pm->x11SetWindowTransient( combo->topLevelWidget());
++ }
++#endif
++}
++
+ static inline bool checkInsertIndex( const char *method, const char * name,
+ int count, int *index)
+ {
+--- a/src/widgets/qpopupmenu.cpp
++++ b/src/widgets/qpopupmenu.cpp
+@@ -301,6 +301,9 @@
+ connectModalRecursionSafety = 0;
+
+ setFocusPolicy( StrongFocus );
++#ifdef Q_WS_X11
++ x11SetWindowType( X11WindowTypePopup );
++#endif
+ }
+
+ /*!
+@@ -564,6 +567,29 @@
+ if ( y < sy )
+ y = sy;
+ }
++#ifdef Q_WS_X11
++#ifndef QT_NO_MENUBAR
++ QMenuData *top = this; // find top level
++ while ( top->parentMenu )
++ top = top->parentMenu;
++ if( top->isMenuBar )
++ x11SetWindowType( X11WindowTypeDropdown );
++ if( parentMenu && parentMenu->isMenuBar )
++ x11SetWindowTransient( static_cast< QMenuBar* >( parentMenu )->topLevelWidget());
++#endif
++ if( parentMenu && !parentMenu->isMenuBar )
++ x11SetWindowTransient( static_cast< QPopupMenu* >( parentMenu ));
++ if( !parentMenu ) {
++ // hackish ... try to find the main window related to this popup
++ QWidget* parent = parentWidget() ? parentWidget()->topLevelWidget() : NULL;
++ if( parent == NULL )
++ parent = QApplication::widgetAt( pos );
++ if( parent == NULL )
++ parent = qApp->activeWindow();
++ if( parent != NULL )
++ x11SetWindowTransient( parent );
++ }
++#endif
+
+ if ( x+w > sx+sw ) // the complete widget must
+ x = sx+sw - w; // be visible
+@@ -1393,6 +1419,13 @@
+ #if defined(QT_ACCESSIBILITY_SUPPORT)
+ QAccessible::updateAccessibility( this, 0, QAccessible::PopupMenuEnd );
+ #endif
++#ifndef QT_NO_MENUBAR
++ QMenuData *top = this; // find top level
++ while ( top->parentMenu )
++ top = top->parentMenu;
++ if( top->isMenuBar )
++ x11SetWindowType( X11WindowTypePopup ); // reset
++#endif
+ parentMenu = 0;
+ hidePopups();
+ QWidget::hide();
+@@ -2716,6 +2749,9 @@
+ geometry().topLeft(), FALSE );
+ p->mitems->setAutoDelete( FALSE );
+ p->tornOff = TRUE;
++#ifdef Q_WS_X11
++ p->x11SetWindowType( X11WindowTypeMenu );
++#endif
+ for ( QMenuItemListIt it( *mitems ); it.current(); ++it ) {
+ if ( it.current()->id() != QMenuData::d->aInt && !it.current()->widget() )
+ p->mitems->append( it.current() );
Added: trunk/packages/qt-x11-free/debian/patches/0080-net-wm-sync-request.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0080-net-wm-sync-request.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0080-net-wm-sync-request.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,307 @@
+qt-bugs@ issue : none
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak at kde.org>
+
+Support for _NET_WM_SYNC_REQUEST - allows the WM to find out when the app
+finished one redraw - less flicker during resize and with compositing
+also when opening a window.
+
+--- a/src/kernel/qwidget.h
++++ b/src/kernel/qwidget.h
+@@ -589,6 +589,14 @@
+ void destroyInputContext();
+ void focusInputContext();
+ void checkChildrenDnd();
++
++#ifndef QT_NO_XSYNC
++ void createSyncCounter();
++ void destroySyncCounter();
++ void incrementSyncCounter();
++ void handleSyncRequest( void* ev );
++#endif
++
+ #elif defined(Q_WS_MAC)
+ uint own_id : 1, macDropEnabled : 1;
+ EventHandlerRef window_event;
+@@ -965,6 +973,10 @@
+ uint uspos : 1; // User defined position
+ uint ussize : 1; // User defined size
+ void *xic; // XIM Input Context
++#ifndef QT_NO_XSYNC
++ ulong syncCounter;
++ uint syncRequestValue[2];
++#endif
+ #endif
+ #if defined(Q_WS_MAC)
+ WindowGroupRef group;
+--- a/src/kernel/qt_x11_p.h
++++ b/src/kernel/qt_x11_p.h
+@@ -177,6 +177,11 @@
+ #endif // QT_NO_XRENDER
+
+
++#ifndef QT_NO_XSYNC
++# include <X11/extensions/sync.h>
++#endif // QT_NO_XSYNC
++
++
+ #ifndef QT_NO_XKB
+ # include <X11/XKBlib.h>
+ #endif // QT_NO_XKB
+--- a/src/kernel/qwidget_x11.cpp
++++ b/src/kernel/qwidget_x11.cpp
+@@ -90,6 +90,12 @@
+ extern Time qt_x_time;
+ extern Time qt_x_user_time;
+
++#ifndef QT_NO_XSYNC
++extern Atom qt_net_wm_sync_request_counter;
++extern Atom qt_net_wm_sync_request;
++extern bool qt_use_xsync;
++#endif
++
+ // defined in qfont_x11.cpp
+ extern bool qt_has_xft;
+
+@@ -598,11 +604,14 @@
+
+ XResizeWindow( dpy, id, crect.width(), crect.height() );
+ XStoreName( dpy, id, qAppName() );
+- Atom protocols[4];
++ Atom protocols[5];
+ int n = 0;
+ protocols[n++] = qt_wm_delete_window; // support del window protocol
+ protocols[n++] = qt_wm_take_focus; // support take focus window protocol
+ protocols[n++] = qt_net_wm_ping; // support _NET_WM_PING protocol
++#ifndef QT_NO_XSYNC
++ protocols[n++] = qt_net_wm_sync_request;// support the _NET_WM_SYNC_REQUEST protocol
++#endif
+ if ( testWFlags( WStyle_ContextHelp ) )
+ protocols[n++] = qt_net_wm_context_help;
+ XSetWMProtocols( dpy, id, protocols, n );
+@@ -628,6 +637,14 @@
+ XChangeProperty(dpy, id, qt_net_wm_pid, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &curr_pid, 1);
+
++#ifndef QT_NO_XSYNC
++ // set _NET_WM_SYNC_COUNTER
++ createSyncCounter();
++ long counterVal = topData()->syncCounter;
++ XChangeProperty( dpy, id, qt_net_wm_sync_request_counter, XA_CARDINAL, 32, PropModeReplace,
++ (unsigned char*) &counterVal, 1);
++#endif
++
+ // when we create a toplevel widget, the frame strut should be dirty
+ fstrut_dirty = 1;
+
+@@ -723,6 +740,9 @@
+ if ( destroyWindow )
+ qt_XDestroyWindow( this, x11Display(), winid );
+ }
++#ifndef QT_NO_XSYNC
++ destroySyncCounter();
++#endif
+ setWinId( 0 );
+
+ extern void qPRCleanup( QWidget *widget ); // from qapplication_x11.cpp
+@@ -772,6 +792,10 @@
+ destroyInputContext();
+ }
+
++#ifndef QT_NO_XSYNC
++ destroySyncCounter();
++#endif
++
+ if ( isTopLevel() || !parent ) // we are toplevel, or reparenting to toplevel
+ topData()->parentWinId = 0;
+
+@@ -2459,6 +2483,11 @@
+ {
+ // created lazily
+ extra->topextra->xic = 0;
++#ifndef QT_NO_XSYNC
++ extra->topextra->syncCounter = 0;
++ extra->topextra->syncRequestValue[0] = 0;
++ extra->topextra->syncRequestValue[1] = 0;
++#endif
+ }
+
+ void QWidget::deleteTLSysExtra()
+@@ -2504,6 +2533,51 @@
+ }
+ }
+
++
++#ifndef QT_NO_XSYNC
++// create a window's XSyncCounter
++void QWidget::createSyncCounter()
++{
++ if( !qt_use_xsync || !isTopLevel() || topData()->syncCounter )
++ return;
++ XSyncValue zero;
++ XSyncIntToValue( &zero, 0 );
++ topData()->syncCounter = XSyncCreateCounter( x11Display(), zero );
++}
++
++// destroy a window's XSyncCounter
++void QWidget::destroySyncCounter()
++{
++ if( !qt_use_xsync || !extra || !extra->topextra
++ || !extra->topextra->syncCounter )
++ return;
++ XSyncDestroyCounter( x11Display(), extra->topextra->syncCounter );
++ extra->topextra->syncCounter = 0;
++}
++
++// increment a window's XSyncCounter
++void QWidget::incrementSyncCounter()
++{
++ if( qt_use_xsync && topData()->syncCounter &&
++ !(topData()->syncRequestValue[0] == 0 &&
++ topData()->syncRequestValue[1] == 0) ) {
++ XSyncValue val;
++ XSyncIntsToValue( &val, topData()->syncRequestValue[ 0 ], topData()->syncRequestValue[ 1 ] );
++ XSyncSetCounter( x11Display(), topData()->syncCounter, val );
++ topData()->syncRequestValue[0] = topData()->syncRequestValue[1] = 0;
++ }
++}
++
++// handle _NET_WM_SYNC_REQUEST
++void QWidget::handleSyncRequest( void* ev )
++{
++ XEvent* xev = (XEvent*)ev;
++ topData()->syncRequestValue[ 0 ] = xev->xclient.data.l[ 2 ];
++ topData()->syncRequestValue[ 1 ] = xev->xclient.data.l[ 3 ];
++}
++#endif // QT_NO_XSYNC
++
++
+ /*!
+ \property QWidget::acceptDrops
+ \brief whether drop events are enabled for this widget
+--- a/src/kernel/qapplication_x11.cpp
++++ b/src/kernel/qapplication_x11.cpp
+@@ -288,6 +288,11 @@
+ Window *qt_net_virtual_root_list = 0;
+
+
++// X11 SYNC support
++#ifndef QT_NO_XSYNC
++Atom qt_net_wm_sync_request_counter = 0;
++Atom qt_net_wm_sync_request = 0;
++#endif
+
+ // client leader window
+ Window qt_x11_wm_client_leader = 0;
+@@ -312,6 +317,13 @@
+ // Display
+ Q_EXPORT bool qt_use_xrender = FALSE;
+
++#ifndef QT_NO_XSYNC
++// True if SYNC extension exists on the connected display
++bool qt_use_xsync = FALSE;
++static int xsync_eventbase;
++static int xsync_errorbase;
++#endif
++
+ // modifier masks for alt/meta - detected when the application starts
+ static long qt_alt_mask = 0;
+ static long qt_meta_mask = 0;
+@@ -1941,6 +1953,11 @@
+ qt_x11_intern_atom( "UTF8_STRING", &qt_utf8_string );
+ qt_x11_intern_atom( "_SGI_DESKS_MANAGER", &qt_sgi_desks_manager );
+
++#ifndef QT_NO_XSYNC
++ qt_x11_intern_atom( "_NET_WM_SYNC_REQUEST_COUNTER", &qt_net_wm_sync_request_counter );
++ qt_x11_intern_atom( "_NET_WM_SYNC_REQUEST", &qt_net_wm_sync_request );
++#endif
++
+ qt_xdnd_setup();
+ qt_x11_motifdnd_init();
+
+@@ -1977,6 +1994,15 @@
+ }
+ #endif // QT_NO_XRENDER
+
++#ifndef QT_NO_XSYNC
++ // Try to initialize SYNC extension on the connected display
++ int xsync_major, xsync_minor;
++ if ( XSyncQueryExtension( appDpy, &xsync_eventbase, &xsync_errorbase ) &&
++ XSyncInitialize( appDpy, &xsync_major, &xsync_minor ) ) {
++ qt_use_xsync = TRUE;
++ }
++#endif
++
+ #ifndef QT_NO_XKB
+ // If XKB is detected, set the GrabsUseXKBState option so input method
+ // compositions continue to work (ie. deadkeys)
+@@ -3144,6 +3170,10 @@
+ XSendEvent( event->xclient.display, event->xclient.window,
+ False, SubstructureNotifyMask|SubstructureRedirectMask, event );
+ }
++#ifndef QT_NO_XSYNC
++ } else if (a == qt_net_wm_sync_request ) {
++ widget->handleSyncRequest( event );
++#endif
+ }
+ } else if ( event->xclient.message_type == qt_qt_scrolldone ) {
+ widget->translateScrollDoneEvent(event);
+@@ -5684,6 +5714,21 @@
+ return FALSE;
+ }
+
++#if defined(Q_C_CALLBACKS)
++extern "C" {
++#endif
++#ifndef QT_NO_XSYNC
++static Bool qt_net_wm_sync_request_scanner(Display*, XEvent* event, XPointer arg)
++{
++ return (event->type == ClientMessage && event->xclient.window == *(Window*)arg
++ && event->xclient.message_type == qt_wm_protocols
++ && event->xclient.data.l[ 0 ] == qt_net_wm_sync_request );
++}
++#endif
++
++#if defined(Q_C_CALLBACKS)
++}
++#endif
+
+ //
+ // ConfigureNotify (window move and resize) event translation
+@@ -5715,6 +5760,7 @@
+ if (! extra || extra->compress_events) {
+ // ConfigureNotify compression for faster opaque resizing
+ XEvent otherEvent;
++ int compressed_configs = 0;
+ while ( XCheckTypedWindowEvent( x11Display(), winId(), ConfigureNotify,
+ &otherEvent ) ) {
+ if ( qt_x11EventFilter( &otherEvent ) )
+@@ -5735,7 +5781,18 @@
+ newCPos.ry() = otherEvent.xconfigure.y +
+ otherEvent.xconfigure.border_width;
+ }
++ ++compressed_configs;
++ }
++#ifndef QT_NO_XSYNC
++ // _NET_WM_SYNC_REQUEST compression
++ Window wid = winId();
++ while ( compressed_configs &&
++ XCheckIfEvent( x11Display(), &otherEvent,
++ qt_net_wm_sync_request_scanner, (XPointer)&wid ) ) {
++ handleSyncRequest( (void*)&otherEvent );
++ --compressed_configs;
+ }
++#endif
+ }
+
+ QRect cr ( geometry() );
+@@ -5789,6 +5846,8 @@
+ repaint( !testWFlags(WResizeNoErase) || transbg );
+ }
+
++ incrementSyncCounter();
++
+ return TRUE;
+ }
+
Added: trunk/packages/qt-x11-free/debian/patches/0083-CVE-2007-4137.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0083-CVE-2007-4137.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0083-CVE-2007-4137.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,19 @@
+qt-bugs@ issue : N175791
+bugs.kde.org number :
+applied: yes
+author: mueller at kde.org
+
+fixes an off-by-one buffer overflow in the utf8 decoder
+
+
+--- a/src/codecs/qutfcodec.cpp
++++ b/src/codecs/qutfcodec.cpp
+@@ -303,7 +303,7 @@
+ QString toUnicode(const char* chars, int len)
+ {
+ QString result;
+- result.setLength( len ); // worst case
++ result.setLength( len + 1 ); // worst case
+ QChar *qch = (QChar *)result.unicode();
+ QChar ch;
+ while ( len-- ) {
Added: trunk/packages/qt-x11-free/debian/patches/0085-fix-buildkey.diff
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/0085-fix-buildkey.diff (rev 0)
+++ trunk/packages/qt-x11-free/debian/patches/0085-fix-buildkey.diff 2008-02-09 10:40:03 UTC (rev 9363)
@@ -0,0 +1,30 @@
+qt-bugs@ issue :
+bugs.kde.org number :
+applied: no
+author: Dirk Mueller <mueller at kde.org>
+
+gcc 4.3 produces a "3.*" buildkey. That's oh so wrong.
+
+
+--- a/configure
++++ b/configure
+@@ -3081,15 +3081,15 @@
+ g++*)
+ # GNU C++
+ QMAKE_CONF_COMPILER=`grep "QMAKE_CXX[^_A-Z0-9a-z]" $QMAKESPEC/qmake.conf | sed "s,.* *= *\(.*\)$,\1,"`
+- COMPILER_VERSION=`${QMAKE_CONF_COMPILER} --version 2>/dev/null`
++ COMPILER_VERSION=`${QMAKE_CONF_COMPILER} --version 2>/dev/null | sed 's,^[^0-9]*,,g'`
+ case "$COMPILER_VERSION" in
+- *2.95.*)
++ 2.95.*)
+ COMPILER_VERSION="2.95.*"
+ ;;
+- *3.*)
++ 3.*)
+ COMPILER_VERSION="3.*"
+ ;;
+- *4.*)
++ 4.*)
+ COMPILER_VERSION="4"
+ ;;
+ *)
More information about the pkg-kde-commits
mailing list