Vitaliy Margolen : dinput: Move SetEventNotification and associated event into base class.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 17 06:12:30 CDT 2006


Module: wine
Branch: master
Commit: af34ef12ba8a70a9b51a35cabb0f01a0e9809441
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=af34ef12ba8a70a9b51a35cabb0f01a0e9809441

Author: Vitaliy Margolen <wine-patch at kievinfo.com>
Date:   Sun Oct 15 11:29:48 2006 -0600

dinput: Move SetEventNotification and associated event into base class.

---

 dlls/dinput/device.c              |   12 +++++++++---
 dlls/dinput/device_private.h      |    1 +
 dlls/dinput/joystick_linux.c      |   18 ++----------------
 dlls/dinput/joystick_linuxinput.c |   18 ++----------------
 dlls/dinput/keyboard.c            |   17 +++--------------
 dlls/dinput/mouse.c               |   23 +++--------------------
 6 files changed, 20 insertions(+), 69 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index adb9faa..d10500b 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -475,11 +475,17 @@ HRESULT WINAPI IDirectInputDevice2AImpl_
     return DI_OK;
 }
 
+/******************************************************************************
+  *     SetEventNotification : specifies event to be sent on state change
+  */
 HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(
-	LPDIRECTINPUTDEVICE8A iface,HANDLE hnd
-) {
+	LPDIRECTINPUTDEVICE8A iface, HANDLE event)
+{
     IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
-    FIXME("(this=%p,%p): stub\n",This,hnd);
+
+    TRACE("(%p) %p\n", This, event);
+
+    This->hEvent = event;
     return DI_OK;
 }
 
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index b5c88bf..e2bc197 100644
--- a/dlls/dinput/device_private.h
+++ b/dlls/dinput/device_private.h
@@ -33,6 +33,7 @@ struct IDirectInputDevice2AImpl
     const void                 *lpVtbl;
     LONG                        ref;
     GUID                        guid;
+    HANDLE                      hEvent;
 };
 
 /* Routines to do DataFormat / WineFormat conversions */
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 885d91f..9ffab1f 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -103,7 +103,6 @@ struct JoystickImpl
 	DataFormat			*transform;	/* wine to user format converter */
 	int				*offsets;	/* object offsets */
 	ObjProps			*props;
-        HANDLE				hEvent;
         LPDIDEVICEOBJECTDATA 		data_queue;
         int				queue_head, queue_tail, queue_len;
 	BOOL				acquired;
@@ -1213,19 +1212,6 @@ static HRESULT WINAPI JoystickAImpl_SetP
     return DI_OK;
 }
 
-/******************************************************************************
-  *     SetEventNotification : specifies event to be sent on state change
-  */
-static HRESULT WINAPI JoystickAImpl_SetEventNotification(
-	LPDIRECTINPUTDEVICE8A iface, HANDLE hnd
-) {
-    JoystickImpl *This = (JoystickImpl *)iface;
-
-    TRACE("(this=%p,%p)\n",This,hnd);
-    This->hEvent = hnd;
-    return DI_OK;
-}
-
 static HRESULT WINAPI JoystickAImpl_GetCapabilities(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
@@ -1662,7 +1648,7 @@ static const IDirectInputDevice8AVtbl Jo
 	JoystickAImpl_GetDeviceState,
 	JoystickAImpl_GetDeviceData,
 	JoystickAImpl_SetDataFormat,
-	JoystickAImpl_SetEventNotification,
+	IDirectInputDevice2AImpl_SetEventNotification,
 	IDirectInputDevice2AImpl_SetCooperativeLevel,
 	JoystickAImpl_GetObjectInfo,
 	JoystickAImpl_GetDeviceInfo,
@@ -1704,7 +1690,7 @@ static const IDirectInputDevice8WVtbl Sy
 	XCAST(GetDeviceState)JoystickAImpl_GetDeviceState,
 	XCAST(GetDeviceData)JoystickAImpl_GetDeviceData,
 	XCAST(SetDataFormat)JoystickAImpl_SetDataFormat,
-	XCAST(SetEventNotification)JoystickAImpl_SetEventNotification,
+	XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
 	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
 	IDirectInputDevice2WImpl_GetObjectInfo,
 	JoystickWImpl_GetDeviceInfo,
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 335dc89..04ec9d3 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -137,7 +137,6 @@ struct JoystickImpl
 	LPDIDATAFORMAT			df;
 	DataFormat			*transform;	/* wine to user format converter */
 	int				*offsets;	/* object offsets */
-        HANDLE				hEvent;
         LPDIDEVICEOBJECTDATA 		data_queue;
         int				queue_head, queue_tail, queue_len;
 	BOOL				overflow;
@@ -1167,19 +1166,6 @@ static HRESULT WINAPI JoystickAImpl_SetP
   return 0;
 }
 
-/******************************************************************************
-  *     SetEventNotification : specifies event to be sent on state change
-  */
-static HRESULT WINAPI JoystickAImpl_SetEventNotification(
-	LPDIRECTINPUTDEVICE8A iface, HANDLE hnd
-) {
-    JoystickImpl *This = (JoystickImpl *)iface;
-
-    TRACE("(this=%p,%p)\n",This,hnd);
-    This->hEvent = hnd;
-    return DI_OK;
-}
-
 static HRESULT WINAPI JoystickAImpl_GetCapabilities(
 	LPDIRECTINPUTDEVICE8A iface,
 	LPDIDEVCAPS lpDIDevCaps)
@@ -1808,7 +1794,7 @@ static const IDirectInputDevice8AVtbl Jo
 	JoystickAImpl_GetDeviceState,
 	JoystickAImpl_GetDeviceData,
 	JoystickAImpl_SetDataFormat,
-	JoystickAImpl_SetEventNotification,
+	IDirectInputDevice2AImpl_SetEventNotification,
 	IDirectInputDevice2AImpl_SetCooperativeLevel,
 	IDirectInputDevice2AImpl_GetObjectInfo,
 	IDirectInputDevice2AImpl_GetDeviceInfo,
@@ -1850,7 +1836,7 @@ static const IDirectInputDevice8WVtbl Jo
 	XCAST(GetDeviceState)JoystickAImpl_GetDeviceState,
 	XCAST(GetDeviceData)JoystickAImpl_GetDeviceData,
 	XCAST(SetDataFormat)JoystickAImpl_SetDataFormat,
-	XCAST(SetEventNotification)JoystickAImpl_SetEventNotification,
+	XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
 	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
 	IDirectInputDevice2WImpl_GetObjectInfo,
 	IDirectInputDevice2WImpl_GetDeviceInfo,
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 8dcf063..71e2c8b 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -50,7 +50,6 @@ struct SysKeyboardImpl
 
     IDirectInputImpl*           dinput;
 
-    HANDLE                      hEvent;
     /* SysKeyboardAImpl */
     int                         acquired;
 
@@ -101,7 +100,7 @@ LRESULT CALLBACK KeyboardCallback( int c
     GEN_EVENT(dik_code, new_diks, hook->time, This->dinput->evsequence++);
     LeaveCriticalSection(&This->crit);
 
-    if (This->hEvent) SetEvent(This->hEvent);
+    if (This->base.hEvent) SetEvent(This->base.hEvent);
     
     return CallNextHookEx(0, code, wparam, lparam);
 }
@@ -531,16 +530,6 @@ static HRESULT WINAPI SysKeyboardAImpl_U
     return DI_OK;
 }
 
-static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
-							    HANDLE hnd) {
-  SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
-
-  TRACE("(this=%p,%p)\n",This,hnd);
-
-  This->hEvent = hnd;
-  return DI_OK;
-}
-
 /******************************************************************************
   *     GetCapabilities : get the device capablitites
   */
@@ -699,7 +688,7 @@ static const IDirectInputDevice8AVtbl Sy
 	SysKeyboardAImpl_GetDeviceState,
 	SysKeyboardAImpl_GetDeviceData,
 	IDirectInputDevice2AImpl_SetDataFormat,
-	SysKeyboardAImpl_SetEventNotification,
+	IDirectInputDevice2AImpl_SetEventNotification,
 	IDirectInputDevice2AImpl_SetCooperativeLevel,
 	SysKeyboardAImpl_GetObjectInfo,
 	SysKeyboardAImpl_GetDeviceInfo,
@@ -741,7 +730,7 @@ static const IDirectInputDevice8WVtbl Sy
 	XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
 	XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
 	XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
-	XCAST(SetEventNotification)SysKeyboardAImpl_SetEventNotification,
+	XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
 	XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
 	SysKeyboardWImpl_GetObjectInfo,
 	SysKeyboardWImpl_GetDeviceInfo,
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 894dcb2..a596c7f 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -136,7 +136,6 @@ struct SysMouseImpl
     WARP_STATUS		            need_warp;
     DWORD                           last_warped;
     int				    acquired;
-    HANDLE			    hEvent;
     CRITICAL_SECTION		    crit;
     
     /* This is for mouse reporting. */
@@ -538,7 +537,7 @@ static LRESULT CALLBACK dinput_mouse_hoo
 
   end:
     /* Mouse moved -> send event if asked */
-    if (This->hEvent) SetEvent(This->hEvent);
+    if (This->base.hEvent) SetEvent(This->base.hEvent);
     
     LeaveCriticalSection(&(This->crit));
     
@@ -911,22 +910,6 @@ static HRESULT WINAPI SysMouseAImpl_GetP
     return DI_OK;
 }
 
-
-
-/******************************************************************************
-  *     SetEventNotification : specifies event to be sent on state change
-  */
-static HRESULT WINAPI SysMouseAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
-							 HANDLE hnd) {
-    SysMouseImpl *This = (SysMouseImpl *)iface;
-    
-    TRACE("(this=%p,%p)\n",This,hnd);
-    
-    This->hEvent = hnd;
-    
-    return DI_OK;
-}
-
 /******************************************************************************
   *     GetCapabilities : get the device capablitites
   */
@@ -1107,7 +1090,7 @@ static const IDirectInputDevice8AVtbl Sy
     SysMouseAImpl_GetDeviceState,
     SysMouseAImpl_GetDeviceData,
     SysMouseAImpl_SetDataFormat,
-    SysMouseAImpl_SetEventNotification,
+    IDirectInputDevice2AImpl_SetEventNotification,
     SysMouseAImpl_SetCooperativeLevel,
     IDirectInputDevice2AImpl_GetObjectInfo,
     SysMouseAImpl_GetDeviceInfo,
@@ -1149,7 +1132,7 @@ static const IDirectInputDevice8WVtbl Sy
     XCAST(GetDeviceState)SysMouseAImpl_GetDeviceState,
     XCAST(GetDeviceData)SysMouseAImpl_GetDeviceData,
     XCAST(SetDataFormat)SysMouseAImpl_SetDataFormat,
-    XCAST(SetEventNotification)SysMouseAImpl_SetEventNotification,
+    XCAST(SetEventNotification)IDirectInputDevice2AImpl_SetEventNotification,
     XCAST(SetCooperativeLevel)SysMouseAImpl_SetCooperativeLevel,
     IDirectInputDevice2WImpl_GetObjectInfo,
     SysMouseWImpl_GetDeviceInfo,




More information about the wine-cvs mailing list