Changed DC members w.hVisRgn, w.hClipRgn, amd w.hGCClipRgn to
coordinates relative to the device, not the DC origin. This is
necessary to correctly implement GetClipRgn16 and InquireVisRgn.
SelectVisRgn also expects region in device-relative coordinates.
Adapted the rest of Wine to this coordinate change.
Implemented ExtSelectClipRgn.

diff --git a/graphics/path.c b/graphics/path.c
index bd5dffd..23698d3 100644
--- a/graphics/path.c
+++ b/graphics/path.c
@@ -424,7 +424,7 @@
 BOOL32 WINAPI SelectClipPath32(HDC32 hdc, INT32 iMode)
 {
    GdiPath *pPath;
-   HRGN32  hrgnPath, hrgnClip;
+   HRGN32  hrgnPath;
    BOOL32  success;
    
    /* Get pointer to path */
@@ -444,17 +444,7 @@
    /* Construct a region from the path */
    if(PATH_PathToRegion(pPath, GetPolyFillMode32(hdc), &hrgnPath))
    {
-      hrgnClip=CreateRectRgn32(0, 0, 0, 0);
-      if(hrgnClip==(HRGN32)0)
-         success=FALSE;
-      else
-      {
-         success=(GetClipRgn32(hdc, hrgnClip)!=-1) &&
-	    (CombineRgn32(hrgnClip, hrgnClip, hrgnPath, iMode)!=ERROR) &&
-	    (SelectClipRgn32(hdc, hrgnClip)!=ERROR);
-	 DeleteObject32(hrgnClip);
-      }
-
+      success = ExtSelectClipRgn( hdc, hrgnPath, iMode ) != ERROR;
       DeleteObject32(hrgnPath);
 
       /* Empty the path */
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index 87ddb15..fc146d7 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -1035,7 +1035,6 @@
     if (widthDst < 0) SWAP_INT32( &rect.left, &rect.right );
     if (heightDst < 0) SWAP_INT32( &rect.top, &rect.bottom );
     GetRgnBox32( dcDst->w.hGCClipRgn, &clipRect );
-    OffsetRect32( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY );
     if (!IntersectRect32( visRectDst, &rect, &clipRect )) return FALSE;
 
       /* Get the source visible rectangle */
@@ -1046,7 +1045,6 @@
     if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom );
     /* Apparently the clip region is only for output, so use hVisRgn here */
     GetRgnBox32( dcSrc->w.hVisRgn, &clipRect );
-    OffsetRect32( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY );
     if (!IntersectRect32( visRectSrc, &rect, &clipRect )) return FALSE;
 
       /* Intersect the rectangles */
diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c
index bf5f880..60f9319 100644
--- a/graphics/x11drv/clipping.c
+++ b/graphics/x11drv/clipping.c
@@ -54,8 +54,8 @@
     else
         pXrect = NULL;
 
-    TSXSetClipRectangles( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY, 
-                pXrect, obj->rgn->numRects, YXBanded );
+    TSXSetClipRectangles( display, dc->u.x.gc, 0, 0,
+                          pXrect, obj->rgn->numRects, YXBanded );
 
     if(pXrect)
         HeapFree( GetProcessHeap(), 0, pXrect );
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index b4b70d5..750c757 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -619,7 +619,8 @@
     if (!(tmpVisRgn = CreateRectRgn32( 0, 0, 0, 0 ))) return FALSE;
 
       /* Transform region into device co-ords */
-    if (!REGION_LPTODP( hdc, tmpVisRgn, hrgn )) {
+    if (  !REGION_LPTODP( hdc, tmpVisRgn, hrgn )
+        || OffsetRgn32( tmpVisRgn, dc->w.DCOrgX, dc->w.DCOrgY ) == ERROR) {
         DeleteObject32( tmpVisRgn );
 	return FALSE;
     }
@@ -638,8 +639,8 @@
     GetRgnBox32( dc->w.hGCClipRgn, &box );
     if (DC_SetupGCForBrush( dc ))
 	TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
-		        dc->w.DCOrgX + box.left, dc->w.DCOrgY + box.top,
-		        box.right-box.left, box.bottom-box.top );
+		          box.left, box.top,
+		          box.right-box.left, box.bottom-box.top );
 
       /* Restore the visible region */
 
@@ -876,8 +877,8 @@
     if (GetRgnBox32( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE;
 
     if (!(image = XGetImage( display, dc->u.x.drawable,
-                             dc->w.DCOrgX + rect.left,
-                             dc->w.DCOrgY + rect.top,
+                             rect.left,
+                             rect.top,
                              rect.right - rect.left,
                              rect.bottom - rect.top,
                              AllPlanes, ZPixmap ))) return FALSE;
@@ -887,10 +888,10 @@
           /* ROP mode is always GXcopy for flood-fill */
         XSetFunction( display, dc->u.x.gc, GXcopy );
         X11DRV_InternalFloodFill(image, dc,
-                                 XLPTODP(dc,params->x) - rect.left,
-                                 YLPTODP(dc,params->y) - rect.top,
-                                 dc->w.DCOrgX + rect.left,
-                                 dc->w.DCOrgY + rect.top,
+                                 XLPTODP(dc,params->x) + dc->w.DCOrgX - rect.left,
+                                 YLPTODP(dc,params->y) + dc->w.DCOrgY - rect.top,
+                                 rect.left,
+                                 rect.top,
                                  COLOR_ToPhysical( dc, params->color ),
                                  params->fillType );
     }
diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c
index 0b93e10..068b4cc 100644
--- a/graphics/x11drv/text.c
+++ b/graphics/x11drv/text.c
@@ -28,7 +28,6 @@
                    const RECT32 *lprect, LPCSTR str, UINT32 count,
                    const INT32 *lpDx )
 {
-    HRGN32		hRgnClip = 0;
     int 	        i;
     fontObject*		pfo;
     INT32	 	width, ascent, descent, xwidth, ywidth;
@@ -176,9 +175,9 @@
 
     if (flags & ETO_CLIPPED)
     {
-        hRgnClip = dc->w.hClipRgn;
-        CLIPPING_IntersectClipRect( dc, rect.left, rect.top, rect.right,
-                                    rect.bottom, CLIP_INTERSECT|CLIP_KEEPRGN );
+        SaveVisRgn( dc->hSelf );
+        CLIPPING_IntersectVisRect( dc, rect.left, rect.top, rect.right,
+                                   rect.bottom, FALSE );
     }
 
       /* Draw the text background if necessary */
@@ -331,10 +330,8 @@
     }
 
     if (flags & ETO_CLIPPED) 
-    {
-      SelectClipRgn32( dc->hSelf, hRgnClip );
-      DeleteObject32( hRgnClip );
-    }
+        RestoreVisRgn( dc->hSelf );
+
     return TRUE;
 }