Index: /trunk/include/qwidget.h
===================================================================
--- /trunk/include/qwidget.h	(revision 74)
+++ /trunk/include/qwidget.h	(revision 75)
@@ -601,5 +601,4 @@
 #if !defined (QT_PM_NO_WIDGETMASK) 
     void validateObstacles();
-    LONG combineObstacles( HRGN hrgn, LONG op );
 #endif    
     enum ClipMode { ClipDefault, Unclipped, ClipAll }; 
Index: /trunk/src/kernel/qwidget_pm.cpp
===================================================================
--- /trunk/src/kernel/qwidget_pm.cpp	(revision 74)
+++ /trunk/src/kernel/qwidget_pm.cpp	(revision 75)
@@ -109,9 +109,12 @@
 }
 
+/** \internal flags for qt_WinProcessWindowObstacles() */
 enum {
     PWO_Children = 0x01,
     PWO_Sibings = 0x02,
     PWO_Ancestors = 0x04,
-    PWO_All = PWO_Children | PWO_Sibings | PWO_Ancestors, 
+    PWO_TopLevel = 0x80000000,
+    // PWO_Default is suitable in most cases (for simple paint operations)
+    PWO_Default = PWO_Children | PWO_Sibings | PWO_Ancestors, 
 };
 
@@ -226,5 +229,5 @@
  */
 static LONG qt_WinProcessWindowObstacles( HWND hwnd, PRECTL prcl, HRGN hrgn,
-                                          LONG op, LONG flags = PWO_All )
+                                          LONG op, LONG flags = PWO_Default )
 {
     Q_ASSERT( hwnd );
@@ -336,8 +339,16 @@
         while ( parent != desktop ) {
             HWND grandParent = WinQueryWindow( parent, QW_PARENT );
-            // no need to clip top-level windows (that cannot be non-rectangular
-            // and thus are always correctly clipped by the system)
-            if ( grandParent == desktop )
-                break;
+            if ( !(flags & PWO_TopLevel) ) {
+                // When PWO_TopLevel is not specified, top-level windows
+                // (children of the desktop) are not processed. It makes sense
+                // when qt_WinProcessWindowObstacles() is used to clip out
+                // overlying windows during regular paint operations (WM_PAINT
+                // processing or drawing in a window directly through
+                // WinGetPS()): in this case, top-level windows are always
+                // correctly clipped out by the system (because they cannot be
+                // non-rectangular).
+                if ( grandParent == desktop )
+                    break;
+            }
             
             WinQueryWindowPos( parent, &swp );
@@ -837,5 +848,5 @@
 #endif
             // note that we place the client on top (HWND_TOP) to exclude other
-            // frame controls from being analysed in qt_WinProcessWindowObstacles
+            // frame controls from being analyzed in qt_WinProcessWindowObstacles
             id = WinCreateWindow(
                     fId, pszClassName, title, style, 0, 0, 0, 0,
@@ -1865,5 +1876,6 @@
                 HRGN hrgnObst = GpiCreateRegion( hps, 0, NULL );
                 qt_WinProcessWindowObstacles( winId(), &rclAff, hrgnObst, CRGN_OR,
-                                              PWO_Sibings | PWO_Ancestors );
+                                              PWO_Sibings | PWO_Ancestors |
+                                              PWO_TopLevel );
                 // shift region of obstacles and affected region back to
                 // parent coords
@@ -2312,5 +2324,5 @@
     }
     
-    int pwoFlags = PWO_Ancestors | PWO_Sibings;
+    int pwoFlags = PWO_Ancestors | PWO_Sibings | PWO_TopLevel;
     if ( clip )
         pwoFlags |= PWO_Children;
@@ -2758,20 +2770,4 @@
 }
 
-/*!
- *  \internal
- *
- *  Combines areas of this widget covered by (intersected with) its children
- *  and sibling widgets to a region \a hrgn using an operation \a op
- *  (see GpiCombineRegion()). Returns the complexity of the combined region.
- *
- *  Clip regions of all relative widgets (set by WinSetClipRegion()) are taken
- *  into account.
- */
-/// @todo (dmik) is it really necessary somewhere?
-LONG QWidget::combineObstacles( HRGN hrgn, LONG op )
-{
-    return qt_WinProcessWindowObstacles( winId(), NULL, hrgn, op );
-}
-
 #endif // !defined (QT_PM_NO_WIDGETMASK)
 
