|
From: Andreas R. <and...@us...> - 2003-04-26 17:41:54
|
Update of /cvsroot/squeak/squeak/platforms/win32/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv29754
Modified Files:
sqWin32DirectInput.c
Log Message:
fixed crash
Index: sqWin32DirectInput.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/win32/vm/sqWin32DirectInput.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sqWin32DirectInput.c 8 Apr 2003 20:59:48 -0000 1.1
--- sqWin32DirectInput.c 26 Apr 2003 17:41:50 -0000 1.2
***************
*** 41,52 ****
static int yData[BUFFER_SIZE];
static int stampData[BUFFER_SIZE];
IDirectInput *lpDI = NULL;
IDirectInputDevice *lpDev = NULL;
- HANDLE hMouseEvent = NULL;
#define ERROR_CHECK(hResult, errMsg) \
if(FAILED(hResult)) { \
! printf("%s (%s, %s)\n", errMsg, __FILE__, __LINE__); \
return hResult; \
}
--- 41,52 ----
static int yData[BUFFER_SIZE];
static int stampData[BUFFER_SIZE];
+ static int printDebugMessages = 0;
IDirectInput *lpDI = NULL;
IDirectInputDevice *lpDev = NULL;
#define ERROR_CHECK(hResult, errMsg) \
if(FAILED(hResult)) { \
! if(printDebugMessages) printf("%s (%s, %d)\n", errMsg, __FILE__, __LINE__); \
return hResult; \
}
***************
*** 74,89 ****
DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND);
! ERROR_CHECK(hr, "Error setting cooperative mode");
!
! /* create the event to signal */
! hMouseEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
! if(!hMouseEvent) {
! ERROR_CHECK(E_FAIL, "Error creating mouse event");
! }
- /* install it */
- hr = lpDev->lpVtbl->SetEventNotification(lpDev, hMouseEvent );
- ERROR_CHECK(hr, "Error setting event notification");
-
/* setup buffer size */
propWord.diph.dwSize = sizeof(DIPROPDWORD);
--- 74,79 ----
DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND);
! ERROR_CHECK(hr, "Error setting cooperative level");
/* setup buffer size */
propWord.diph.dwSize = sizeof(DIPROPDWORD);
***************
*** 112,119 ****
lpDI->lpVtbl->Release(lpDI);
lpDI = NULL;
- }
- if(hMouseEvent != NULL) {
- CloseHandle( hMouseEvent );
- hMouseEvent = NULL;
}
return S_OK;
--- 102,105 ----
|