Implementation of SetEventNotification for the mouse driver.

This commit is contained in:
Lionel Ulmer 1999-07-25 11:21:07 +00:00 committed by Alexandre Julliard
parent c3d30faf0c
commit 3b3dc5c8b3
1 changed files with 27 additions and 2 deletions

View File

@ -34,6 +34,7 @@
#include "message.h" #include "message.h"
#include "mouse.h" #include "mouse.h"
#include "sysmetrics.h" #include "sysmetrics.h"
#include "winbase.h"
#include "winerror.h" #include "winerror.h"
#include "winuser.h" #include "winuser.h"
@ -86,6 +87,7 @@ struct SysMouseAImpl
int queue_pos, queue_len; int queue_pos, queue_len;
int need_warp; int need_warp;
int acquired; int acquired;
HANDLE hEvent;
}; };
@ -726,12 +728,16 @@ static HRESULT WINAPI SysMouseAImpl_SetDataFormat(
/* Check if the mouse is in absolute or relative mode */ /* Check if the mouse is in absolute or relative mode */
if (df->dwFlags == DIDF_ABSAXIS) if (df->dwFlags == DIDF_ABSAXIS)
This->absolute = 1; This->absolute = 1;
else else if (df->dwFlags == DIDF_RELAXIS)
This->absolute = 0; This->absolute = 0;
else
ERR("Neither absolute nor relative flag set.");
return 0; return 0;
} }
#define GEN_EVENT(offset,data,time,seq) \ #define GEN_EVENT(offset,data,time,seq) \
{ \ { \
if (This->queue_pos < This->queue_len) { \ if (This->queue_pos < This->queue_len) { \
@ -750,6 +756,10 @@ static void WINAPI dinput_mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
DWORD posX, posY, keyState, time, extra; DWORD posX, posY, keyState, time, extra;
SysMouseAImpl* This = (SysMouseAImpl*) current_lock; SysMouseAImpl* This = (SysMouseAImpl*) current_lock;
/* Mouse moved -> send event if asked */
if (This->hEvent)
SetEvent(This->hEvent);
if ( !IsBadReadPtr( (LPVOID)dwExtraInfo, sizeof(WINE_MOUSEEVENT) ) if ( !IsBadReadPtr( (LPVOID)dwExtraInfo, sizeof(WINE_MOUSEEVENT) )
&& ((WINE_MOUSEEVENT *)dwExtraInfo)->magic == WINE_MOUSEEVENT_MAGIC ) { && ((WINE_MOUSEEVENT *)dwExtraInfo)->magic == WINE_MOUSEEVENT_MAGIC ) {
WINE_MOUSEEVENT *wme = (WINE_MOUSEEVENT *)dwExtraInfo; WINE_MOUSEEVENT *wme = (WINE_MOUSEEVENT *)dwExtraInfo;
@ -1057,6 +1067,21 @@ static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE2A iface,
return 0; return 0;
} }
/******************************************************************************
* SetEventNotification : specifies event to be sent on state change
*/
static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE2A iface,
HANDLE hnd) {
ICOM_THIS(SysMouseAImpl,iface);
TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
This->hEvent = hnd;
return DI_OK;
}
static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt = static ICOM_VTABLE(IDirectInputDevice2A) SysKeyboardAvt =
{ {
@ -1105,7 +1130,7 @@ static ICOM_VTABLE(IDirectInputDevice2A) SysMouseAvt =
SysMouseAImpl_GetDeviceState, SysMouseAImpl_GetDeviceState,
SysMouseAImpl_GetDeviceData, SysMouseAImpl_GetDeviceData,
SysMouseAImpl_SetDataFormat, SysMouseAImpl_SetDataFormat,
IDirectInputDevice2AImpl_SetEventNotification, SysMouseAImpl_SetEventNotification,
SysMouseAImpl_SetCooperativeLevel, SysMouseAImpl_SetCooperativeLevel,
IDirectInputDevice2AImpl_GetObjectInfo, IDirectInputDevice2AImpl_GetObjectInfo,
IDirectInputDevice2AImpl_GetDeviceInfo, IDirectInputDevice2AImpl_GetDeviceInfo,