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
13421a21
Commit
13421a21
authored
Jul 08, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Jul 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Made EnumDevicesBySemantics more terse.
parent
a85f66e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
46 deletions
+33
-46
dinput_main.c
dlls/dinput/dinput_main.c
+33
-46
No files found.
dlls/dinput/dinput_main.c
View file @
13421a21
...
@@ -842,12 +842,13 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
...
@@ -842,12 +842,13 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
LPVOID
pvRef
,
DWORD
dwFlags
LPVOID
pvRef
,
DWORD
dwFlags
)
)
{
{
static
const
REFGUID
guids
[
2
]
=
{
&
GUID_SysKeyboard
,
&
GUID_SysMouse
};
static
const
DWORD
actionMasks
[]
=
{
DIKEYBOARD_MASK
,
DIMOUSE_MASK
};
IDirectInputImpl
*
This
=
impl_from_IDirectInput8A
(
iface
);
IDirectInputImpl
*
This
=
impl_from_IDirectInput8A
(
iface
);
DIDEVICEINSTANCEA
didevi
;
DIDEVICEINSTANCEA
didevi
;
LPDIRECTINPUTDEVICE8A
lpdid
;
LPDIRECTINPUTDEVICE8A
lpdid
;
BOOL
ret
;
int
i
,
j
;
DWORD
callbackFlags
=
0
;
int
i
;
FIXME
(
"(this=%p,%s,%p,%p,%p,%04x): semi-stub
\n
"
,
This
,
ptszUserName
,
lpdiActionFormat
,
FIXME
(
"(this=%p,%s,%p,%p,%p,%04x): semi-stub
\n
"
,
This
,
ptszUserName
,
lpdiActionFormat
,
lpCallback
,
pvRef
,
dwFlags
);
lpCallback
,
pvRef
,
dwFlags
);
...
@@ -864,29 +865,22 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
...
@@ -864,29 +865,22 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
didevi
.
dwSize
=
sizeof
(
didevi
);
didevi
.
dwSize
=
sizeof
(
didevi
);
/* enum the keyboard first */
/* Enumerate keyboard and mouse */
IDirectInput_CreateDevice
(
iface
,
&
GUID_SysKeyboard
,
&
lpdid
,
NULL
);
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
{
/* if there's any DIKEYBOARD action, keyboard is priority 1*/
DWORD
callbackFlags
=
0
;
for
(
i
=
0
;
i
<
lpdiActionFormat
->
dwActionSize
;
i
++
)
if
((
lpdiActionFormat
->
rgoAction
[
i
].
dwSemantic
&
DIKEYBOARD_MASK
)
==
DIKEYBOARD_MASK
)
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
ret
=
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
1
,
pvRef
);
if
(
ret
==
DIENUM_STOP
)
return
DI_OK
;
callbackFlags
=
0
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
/* and then the mouse */
/* If there's at least one action for the device it's priority 1 */
IDirectInput_CreateDevice
(
iface
,
&
GUID_SysMouse
,
&
lpdid
,
NULL
);
for
(
j
=
0
;
j
<
lpdiActionFormat
->
dwActionSize
;
j
++
)
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
if
((
lpdiActionFormat
->
rgoAction
[
j
].
dwSemantic
&
actionMasks
[
j
])
==
actionMasks
[
j
])
/* same as above, but for the mouse */
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
for
(
i
=
0
;
i
<
lpdiActionFormat
->
dwActionSize
;
i
++
)
if
((
lpdiActionFormat
->
rgoAction
[
i
].
dwSemantic
&
DIMOUSE_MASK
)
==
DIMOUSE_MASK
)
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
0
,
pvRef
);
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
sizeof
(
guids
)
/
sizeof
(
guids
[
0
])
-
(
i
+
1
),
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
return
DI_OK
;
return
DI_OK
;
}
}
...
@@ -897,41 +891,34 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
...
@@ -897,41 +891,34 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
LPVOID
pvRef
,
DWORD
dwFlags
LPVOID
pvRef
,
DWORD
dwFlags
)
)
{
{
static
const
REFGUID
guids
[
2
]
=
{
&
GUID_SysKeyboard
,
&
GUID_SysMouse
};
static
const
DWORD
actionMasks
[]
=
{
DIKEYBOARD_MASK
,
DIMOUSE_MASK
};
IDirectInputImpl
*
This
=
impl_from_IDirectInput8W
(
iface
);
IDirectInputImpl
*
This
=
impl_from_IDirectInput8W
(
iface
);
DIDEVICEINSTANCEW
didevi
;
DIDEVICEINSTANCEW
didevi
;
LPDIRECTINPUTDEVICE8W
lpdid
;
LPDIRECTINPUTDEVICE8W
lpdid
;
BOOL
ret
;
int
i
,
j
;
DWORD
callbackFlags
=
0
;
int
i
;
FIXME
(
"(this=%p,%s,%p,%p,%p,%04x): semi-stub
\n
"
,
This
,
debugstr_w
(
ptszUserName
),
lpdiActionFormat
,
FIXME
(
"(this=%p,%s,%p,%p,%p,%04x): semi-stub
\n
"
,
This
,
debugstr_w
(
ptszUserName
),
lpdiActionFormat
,
lpCallback
,
pvRef
,
dwFlags
);
lpCallback
,
pvRef
,
dwFlags
);
didevi
.
dwSize
=
sizeof
(
didevi
);
didevi
.
dwSize
=
sizeof
(
didevi
);
/* enum the keyboard first */
/* Enumerate keyboard and mouse */
IDirectInput_CreateDevice
(
iface
,
&
GUID_SysKeyboard
,
&
lpdid
,
NULL
);
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]);
i
++
)
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
{
/* if there's any DIKEYBOARD action, keyboard is priority 1*/
DWORD
callbackFlags
=
0
;
for
(
i
=
0
;
i
<
lpdiActionFormat
->
dwActionSize
;
i
++
)
if
((
lpdiActionFormat
->
rgoAction
[
i
].
dwSemantic
&
DIKEYBOARD_MASK
)
==
DIKEYBOARD_MASK
)
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
ret
=
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
1
,
pvRef
);
if
(
ret
==
DIENUM_STOP
)
return
DI_OK
;
callbackFlags
=
0
;
IDirectInput_CreateDevice
(
iface
,
guids
[
i
],
&
lpdid
,
NULL
);
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
/* and then the mouse */
/* If there's at least one action for the device it's priority 1 */
IDirectInput_CreateDevice
(
iface
,
&
GUID_SysMouse
,
&
lpdid
,
NULL
);
for
(
j
=
0
;
j
<
lpdiActionFormat
->
dwActionSize
;
j
++
)
IDirectInputDevice_GetDeviceInfo
(
lpdid
,
&
didevi
);
if
((
lpdiActionFormat
->
rgoAction
[
j
].
dwSemantic
&
actionMasks
[
j
])
==
actionMasks
[
j
])
/* same as above, but for the mouse */
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
for
(
i
=
0
;
i
<
lpdiActionFormat
->
dwActionSize
;
i
++
)
if
((
lpdiActionFormat
->
rgoAction
[
i
].
dwSemantic
&
DIMOUSE_MASK
)
==
DIMOUSE_MASK
)
callbackFlags
|=
DIEDBS_MAPPEDPRI1
;
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
0
,
pvRef
);
if
(
lpCallback
(
&
didevi
,
lpdid
,
callbackFlags
,
sizeof
(
guids
)
/
sizeof
(
guids
[
0
])
-
(
i
+
1
),
pvRef
)
==
DIENUM_STOP
)
return
DI_OK
;
}
return
DI_OK
;
return
DI_OK
;
}
}
...
...
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