Better thread safety for WarpPointer hack.

This commit is contained in:
James Abbatiello 2000-02-25 20:53:34 +00:00 committed by Alexandre Julliard
parent 605325683f
commit ce829bdc8c
6 changed files with 14 additions and 17 deletions

View File

@ -109,7 +109,6 @@ void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
int height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
int iWndsLocks;
WINE_MOUSEEVENT wme;
BOOL bOldWarpPointer;
if ( !DefMouseEventProc ) return;
@ -128,11 +127,11 @@ void MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
wme.hWnd = hWnd;
wme.keyState = keyState;
bOldWarpPointer = MOUSE_Driver->pEnableWarpPointer(FALSE);
MOUSE_Driver->pEnableWarpPointer(FALSE);
/* To avoid deadlocks, we have to suspend all locks on windows structures
before the program control is passed to the mouse driver */
iWndsLocks = WIN_SuspendWndsLock();
DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme );
WIN_RestoreWndsLock(iWndsLocks);
MOUSE_Driver->pEnableWarpPointer(bOldWarpPointer);
MOUSE_Driver->pEnableWarpPointer(TRUE);
}

View File

@ -38,7 +38,7 @@ typedef struct tagMOUSE_DRIVER {
VOID (*pInit)(VOID);
VOID (*pSetCursor)(struct tagCURSORICONINFO *);
VOID (*pMoveCursor)(WORD, WORD);
BOOL (*pEnableWarpPointer)(BOOL);
LONG (*pEnableWarpPointer)(BOOL);
} MOUSE_DRIVER;
extern MOUSE_DRIVER *MOUSE_Driver;

View File

@ -217,7 +217,7 @@ extern struct tagMOUSE_DRIVER TTYDRV_MOUSE_Driver;
extern void TTYDRV_MOUSE_Init();
extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
extern BOOL TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
extern LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable);
/* TTY windows driver */

View File

@ -438,11 +438,10 @@ extern void X11DRV_MONITOR_SetScreenSaveTimeout(struct tagMONITOR *pMonitor, int
extern struct tagMOUSE_DRIVER X11DRV_MOUSE_Driver;
extern BOOL X11DRV_MOUSE_DisableWarpPointer;
extern void X11DRV_MOUSE_Init();
extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
extern BOOL X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable);
extern LONG X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable);
/* X11 windows driver */

View File

@ -23,9 +23,9 @@ void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
/***********************************************************************
* TTYDRV_MOUSE_EnableWarpPointer
*/
BOOL TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable)
LONG TTYDRV_MOUSE_EnableWarpPointer(BOOL bEnable)
{
return TRUE;
return 0;
}
/***********************************************************************

View File

@ -23,7 +23,7 @@ DEFAULT_DEBUG_CHANNEL(cursor)
Cursor X11DRV_MOUSE_XCursor = None; /* Current X cursor */
static BOOL X11DRV_MOUSE_WarpPointer = TRUE; /* hack; see DISPLAY_MoveCursor */
static LONG X11DRV_MOUSE_WarpPointer = 0; /* hack; see DISPLAY_MoveCursor */
/***********************************************************************
* X11DRV_MOUSE_DoSetCursor
@ -226,7 +226,7 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
int rootX, rootY, winX, winY;
unsigned int xstate;
if (!X11DRV_MOUSE_WarpPointer) return;
if (X11DRV_MOUSE_WarpPointer < 0) return;
if (!TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
&rootX, &rootY, &winX, &winY, &xstate ))
@ -244,13 +244,12 @@ void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
/***********************************************************************
* X11DRV_MOUSE_EnableWarpPointer
*/
BOOL X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable)
LONG X11DRV_MOUSE_EnableWarpPointer(BOOL bEnable)
{
BOOL bOldEnable = X11DRV_MOUSE_WarpPointer;
X11DRV_MOUSE_WarpPointer = bEnable;
return bOldEnable;
if (bEnable)
return InterlockedIncrement( &X11DRV_MOUSE_WarpPointer );
else
return InterlockedDecrement( &X11DRV_MOUSE_WarpPointer );
}
/***********************************************************************