Christoph Frick : dinput: Utilize IDirectInputDevice2AImpl_Acquire/
Unacquire.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Dec 11 07:45:05 CST 2006
Module: wine
Branch: master
Commit: 71f41e5d0272a435840d00c08c6252cdf5008364
URL: http://source.winehq.org/git/wine.git/?a=commit;h=71f41e5d0272a435840d00c08c6252cdf5008364
Author: Christoph Frick <frick at sc-networks.de>
Date: Mon Dec 11 10:04:49 2006 +0100
dinput: Utilize IDirectInputDevice2AImpl_Acquire/Unacquire.
---
dlls/dinput/joystick_linuxinput.c | 39 +++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 868fe89..c5a35a1 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -605,26 +605,29 @@ static HRESULT WINAPI JoystickAImpl_SetD
static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
{
JoystickImpl *This = (JoystickImpl *)iface;
+ HRESULT res;
TRACE("(this=%p)\n",This);
- if (This->joyfd!=-1)
- return S_FALSE;
+
if (This->df==NULL) {
return DIERR_INVALIDPARAM;
}
-
- if (-1==(This->joyfd=open(This->joydev->device,O_RDWR))) {
- if (-1==(This->joyfd=open(This->joydev->device,O_RDONLY))) {
- /* Couldn't open the device at all */
- perror(This->joydev->device);
- return DIERR_NOTFOUND;
- } else {
- /* Couldn't open in r/w but opened in read-only. */
- WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
+ res = IDirectInputDevice2AImpl_Acquire(iface);
+ if (res==DI_OK) {
+ if (-1==(This->joyfd=open(This->joydev->device,O_RDWR))) {
+ if (-1==(This->joyfd=open(This->joydev->device,O_RDONLY))) {
+ /* Couldn't open the device at all */
+ perror(This->joydev->device);
+ IDirectInputDevice2AImpl_Unacquire(iface);
+ return DIERR_NOTFOUND;
+ } else {
+ /* Couldn't open in r/w but opened in read-only. */
+ WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
+ }
}
}
- return 0;
+ return res;
}
/******************************************************************************
@@ -633,15 +636,15 @@ static HRESULT WINAPI JoystickAImpl_Acqu
static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
{
JoystickImpl *This = (JoystickImpl *)iface;
+ HRESULT res;
TRACE("(this=%p)\n",This);
- if (This->joyfd!=-1) {
- close(This->joyfd);
- This->joyfd = -1;
- return DI_OK;
+ res = IDirectInputDevice2AImpl_Unacquire(iface);
+ if (res==DI_OK && This->joyfd!=-1) {
+ close(This->joyfd);
+ This->joyfd = -1;
}
- else
- return DI_NOEFFECT;
+ return res;
}
/*
More information about the wine-cvs
mailing list