Alexandre Julliard : gdi32: Export the DC hook functions as 32-bit functions.

Alexandre Julliard julliard at winehq.org
Mon Feb 18 08:50:32 CST 2008


Module: wine
Branch: master
Commit: 50dea3817868f471549107ea992f67ddbd8b05dc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=50dea3817868f471549107ea992f67ddbd8b05dc

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sun Feb 17 20:29:55 2008 +0100

gdi32: Export the DC hook functions as 32-bit functions.

---

 dlls/gdi32/clipping.c   |   11 ++++++-----
 dlls/gdi32/dc.c         |   25 ++++++++++++++++++++++---
 dlls/gdi32/gdi16.c      |   18 ++++++++++++++++++
 dlls/gdi32/gdi32.spec   |    5 +++--
 dlls/wineps.drv/init.c  |    3 +--
 dlls/winex11.drv/dce.c  |   13 +++++--------
 include/wine/wingdi16.h |    9 ---------
 include/wingdi.h        |   16 ++++++++++++++++
 8 files changed, 71 insertions(+), 29 deletions(-)

diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c
index 2c53dfb..e3a5851 100644
--- a/dlls/gdi32/clipping.c
+++ b/dlls/gdi32/clipping.c
@@ -163,22 +163,23 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
 }
 
 /***********************************************************************
- *           SelectVisRgn   (GDI.105)
+ *           SelectVisRgn   (GDI32.@)
+ *
+ * Note: not exported on Windows, only the 16-bit version is exported.
  */
-INT16 WINAPI SelectVisRgn16( HDC16 hdc16, HRGN16 hrgn )
+INT WINAPI SelectVisRgn( HDC hdc, HRGN hrgn )
 {
     int retval;
-    HDC hdc = HDC_32( hdc16 );
     DC * dc;
 
     if (!hrgn) return ERROR;
     if (!(dc = get_dc_ptr( hdc ))) return ERROR;
 
-    TRACE("%p %04x\n", hdc, hrgn );
+    TRACE("%p %p\n", hdc, hrgn );
 
     dc->dirty = 0;
 
-    retval = CombineRgn( dc->hVisRgn, HRGN_32(hrgn), 0, RGN_COPY );
+    retval = CombineRgn( dc->hVisRgn, hrgn, 0, RGN_COPY );
     CLIPPING_UpdateGCRegion( dc );
     release_dc_ptr( dc );
     return retval;
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index ba59a8d..3678791 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -1395,6 +1395,24 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData )
 }
 
 
+/***********************************************************************
+ *           GetDCHook   (GDI32.@)
+ *
+ * Note: this doesn't exist in Win32, we add it here because user32 needs it.
+ */
+DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc )
+{
+    DC *dc = get_dc_ptr( hdc );
+    DWORD_PTR ret;
+
+    if (!dc) return 0;
+    if (proc) *proc = dc->hookThunk;
+    ret = dc->dwHookData;
+    release_dc_ptr( dc );
+    return ret;
+}
+
+
 /* relay function to call the 16-bit DC hook proc */
 static BOOL WINAPI call_dc_hook16( HDC hdc, WORD code, DWORD_PTR data, LPARAM lParam )
 {
@@ -1454,11 +1472,12 @@ DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc )
 
 
 /***********************************************************************
- *           SetHookFlags   (GDI.192)
+ *           SetHookFlags   (GDI32.@)
+ *
+ * Note: this doesn't exist in Win32, we add it here because user32 needs it.
  */
-WORD WINAPI SetHookFlags16(HDC16 hdc16, WORD flags)
+WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
 {
-    HDC hdc = HDC_32( hdc16 );
     DC *dc = get_dc_obj( hdc );  /* not get_dc_ptr, this needs to work from any thread */
     LONG ret = 0;
 
diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c
index 02bb16f..b0cea2e 100644
--- a/dlls/gdi32/gdi16.c
+++ b/dlls/gdi32/gdi16.c
@@ -1347,6 +1347,15 @@ BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
 
 
 /***********************************************************************
+ *           SelectVisRgn   (GDI.105)
+ */
+INT16 WINAPI SelectVisRgn16( HDC16 hdc, HRGN16 hrgn )
+{
+    return SelectVisRgn( HDC_32(hdc), HRGN_32(hrgn) );
+}
+
+
+/***********************************************************************
  *           SetBitmapBits    (GDI.106)
  */
 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
@@ -1567,6 +1576,15 @@ void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
 
 
 /***********************************************************************
+ *           SetHookFlags   (GDI.192)
+ */
+WORD WINAPI SetHookFlags16( HDC16 hdc, WORD flags )
+{
+    return SetHookFlags( HDC_32(hdc), flags );
+}
+
+
+/***********************************************************************
  *           SetBoundsRect    (GDI.193)
  */
 UINT16 WINAPI SetBoundsRect16( HDC16 hdc, const RECT16* rect, UINT16 flags )
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 1a41c20..4738a38 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -515,10 +515,11 @@
 @ stdcall CloseJob16(long)
 @ stdcall DrvGetPrinterData16(str str ptr ptr long ptr)
 @ stdcall DrvSetPrinterData16(str str long ptr long)
+@ stdcall GetDCHook(long ptr)
 @ stdcall OpenJob16(str str long)
-@ stdcall SelectVisRgn16(long long)
+@ stdcall SelectVisRgn(long long)
 @ stdcall SetDCHook(long ptr long)
-@ stdcall SetHookFlags16(long long)
+@ stdcall SetHookFlags(long long)
 @ stdcall WriteSpool16(long ptr long)
 
 ################################################################
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 0024640..e492730 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -37,7 +37,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
-#include "wownt32.h"
 #include "winreg.h"
 #include "psdrv.h"
 #include "winspool.h"
@@ -406,7 +405,7 @@ HDC PSDRV_ResetDC( PSDRV_PDEVICE *physDev, const DEVMODEW *lpInitData )
         HeapFree(PSDRV_Heap, 0, devmodeA);
         PSDRV_UpdateDevCaps(physDev);
         hrgn = CreateRectRgn(0, 0, physDev->horzRes, physDev->vertRes);
-        SelectVisRgn16(HDC_16(physDev->hdc), HRGN_16(hrgn));
+        SelectVisRgn( physDev->hdc, hrgn );
         DeleteObject(hrgn);
     }
     return physDev->hdc;
diff --git a/dlls/winex11.drv/dce.c b/dlls/winex11.drv/dce.c
index 11d869e..a60ddb1 100644
--- a/dlls/winex11.drv/dce.c
+++ b/dlls/winex11.drv/dce.c
@@ -27,10 +27,7 @@
 #include "win.h"
 #include "windef.h"
 #include "wingdi.h"
-#include "wownt32.h"
 #include "x11drv.h"
-#include "wine/winbase16.h"
-#include "wine/wingdi16.h"
 #include "wine/server.h"
 #include "wine/list.h"
 #include "wine/debug.h"
@@ -170,7 +167,7 @@ static void update_visible_region( struct dce *dce )
     OffsetRgn( vis_rgn,
                -(escape.drawable_rect.left + escape.dc_rect.left),
                -(escape.drawable_rect.top + escape.dc_rect.top) );
-    SelectVisRgn16( HDC_16(dce->hdc), HRGN_16(vis_rgn) );
+    SelectVisRgn( dce->hdc, vis_rgn );
     DeleteObject( vis_rgn );
 }
 
@@ -214,7 +211,7 @@ static void delete_clip_rgn( struct dce *dce )
     dce->clip_rgn = 0;
 
     /* make it dirty so that the vis rgn gets recomputed next time */
-    SetHookFlags16( HDC_16(dce->hdc), DCHF_INVALIDATEVISRGN );
+    SetHookFlags( dce->hdc, DCHF_INVALIDATEVISRGN );
 }
 
 
@@ -317,7 +314,7 @@ void alloc_window_dce( struct x11drv_win_data *data )
         if (win_style & WS_CLIPCHILDREN) dce->flags |= DCX_CLIPCHILDREN;
         if (win_style & WS_CLIPSIBLINGS) dce->flags |= DCX_CLIPSIBLINGS;
     }
-    SetHookFlags16( HDC_16(dce->hdc), DCHF_INVALIDATEVISRGN );
+    SetHookFlags( dce->hdc, DCHF_INVALIDATEVISRGN );
 
     EnterCriticalSection( &dce_section );
     list_add_tail( &dce_list, &dce->entry );
@@ -427,7 +424,7 @@ void invalidate_dce( HWND hwnd, const RECT *rect )
                     /* Set dirty bits in the hDC and DCE structs */
 
                     TRACE("\tfixed up %p dce [%p]\n", dce, dce->hwnd);
-                    SetHookFlags16( HDC_16(dce->hdc), DCHF_INVALIDATEVISRGN );
+                    SetHookFlags( dce->hdc, DCHF_INVALIDATEVISRGN );
                 }
             }
         } /* dce list */
@@ -561,7 +558,7 @@ HDC X11DRV_GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
     dce->hwnd = hwnd;
     dce->flags = (dce->flags & ~clip_flags) | (flags & clip_flags);
 
-    if (SetHookFlags16( HDC_16(dce->hdc), DCHF_VALIDATEVISRGN ))
+    if (SetHookFlags( dce->hdc, DCHF_VALIDATEVISRGN ))
         bUpdateVisRgn = TRUE;  /* DC was dirty */
 
     if (bUpdateVisRgn) update_visible_region( dce );
diff --git a/include/wine/wingdi16.h b/include/wine/wingdi16.h
index c360d10..c56c7b1 100644
--- a/include/wine/wingdi16.h
+++ b/include/wine/wingdi16.h
@@ -269,7 +269,6 @@ typedef struct
     FONTSIGNATURE       ntmFontSig;
 } NEWTEXTMETRICEX16,*LPNEWTEXTMETRICEX16;
 
-typedef BOOL  (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
 typedef INT16 (CALLBACK *FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM);
 typedef VOID  (CALLBACK *LINEDDAPROC16)(INT16,INT16,LPARAM);
 typedef INT16 (CALLBACK *GOBJENUMPROC16)(SEGPTR,LPARAM);
@@ -343,13 +342,6 @@ struct PATH_INFO {
     DWORD BkColor;
 };
 
-/* DC hook codes */
-#define DCHC_INVALIDVISRGN      0x0001
-#define DCHC_DELETEDC           0x0002
-
-#define DCHF_INVALIDATEVISRGN   0x0001
-#define DCHF_VALIDATEVISRGN     0x0002
-
 /* RenderMode */
 #define RENDERMODE_NO_DISPLAY 0
 #define RENDERMODE_OPEN 1
@@ -577,7 +569,6 @@ COLORREF    WINAPI SetBkColor16(HDC16,COLORREF);
 INT16       WINAPI SetBkMode16(HDC16,INT16);
 UINT16      WINAPI SetBoundsRect16(HDC16,const RECT16*,UINT16);
 DWORD       WINAPI SetBrushOrg16(HDC16,INT16,INT16);
-BOOL        WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
 BOOL16      WINAPI SetDCHook16(HDC16,FARPROC16,DWORD);
 DWORD       WINAPI SetDCOrg16(HDC16,INT16,INT16);
 VOID        WINAPI SetDCState16(HDC16,HDC16);
diff --git a/include/wingdi.h b/include/wingdi.h
index 6af58ff..ea65928 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -3725,6 +3725,22 @@ WINGDIAPI BOOL    WINAPI wglSwapLayerBuffers(HDC,UINT);
 WINGDIAPI BOOL    WINAPI wglUseFontBitmaps(HDC,DWORD,DWORD,DWORD);
 WINGDIAPI BOOL    WINAPI wglUseFontOutlines(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,INT,LPGLYPHMETRICSFLOAT);
 
+#ifdef __WINESRC__
+/* the DC hook support is only exported on Win16, the 32-bit version is a Wine extension */
+
+#define DCHC_INVALIDVISRGN      0x0001
+#define DCHC_DELETEDC           0x0002
+#define DCHF_INVALIDATEVISRGN   0x0001
+#define DCHF_VALIDATEVISRGN     0x0002
+
+typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
+
+WINGDIAPI DWORD_PTR WINAPI GetDCHook(HDC,DCHOOKPROC*);
+WINGDIAPI BOOL      WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
+WINGDIAPI WORD      WINAPI SetHookFlags(HDC,WORD);
+WINGDIAPI INT       WINAPI SelectVisRgn(HDC,HRGN);
+#endif /* __WINESRC__ */
+
 #ifdef __cplusplus
 }
 #endif




More information about the wine-cvs mailing list