diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index c1f7b59..4dc7caa 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -505,13 +505,13 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h)
     nullBitmap = (HBITMAP)SelectObject(bufferDC, bufferBitmap);
 
     if (!bufferBitmap) {
-        qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), failed to create dibsection");
+        qErrnoWarning("QWindowsXPStylePrivate::buffer(%d,%d), CreateDIBSection() failed.", w, h);
         bufferW = 0;
         bufferH = 0;
         return 0;
     }
     if (!bufferPixels) {
-        qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), did not allocate pixel data");
+        qErrnoWarning("QWindowsXPStylePrivate::buffer(%d,%d), CreateDIBSection() did not allocate pixel data", w, h);
         bufferW = 0;
         bufferH = 0;
         return 0;
@@ -697,15 +697,15 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels)
             - Theme part is flipped (mirrored horizontally)
         else use drawBackgroundDirectly().
 */
-void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
+bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
 {
     if (themeData.rect.isEmpty())
-        return;
+        return true;
 
     QPainter *painter = themeData.painter;
     Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter");
     if (!painter || !painter->isActive())
-        return;
+        return false;
 
     painter->save();
 
@@ -741,13 +741,9 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
     }
 
     const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
-    if (dc) {
-        drawBackgroundDirectly(themeData);
-    } else {
-        drawBackgroundThruNativeBuffer(themeData);
-    }
-
+    const bool result = dc ? drawBackgroundDirectly(themeData) : drawBackgroundThruNativeBuffer(themeData);
     painter->restore();
+    return result;
 }
 
 /*! \internal
@@ -755,7 +751,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
     Do not use this if you need to perform other transformations on the
     resulting data.
 */
-void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
+bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
 {
     QPainter *painter = themeData.painter;
     HDC dc = 0;
@@ -830,6 +826,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
     }
     SelectClipRgn(dc, 0);
     DeleteObject(hrgn);
+    return  true;
 }
 
 /*! \internal
@@ -840,7 +837,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
     flips (horizonal mirroring only, vertical are handled by the theme
     engine).
 */
-void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData)
+bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData)
 {
     QPainter *painter = themeData.painter;
     QRect rect = themeData.rect;
@@ -964,7 +961,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
     QImage img;
     if (!haveCachedPixmap) { // If the pixmap is not cached, generate it! -------------------------
         if (!buffer(w, h)) // Ensure a buffer of at least (w, h) in size
-            return;
+            return false;
         HDC dc = bufferHDC();
 
         // Clear the buffer
@@ -1017,7 +1014,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
                 memset(&data, 0, sizeof(data));
                 data.dataValid = true;
                 alphaCache.insert(key, data);
-                return;
+                return true;
             }
             hasAlpha = hasAlphaChannel(rect);
             if (!hasAlpha && partIsTransparent)
@@ -1132,6 +1129,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         data.hadInvalidAlpha = wasAlphaFixed;
         alphaCache.insert(key, data);
     }
+    return true;
 }
 
 
@@ -1862,16 +1860,16 @@ case PE_Frame:
 
             theme.rect = QRect(option->rect.x(), option->rect.y()+fwidth, option->rect.x()+fwidth, option->rect.height()-fwidth);
             theme.partId = WP_FRAMELEFT;
-            d->drawBackground(theme);
+            qDebug() << "b1" << theme.rect << d->drawBackground(theme);
             theme.rect = QRect(option->rect.width()-fwidth, option->rect.y()+fwidth, fwidth, option->rect.height()-fwidth);
             theme.partId = WP_FRAMERIGHT;
-            d->drawBackground(theme);
+            qDebug() << "b2" << theme.rect << d->drawBackground(theme);
             theme.rect = QRect(option->rect.x(), option->rect.height()-fwidth, option->rect.width(), fwidth);
             theme.partId = WP_FRAMEBOTTOM;
-            d->drawBackground(theme);
+            qDebug() << "b3" << theme.rect << d->drawBackground(theme);
             theme.rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.y()+fwidth);
             theme.partId = WP_CAPTION;
-            d->drawBackground(theme);
+            qDebug() << "b4" << theme.rect << d->drawBackground(theme);
             return;
         }
         break;
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 5027588..3bc4a7c 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -398,9 +398,9 @@ public:
     QRegion region(XPThemeData &themeData);
 
     void setTransparency(QWidget *widget, XPThemeData &themeData);
-    void drawBackground(XPThemeData &themeData);
-    void drawBackgroundThruNativeBuffer(XPThemeData &themeData);
-    void drawBackgroundDirectly(XPThemeData &themeData);
+    bool drawBackground(XPThemeData &themeData);
+    bool drawBackgroundThruNativeBuffer(XPThemeData &themeData);
+    bool drawBackgroundDirectly(XPThemeData &themeData);
 
     bool hasAlphaChannel(const QRect &rect);
     bool fixAlphaChannel(const QRect &rect);
