mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
Fixed: locking GDI objects twice when running wm_paint test.
svn path=/trunk/; revision=4062
This commit is contained in:
parent
4b0f9d9631
commit
2f26431f71
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: mouse.c,v 1.15 2002/11/01 11:29:57 dwelch Exp $
|
/* $Id: mouse.c,v 1.16 2003/01/24 23:25:34 ei Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Mouse
|
* PURPOSE: Mouse
|
||||||
|
@ -218,6 +218,7 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
dc = DC_HandleToPtr(hDC);
|
dc = DC_HandleToPtr(hDC);
|
||||||
SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
||||||
SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
||||||
|
DC_ReleasePtr( hDC );
|
||||||
|
|
||||||
/* Compile the total mouse movement change and dispatch button events. */
|
/* Compile the total mouse movement change and dispatch button events. */
|
||||||
for (i = 0; i < InputCount; i++)
|
for (i = 0; i < InputCount; i++)
|
||||||
|
@ -276,14 +277,20 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
||||||
VOID
|
VOID
|
||||||
EnableMouse(HDC hDisplayDC)
|
EnableMouse(HDC hDisplayDC)
|
||||||
{
|
{
|
||||||
PDC dc = DC_HandleToPtr(hDisplayDC);
|
PDC dc;
|
||||||
PSURFOBJ SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
PSURFOBJ SurfObj;
|
||||||
PSURFGDI SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
PSURFGDI SurfGDI;
|
||||||
HBITMAP hMouseSurf;
|
HBITMAP hMouseSurf;
|
||||||
PSURFOBJ MouseSurf;
|
PSURFOBJ MouseSurf;
|
||||||
SIZEL MouseSize;
|
SIZEL MouseSize;
|
||||||
RECTL MouseRect;
|
RECTL MouseRect;
|
||||||
|
|
||||||
|
dc = DC_HandleToPtr(hDisplayDC);
|
||||||
|
if( dc ){
|
||||||
|
SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
||||||
|
SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
||||||
|
DC_ReleasePtr( hDisplayDC );
|
||||||
|
|
||||||
/* Create the default mouse cursor. */
|
/* Create the default mouse cursor. */
|
||||||
mouse_width = 32;
|
mouse_width = 32;
|
||||||
mouse_height = 32;
|
mouse_height = 32;
|
||||||
|
@ -300,4 +307,8 @@ EnableMouse(HDC hDisplayDC)
|
||||||
mouse_y = 240;
|
mouse_y = 240;
|
||||||
MouseEnabled = TRUE;
|
MouseEnabled = TRUE;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
MouseEnabled = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,35 +314,23 @@ empty:
|
||||||
*/
|
*/
|
||||||
HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
|
HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
|
||||||
{
|
{
|
||||||
PROSRGNDATA objSrc = RGNDATA_LockRgn(hSrc);
|
PROSRGNDATA objSrc, rgnDst;
|
||||||
HRGN hNewDst;
|
HRGN hNewDst, hRet = NULL;
|
||||||
|
GDIMULTILOCK Lock[2] = {{hDst, 0, GO_REGION_MAGIC}, {hSrc, 0, GO_REGION_MAGIC}};
|
||||||
|
|
||||||
if(objSrc)
|
if( !hDst ){
|
||||||
{
|
|
||||||
PROSRGNDATA rgnDst;
|
|
||||||
|
|
||||||
if(hDst)
|
|
||||||
{
|
|
||||||
if(!(rgnDst = RGNDATA_LockRgn(hDst)))
|
|
||||||
{
|
|
||||||
hDst = 0;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if( !( hNewDst = RGNDATA_AllocRgn(1) ) ){
|
if( !( hNewDst = RGNDATA_AllocRgn(1) ) ){
|
||||||
RGNDATA_UnlockRgn( hSrc );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Lock[0].hObj = hNewDst;
|
||||||
|
}
|
||||||
|
|
||||||
if(!(rgnDst = RGNDATA_LockRgn(hNewDst)))
|
GDIOBJ_LockMultipleObj( &Lock, 2 );
|
||||||
|
rgnDst = Lock[0].pObj;
|
||||||
|
objSrc = Lock[1].pObj;
|
||||||
|
|
||||||
|
if( objSrc && rgnDst )
|
||||||
{
|
{
|
||||||
RGNDATA_FreeRgn( hNewDst );
|
|
||||||
RGNDATA_UnlockRgn( hSrc );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rgnDst)
|
if(rgnDst)
|
||||||
{
|
{
|
||||||
POINT pt = { 0, 0 };
|
POINT pt = { 0, 0 };
|
||||||
|
@ -352,32 +340,15 @@ HRGN REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPOINT lpPt)
|
||||||
|
|
||||||
if(REGION_CropAndOffsetRegion(lpPt, lpRect, objSrc, rgnDst) == FALSE)
|
if(REGION_CropAndOffsetRegion(lpPt, lpRect, objSrc, rgnDst) == FALSE)
|
||||||
{ // ve failed cleanup and return
|
{ // ve failed cleanup and return
|
||||||
RGNDATA_UnlockRgn( hSrc );
|
hRet = NULL;
|
||||||
|
|
||||||
if(hDst) // unlock new region if allocated
|
|
||||||
RGNDATA_UnlockRgn( hDst );
|
|
||||||
else
|
|
||||||
RGNDATA_UnlockRgn( hNewDst );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else{ // ve are fine. unlock the correct pointer and return correct handle
|
else{ // ve are fine. unlock the correct pointer and return correct handle
|
||||||
RGNDATA_UnlockRgn( hSrc );
|
hRet = Lock[0].hObj;
|
||||||
|
|
||||||
if(hDst == 0){
|
|
||||||
RGNDATA_UnlockRgn( hNewDst );
|
|
||||||
return hNewDst;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RGNDATA_UnlockRgn( hDst );
|
|
||||||
return hDst;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
GDIOBJ_UnlockMultipleObj( &Lock, 2 );
|
||||||
RGNDATA_UnlockRgn( hSrc );
|
return hRet;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in a new issue