From 3f61afbbc8d8a81b07e3948ff4a9c92b209cab09 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 14 Nov 2002 22:30:20 +0000 Subject: [PATCH] Added ReleaseDC function to the USER driver interface. --- dlls/user/user_main.c | 1 + dlls/x11drv/winpos.c | 11 +++++++++++ dlls/x11drv/x11drv.spec | 1 + include/user.h | 1 + windows/dce.c | 9 ++++++++- windows/win.c | 2 +- 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c index 3c692a7a14..47df466feb 100644 --- a/dlls/user/user_main.c +++ b/dlls/user/user_main.c @@ -105,6 +105,7 @@ static BOOL load_driver(void) GET_USER_FUNC(GetDC); GET_USER_FUNC(ForceWindowRaise); GET_USER_FUNC(MsgWaitForMultipleObjectsEx); + GET_USER_FUNC(ReleaseDC); GET_USER_FUNC(ScrollDC); GET_USER_FUNC(ScrollWindowEx); GET_USER_FUNC(SetFocus); diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index b03c7fb158..bc14be5fc2 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -531,6 +531,17 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) } +/*********************************************************************** + * ReleaseDC (X11DRV.@) + */ +void X11DRV_ReleaseDC( HWND hwnd, HDC hdc ) +{ + POINT org; + + org.x = org.y = 0; + X11DRV_SetDrawable( hdc, root_window, IncludeInferiors, &org, &org ); +} + /*********************************************************************** * SWP_DoWinPosChanging diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index 6173673853..e067306ec2 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -77,6 +77,7 @@ @ cdecl GetDC(long long long long) X11DRV_GetDC @ cdecl ForceWindowRaise(long) X11DRV_ForceWindowRaise @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx +@ cdecl ReleaseDC(long long) X11DRV_ReleaseDC @ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC @ cdecl ScrollWindowEx(long long long ptr ptr long ptr long) X11DRV_ScrollWindowEx @ cdecl SetFocus(long) X11DRV_SetFocus diff --git a/include/user.h b/include/user.h index 459db86f9b..51e4d4328f 100644 --- a/include/user.h +++ b/include/user.h @@ -98,6 +98,7 @@ typedef struct tagUSER_DRIVER { BOOL (*pGetDC)(HWND,HDC,HRGN,DWORD); void (*pForceWindowRaise)(HWND); DWORD (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD); + void (*pReleaseDC)(HWND,HDC); BOOL (*pScrollDC)(HDC,INT,INT,const RECT*,const RECT*,HRGN,LPRECT); INT (*pScrollWindowEx)(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT); void (*pSetFocus)(HWND); diff --git a/windows/dce.c b/windows/dce.c index db82f9ae71..e3d9f4d07e 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -172,6 +172,8 @@ void DCE_FreeWindowDCE( HWND hwnd ) } else if( pDCE->DCXflags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN) ) /* Class DCE*/ { + if (USER_Driver.pReleaseDC) + USER_Driver.pReleaseDC( pDCE->hwndCurrent, pDCE->hDC ); DCE_DeleteClipRgn( pDCE ); pDCE->hwndCurrent = 0; } @@ -191,6 +193,8 @@ void DCE_FreeWindowDCE( HWND hwnd ) DCE_ReleaseDC( pDCE ); } + if (pDCE->hwndCurrent && USER_Driver.pReleaseDC) + USER_Driver.pReleaseDC( pDCE->hwndCurrent, pDCE->hDC ); pDCE->DCXflags &= DCX_CACHE; pDCE->DCXflags |= DCX_DCEEMPTY; pDCE->hwndCurrent = 0; @@ -247,7 +251,8 @@ static INT DCE_ReleaseDC( DCE* dce ) /* don't keep around invalidated entries * because SetDCState() disables hVisRgn updates * by removing dirty bit. */ - + if (dce->hwndCurrent && USER_Driver.pReleaseDC) + USER_Driver.pReleaseDC( dce->hwndCurrent, dce->hDC ); dce->hwndCurrent = 0; dce->DCXflags &= DCX_CACHE; dce->DCXflags |= DCX_DCEEMPTY; @@ -306,6 +311,8 @@ BOOL DCE_InvalidateDCE(HWND hwnd, const RECT* pRectUpdate) /* Don't bother with visible regions of unused DCEs */ TRACE("\tpurged %p dce [%04x]\n", dce, dce->hwndCurrent); + if (dce->hwndCurrent && USER_Driver.pReleaseDC) + USER_Driver.pReleaseDC( dce->hwndCurrent, dce->hDC ); dce->hwndCurrent = 0; dce->DCXflags &= DCX_CACHE; dce->DCXflags |= DCX_DCEEMPTY; diff --git a/windows/win.c b/windows/win.c index e8897687b0..40c9e99aff 100644 --- a/windows/win.c +++ b/windows/win.c @@ -694,8 +694,8 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) DestroyMenu( wndPtr->hSysMenu ); wndPtr->hSysMenu = 0; } - USER_Driver.pDestroyWindow( hwnd ); DCE_FreeWindowDCE( hwnd ); /* Always do this to catch orphaned DCs */ + USER_Driver.pDestroyWindow( hwnd ); WINPROC_FreeProc( wndPtr->winproc, WIN_PROC_WINDOW ); CLASS_RemoveWindow( wndPtr->class ); wndPtr->class = NULL; -- 2.32.0.93.g670b81a890