4101233
diff -up qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage.cpp.me qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage.cpp
4101233
--- qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage.cpp.me	2009-10-02 18:26:02.000000000 +0200
4101233
+++ qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage.cpp	2009-10-02 18:27:13.000000000 +0200
4101233
@@ -144,7 +144,7 @@ QImage::Format QNativeImage::systemForma
4101233
 #elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
4101233
 
4101233
 QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
4101233
-    : xshmimg(0), xshmpm(0)
4101233
+    : xshmimg(0)
4101233
 {
4101233
     if (!X11->use_mitshm) {
4101233
         image = QImage(width, height, format);
4101233
@@ -195,11 +195,6 @@ QNativeImage::QNativeImage(int width, in
4101233
             shmctl(xshminfo.shmid, IPC_RMID, 0);
4101233
         return;
4101233
     }
4101233
-    xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
4101233
-                              &xshminfo, width, height, dd);
4101233
-    if (!xshmpm) {
4101233
-        qWarning() << "QNativeImage: Unable to create shared Pixmap.";
4101233
-    }
4101233
 }
4101233
 
4101233
 
4101233
@@ -208,10 +203,6 @@ QNativeImage::~QNativeImage()
4101233
     if (!xshmimg)
4101233
         return;
4101233
 
4101233
-    if (xshmpm) {
4101233
-        XFreePixmap(X11->display, xshmpm);
4101233
-        xshmpm = 0;
4101233
-    }
4101233
     XShmDetach(X11->display, &xshminfo);
4101233
     xshmimg->data = 0;
4101233
     XDestroyImage(xshmimg);
4101233
diff -up qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage_p.h.me qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage_p.h
4101233
--- qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage_p.h.me	2009-10-02 18:33:38.000000000 +0200
4101233
+++ qt-x11-opensource-src-4.5.3/src/gui/image/qnativeimage_p.h	2009-10-02 18:34:01.000000000 +0200
4101233
@@ -90,7 +90,6 @@ public:
4101233
 
4101233
 #elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
4101233
     XImage *xshmimg;
4101233
-    Pixmap xshmpm;
4101233
     XShmSegmentInfo xshminfo;
4101233
 
4101233
 #elif defined(Q_WS_MAC)
4101233
diff -up qt-x11-opensource-src-4.5.3/src/gui/kernel/qapplication_x11.cpp.me qt-x11-opensource-src-4.5.3/src/gui/kernel/qapplication_x11.cpp
4101233
--- qt-x11-opensource-src-4.5.3/src/gui/kernel/qapplication_x11.cpp.me	2009-10-02 18:27:55.000000000 +0200
4101233
+++ qt-x11-opensource-src-4.5.3/src/gui/kernel/qapplication_x11.cpp	2009-10-02 18:33:30.000000000 +0200
4101233
@@ -1959,12 +1959,9 @@ void qt_init(QApplicationPrivate *priv, 
4101233
             bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
4101233
             if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
4101233
                 Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
4101233
-                X11->use_mitshm = mitshm_pixmaps && ((defaultVisual->red_mask == 0xff0000
4101233
-                                                      || defaultVisual->red_mask == 0xf800)
4101233
-                                                     && (defaultVisual->green_mask == 0xff00
4101233
-                                                         || defaultVisual->green_mask == 0x7e0)
4101233
-                                                     && (defaultVisual->blue_mask == 0xff
4101233
-                                                         || defaultVisual->blue_mask == 0x1f));
4101233
+                X11->use_mitshm = (defaultVisual->red_mask == 0xff0000 || defaultVisual->red_mask == 0xf800)
4101233
+                                   && (defaultVisual->green_mask == 0xff00 || defaultVisual->green_mask == 0x7e0)
4101233
+                                   && (defaultVisual->blue_mask == 0xff || defaultVisual->blue_mask == 0x1f);
4101233
             }
4101233
         }
4101233
 #endif // QT_NO_MITSHM
4101233
diff -up qt-x11-opensource-src-4.5.3/src/gui/painting/qwindowsurface_raster.cpp.me qt-x11-opensource-src-4.5.3/src/gui/painting/qwindowsurface_raster.cpp
4101233
--- qt-x11-opensource-src-4.5.3/src/gui/painting/qwindowsurface_raster.cpp.me	2009-10-02 18:34:18.000000000 +0200
4101233
+++ qt-x11-opensource-src-4.5.3/src/gui/painting/qwindowsurface_raster.cpp	2009-10-02 18:35:54.000000000 +0200
4101233
@@ -220,9 +220,16 @@ void QRasterWindowSurface::flush(QWidget
4101233
 
4101233
     QRect br = rgn.boundingRect().translated(offset);
4101233
 #ifndef QT_NO_MITSHM
4101233
-    if (d_ptr->image->xshmpm) {
4101233
-        XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
4101233
-                  br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
4101233
+    if (d_ptr->image->xshmimg && (br.width() * br.height() > 65536)) {
4101233
+        const QImage &src = d->image->image;
4101233
+        br = br.intersected(src.rect());
4101233
+        // Hack to make sure we satisify the PutImage() constraints in the X server,
4101233
+        // since the doShmPutImage() route currently forces a migration to system ram.
4101233
+        wbr.setX(wbr.x() - br.x());
4101233
+        br.setX(0);
4101233
+        br.setWidth(src.width());
4101233
+        XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
4101233
+                     br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False);
4101233
         XSync(X11->display, False);
4101233
     } else
4101233
 #endif