From 07e4213642458232299c041f97d7bbbe3598e9a6 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Sun, 19 Mar 2000 21:19:21 +0000
Subject: [PATCH] Added GetDCOrgEx in graphics device interface and removed X11
 code from dc.c.

---
 graphics/enhmetafiledrv/init.c |  1 +
 graphics/metafiledrv/init.c    |  1 +
 graphics/psdrv/init.c          |  1 +
 graphics/ttydrv/init.c         |  1 +
 graphics/win16drv/init.c       |  1 +
 graphics/x11drv/graphics.c     | 19 +++++++++++++++++++
 graphics/x11drv/init.c         |  1 +
 include/gdi.h                  |  1 +
 include/x11drv.h               |  1 +
 objects/dc.c                   | 31 ++++++-------------------------
 10 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/graphics/enhmetafiledrv/init.c b/graphics/enhmetafiledrv/init.c
index 4fce766a3ca..914858f41db 100644
--- a/graphics/enhmetafiledrv/init.c
+++ b/graphics/enhmetafiledrv/init.c
@@ -53,6 +53,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
     EMFDRV_FlattenPath,              /* pFlattenPath */
     EMFDRV_FrameRgn,                 /* pFrameRgn */
     NULL,                            /* pGetCharWidth */
+    NULL,                            /* pGetDCOrgEx */
     NULL, /* no implementation */    /* pGetPixel */
     NULL,                            /* pGetTextExtentPoint */
     NULL,                            /* pGetTextMetrics */
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index a9ff802eea6..b00d8caa028 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -51,6 +51,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
     MFDRV_FlattenPath,               /* pFlattenPath */
     MFDRV_FrameRgn,                  /* pFrameRgn */
     NULL,                            /* pGetCharWidth */
+    NULL,                            /* pGetDCOrgEx */
     NULL, /* no implementation */    /* pGetPixel */
     NULL,                            /* pGetTextExtentPoint */
     NULL,                            /* pGetTextMetrics */
diff --git a/graphics/psdrv/init.c b/graphics/psdrv/init.c
index ed0daed96d9..99d81d8c909 100644
--- a/graphics/psdrv/init.c
+++ b/graphics/psdrv/init.c
@@ -55,6 +55,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
     NULL,                            /* pFlattenPath */
     NULL,                            /* pFrameRgn */
     PSDRV_GetCharWidth,              /* pGetCharWidth */
+    NULL,                            /* pGetDCOrgEx */
     NULL,                            /* pGetPixel */
     PSDRV_GetTextExtentPoint,        /* pGetTextExtentPoint */
     PSDRV_GetTextMetrics,            /* pGetTextMetrics */
diff --git a/graphics/ttydrv/init.c b/graphics/ttydrv/init.c
index 7fb79bec1f3..cdee93c02fb 100644
--- a/graphics/ttydrv/init.c
+++ b/graphics/ttydrv/init.c
@@ -49,6 +49,7 @@ static const DC_FUNCTIONS TTYDRV_DC_Driver =
   NULL,                /* pFlattenPath */
   NULL,                /* pFrameRgn */
   TTYDRV_DC_GetCharWidth, /* pGetCharWidth */
+  NULL,                /* pGetDCOrgEx */
   TTYDRV_DC_GetPixel,  /* pGetPixel */
   TTYDRV_DC_GetTextExtentPoint, /* pGetTextExtentPoint */
   TTYDRV_DC_GetTextMetrics,  /* pGetTextMetrics */
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index 62310c0d97a..3b1cdfbe913 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -75,6 +75,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
     NULL,                            /* pFlattenPath */
     NULL,                            /* pFrameRgn */
     WIN16DRV_GetCharWidth,           /* pGetCharWidth */
+    NULL,                            /* pGetDCOrgEx */
     NULL,                            /* pGetPixel */
     WIN16DRV_GetTextExtentPoint,     /* pGetTextExtentPoint */
     WIN16DRV_GetTextMetrics,         /* pGetTextMetrics */
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index 9d05d3db93a..e3d82919daa 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -1337,4 +1337,23 @@ X11DRV_SetTextColor( DC *dc, COLORREF color )
     return oldColor;
 }
 
+/***********************************************************************
+ *           X11DRV_GetDCOrgEx
+ */
+BOOL X11DRV_GetDCOrgEx( DC *dc, LPPOINT lpp )
+{
+    if (!(dc->w.flags & DC_MEMORY))
+    {
+       X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *) dc->physDev;
+       Window root;
+       int w, h, border, depth;
+
+       /* FIXME: this is not correct for managed windows */
+       TSXGetGeometry( display, physDev->drawable, &root,
+                       (int*)&lpp->x, (int*)&lpp->y, &w, &h, &border, &depth );
+    }
+    else lpp->x = lpp->y = 0;
+    return TRUE;
+}
+
 #endif /* !defined(X_DISPLAY_MISSING) */
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index 064c30745db..5e2da445998 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -64,6 +64,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
     NULL,                            /* pFlattenPath */
     NULL,                            /* pFrameRgn */
     X11DRV_GetCharWidth,             /* pGetCharWidth */
+    X11DRV_GetDCOrgEx,               /* pGetDCOrgEx */
     X11DRV_GetPixel,                 /* pGetPixel */
     X11DRV_GetTextExtentPoint,       /* pGetTextExtentPoint */
     X11DRV_GetTextMetrics,           /* pGetTextMetrics */
diff --git a/include/gdi.h b/include/gdi.h
index 11ed31107df..6a9ce2bdf09 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -204,6 +204,7 @@ typedef struct tagDC_FUNCS
     BOOL     (*pFlattenPath)(DC*);
     BOOL     (*pFrameRgn)(DC*,HRGN,HBRUSH,INT,INT);
     BOOL     (*pGetCharWidth)(DC*,UINT,UINT,LPINT);
+    BOOL     (*pGetDCOrgEx)(DC*,LPPOINT);
     COLORREF (*pGetPixel)(DC*,INT,INT);
     BOOL     (*pGetTextExtentPoint)(DC*,LPCWSTR,INT,LPSIZE);
     BOOL     (*pGetTextMetrics)(DC*,TEXTMETRICA*);
diff --git a/include/x11drv.h b/include/x11drv.h
index cba80c9fc08..6d8067d24d7 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -91,6 +91,7 @@ extern BOOL X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
 				      DEVICEFONTENUMPROC dfeproc, LPARAM lp );
 extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar,
                                    UINT lastChar, LPINT buffer );
+extern BOOL X11DRV_GetDCOrgEx( struct tagDC *dc, LPPOINT lpp );
 extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCWSTR str,
                                          INT count, LPSIZE size );
 extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
diff --git a/objects/dc.c b/objects/dc.c
index d99d4ad3e4f..6ab2149c269 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -7,11 +7,6 @@
 
 #include "config.h"
 
-#ifndef X_DISPLAY_MISSING
-#include "ts_xlib.h"
-#include "x11drv.h"
-#endif  /* !defined(X_DISPLAY_MISSING) */
-
 #include <stdlib.h>
 #include <string.h>
 #include "dc.h"
@@ -25,7 +20,7 @@
 #include "wingdi.h"
 #include "wine/winuser16.h"
 
-DEFAULT_DEBUG_CHANNEL(dc)
+DEFAULT_DEBUG_CHANNEL(dc);
 
 /***********************************************************************
  *           DC_Init_DC_INFO
@@ -892,24 +887,10 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
     if (!lpp) return FALSE;
     if (!(dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC ))) return FALSE;
 
-#ifndef X_DISPLAY_MISSING
-    if (!(dc->w.flags & DC_MEMORY))
-    {
-       X11DRV_PDEVICE *physDev;
-       Window root;
-       int w, h, border, depth;
-
-       physDev = (X11DRV_PDEVICE *) dc->physDev;
-
-       /* FIXME: this is not correct for managed windows */
-       TSXGetGeometry( display, physDev->drawable, &root,
-                    (int*)&lpp->x, (int*)&lpp->y, &w, &h, &border, &depth );
-    }
-    else 
-#endif  /* !defined(X_DISPLAY_MISSING) */
-      lpp->x = lpp->y = 0;
-
-    lpp->x += dc->w.DCOrgX; lpp->y += dc->w.DCOrgY;
+    lpp->x = lpp->y = 0;
+    if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc, lpp );
+    lpp->x += dc->w.DCOrgX;
+    lpp->y += dc->w.DCOrgY;
     GDI_HEAP_UNLOCK( hDC );
     return TRUE;
 }
@@ -1316,7 +1297,7 @@ BOOL WINAPI DeleteColorSpace( HCOLORSPACE hColorSpace )
 {
   FIXME( "stub\n" );
   
-  return True;
+  return TRUE;
 }
 
 /***********************************************************************
-- 
GitLab