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
0d91274d
Commit
0d91274d
authored
Apr 11, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
May 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Reset device state in SysKeyboard*Impl_Acquire.
parent
4439cd43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
keyboard.c
dlls/dinput/keyboard.c
+25
-2
keyboard.c
dlls/dinput/tests/keyboard.c
+20
-0
No files found.
dlls/dinput/keyboard.c
View file @
0d91274d
...
...
@@ -527,6 +527,29 @@ static HRESULT WINAPI SysKeyboardAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
return
SysKeyboardWImpl_GetProperty
(
IDirectInputDevice8W_from_impl
(
This
),
rguid
,
pdiph
);
}
static
HRESULT
WINAPI
SysKeyboardWImpl_Acquire
(
LPDIRECTINPUTDEVICE8W
iface
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
HRESULT
res
;
TRACE
(
"(%p)
\n
"
,
This
);
res
=
IDirectInputDevice2WImpl_Acquire
(
iface
);
if
(
res
==
DI_OK
)
{
TRACE
(
"clearing keystate
\n
"
);
memset
(
This
->
DInputKeyState
,
0
,
sizeof
(
This
->
DInputKeyState
));
}
return
res
;
}
static
HRESULT
WINAPI
SysKeyboardAImpl_Acquire
(
LPDIRECTINPUTDEVICE8A
iface
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
return
SysKeyboardWImpl_Acquire
(
IDirectInputDevice8W_from_impl
(
This
));
}
static
HRESULT
WINAPI
SysKeyboardWImpl_BuildActionMap
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIACTIONFORMATW
lpdiaf
,
LPCWSTR
lpszUserName
,
...
...
@@ -615,7 +638,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_EnumObjects
,
SysKeyboardAImpl_GetProperty
,
IDirectInputDevice2AImpl_SetProperty
,
IDirectInputDevice2
AImpl_Acquire
,
SysKeyboard
AImpl_Acquire
,
IDirectInputDevice2AImpl_Unacquire
,
SysKeyboardAImpl_GetDeviceState
,
IDirectInputDevice2AImpl_GetDeviceData
,
...
...
@@ -651,7 +674,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
IDirectInputDevice2WImpl_EnumObjects
,
SysKeyboardWImpl_GetProperty
,
IDirectInputDevice2WImpl_SetProperty
,
IDirectInputDevice2
WImpl_Acquire
,
SysKeyboard
WImpl_Acquire
,
IDirectInputDevice2WImpl_Unacquire
,
SysKeyboardWImpl_GetDeviceState
,
IDirectInputDevice2WImpl_GetDeviceData
,
...
...
dlls/dinput/tests/keyboard.c
View file @
0d91274d
...
...
@@ -91,6 +91,26 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
for
(
i
=
0
;
i
<
sizeof
(
custom_state
)
/
sizeof
(
custom_state
[
0
]);
i
++
)
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
/* simulate some keyboard input */
SetFocus
(
hwnd
);
keybd_event
(
'Q'
,
0
,
0
,
0
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %08x
\n
"
,
hr
);
if
(
!
custom_state
[
0
])
win_skip
(
"Keyboard event not processed, skipping test
\n
"
);
else
{
/* unacquiring should reset the device state */
hr
=
IDirectInputDevice_Unacquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Unacquire() failed: %08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState failed: %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
custom_state
)
/
sizeof
(
custom_state
[
0
]);
i
++
)
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
}
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
}
...
...
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