Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3039fd6d
Commit
3039fd6d
authored
Jan 24, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Use an enumeration instead of BOOL for acquired status.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fd46a5aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
device.c
dlls/dinput/device.c
+13
-13
device_private.h
dlls/dinput/device_private.h
+7
-1
dinput_main.c
dlls/dinput/dinput_main.c
+2
-2
joystick_hid.c
dlls/dinput/joystick_hid.c
+1
-1
No files found.
dlls/dinput/device.c
View file @
3039fd6d
...
...
@@ -84,7 +84,7 @@ static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT
static
inline
BOOL
is_exclusively_acquired
(
struct
dinput_device
*
device
)
{
return
device
->
acquired
&&
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
);
return
device
->
status
==
STATUS_ACQUIRED
&&
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
);
}
/******************************************************************************
...
...
@@ -582,7 +582,7 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
crit
);
if
(
impl
->
acquired
)
if
(
impl
->
status
==
STATUS_ACQUIRED
)
hr
=
DI_NOEFFECT
;
else
if
(
!
impl
->
user_format
)
hr
=
DIERR_INVALIDPARAM
;
...
...
@@ -590,8 +590,8 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface )
hr
=
DIERR_OTHERAPPHASPRIO
;
else
{
impl
->
acquired
=
TRUE
;
if
(
FAILED
(
hr
=
impl
->
vtbl
->
acquire
(
iface
)))
impl
->
acquired
=
FALSE
;
impl
->
status
=
STATUS_ACQUIRED
;
if
(
FAILED
(
hr
=
impl
->
vtbl
->
acquire
(
iface
)))
impl
->
status
=
STATUS_UNACQUIRED
;
}
LeaveCriticalSection
(
&
impl
->
crit
);
if
(
hr
!=
DI_OK
)
return
hr
;
...
...
@@ -614,9 +614,9 @@ static HRESULT WINAPI dinput_device_Unacquire( IDirectInputDevice8W *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
impl
->
acquired
)
hr
=
DI_NOEFFECT
;
if
(
impl
->
status
!=
STATUS_ACQUIRED
)
hr
=
DI_NOEFFECT
;
else
hr
=
impl
->
vtbl
->
unacquire
(
iface
);
impl
->
acquired
=
FALSE
;
impl
->
status
=
STATUS_UNACQUIRED
;
LeaveCriticalSection
(
&
impl
->
crit
);
if
(
hr
!=
DI_OK
)
return
hr
;
...
...
@@ -647,7 +647,7 @@ static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface,
if
(
format
->
dwSize
!=
sizeof
(
DIDATAFORMAT
))
return
DIERR_INVALIDPARAM
;
if
(
format
->
dwObjSize
!=
sizeof
(
DIOBJECTDATAFORMAT
))
return
DIERR_INVALIDPARAM
;
if
(
This
->
acquired
)
return
DIERR_ACQUIRED
;
if
(
This
->
status
==
STATUS_ACQUIRED
)
return
DIERR_ACQUIRED
;
EnterCriticalSection
(
&
This
->
crit
);
...
...
@@ -696,7 +696,7 @@ static HRESULT WINAPI dinput_device_SetCooperativeLevel( IDirectInputDevice8W *i
/* Store the window which asks for the mouse */
EnterCriticalSection
(
&
This
->
crit
);
if
(
This
->
acquired
)
hr
=
DIERR_ACQUIRED
;
if
(
This
->
status
==
STATUS_ACQUIRED
)
hr
=
DIERR_ACQUIRED
;
else
{
This
->
win
=
hwnd
;
...
...
@@ -1014,7 +1014,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
case
(
DWORD_PTR
)
DIPROP_BUFFERSIZE
:
case
(
DWORD_PTR
)
DIPROP_PHYSICALRANGE
:
case
(
DWORD_PTR
)
DIPROP_LOGICALRANGE
:
if
(
impl
->
acquired
)
return
DIERR_ACQUIRED
;
if
(
impl
->
status
==
STATUS_ACQUIRED
)
return
DIERR_ACQUIRED
;
break
;
case
(
DWORD_PTR
)
DIPROP_FFLOAD
:
case
(
DWORD_PTR
)
DIPROP_GRANULARITY
:
...
...
@@ -1553,7 +1553,7 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface,
IDirectInputDevice2_Poll
(
iface
);
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
impl
->
acquired
)
if
(
impl
->
status
!=
STATUS_ACQUIRED
)
hr
=
DIERR_NOTACQUIRED
;
else
if
(
!
(
user_format
=
impl
->
user_format
))
hr
=
DIERR_INVALIDPARAM
;
...
...
@@ -1605,7 +1605,7 @@ static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface,
if
(
This
->
dinput
->
dwVersion
==
0x0800
||
size
==
sizeof
(
DIDEVICEOBJECTDATA_DX3
))
{
if
(
!
This
->
queue_len
)
return
DIERR_NOTBUFFERED
;
if
(
!
This
->
acquired
)
return
DIERR_NOTACQUIRED
;
if
(
This
->
status
!=
STATUS_ACQUIRED
)
return
DIERR_NOTACQUIRED
;
}
if
(
!
This
->
queue_len
)
...
...
@@ -1857,7 +1857,7 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface )
HRESULT
hr
=
DI_NOEFFECT
;
EnterCriticalSection
(
&
impl
->
crit
);
if
(
!
impl
->
acquired
)
hr
=
DIERR_NOTACQUIRED
;
if
(
impl
->
status
!=
STATUS_ACQUIRED
)
hr
=
DIERR_NOTACQUIRED
;
LeaveCriticalSection
(
&
impl
->
crit
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -2012,7 +2012,7 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
break
;
}
if
(
impl
->
acquired
)
return
DIERR_ACQUIRED
;
if
(
impl
->
status
==
STATUS_ACQUIRED
)
return
DIERR_ACQUIRED
;
data_format
.
dwSize
=
sizeof
(
data_format
);
data_format
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
...
...
dlls/dinput/device_private.h
View file @
3039fd6d
...
...
@@ -69,6 +69,12 @@ struct object_properties
DWORD
calibration_mode
;
};
enum
device_status
{
STATUS_UNACQUIRED
,
STATUS_ACQUIRED
,
};
/* Device implementation */
struct
dinput_device
{
...
...
@@ -84,7 +90,7 @@ struct dinput_device
DIDEVCAPS
caps
;
DWORD
dwCoopLevel
;
HWND
win
;
int
acquired
;
enum
device_status
status
;
BOOL
use_raw_input
;
/* use raw input instead of low-level messages */
RAWINPUTDEVICE
raw_device
;
/* raw device to (un)register */
...
...
dlls/dinput/dinput_main.c
View file @
3039fd6d
...
...
@@ -128,10 +128,10 @@ static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface )
TRACE
(
"iface %p.
\n
"
,
iface
);
EnterCriticalSection
(
&
impl
->
crit
);
if
(
impl
->
acquired
)
if
(
impl
->
status
==
STATUS_ACQUIRED
)
{
impl
->
vtbl
->
unacquire
(
iface
);
impl
->
acquired
=
FALSE
;
impl
->
status
=
STATUS_UNACQUIRED
;
list_remove
(
&
impl
->
entry
);
}
LeaveCriticalSection
(
&
impl
->
crit
);
...
...
dlls/dinput/joystick_hid.c
View file @
3039fd6d
...
...
@@ -243,7 +243,7 @@ static inline struct hid_joystick_effect *impl_from_IDirectInputEffect( IDirectI
static
inline
BOOL
is_exclusively_acquired
(
struct
hid_joystick
*
joystick
)
{
return
joystick
->
base
.
acquired
&&
(
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
);
return
joystick
->
base
.
status
==
STATUS_ACQUIRED
&&
(
joystick
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
);
}
static
const
GUID
*
object_usage_to_guid
(
USAGE
usage_page
,
USAGE
usage
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment