Added patch to reset device state in SysKeyboard*Impl_Acquire.

This commit is contained in:
Sebastian Lackner 2015-04-11 10:07:56 +02:00
parent c9ec45a0e3
commit 24af7f9090
5 changed files with 119 additions and 1 deletions

View File

@ -39,10 +39,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [2]:**
**Bug fixes and features included in the next upcoming release [3]:**
* Calculate msvcrt exponential math operations with higher precision ([Wine Bug #37149](https://bugs.winehq.org/show_bug.cgi?id=37149))
* Fix regression caused by blacklisting supported OpenGL extensions ([Wine Bug #38264](https://bugs.winehq.org/show_bug.cgi?id=38264))
* Reset device state in SysKeyboard*Impl_Acquire ([Wine Bug #11607](https://bugs.winehq.org/show_bug.cgi?id=11607))
**Bug fixes and features in Wine Staging 1.7.40 [220]:**

1
debian/changelog vendored
View File

@ -6,6 +6,7 @@ wine-staging (1.7.41) UNRELEASED; urgency=low
* Added first part of patchset containing various improvements for LsaLookupSids.
* Added patch to calculate msvcrt exponential math operations with higher precision.
* Added patch to fix regression caused by blacklisting supported OpenGL extensions.
* Added patch to reset device state in SysKeyboard*Impl_Acquire.
* Added tests for RtlIpv6AddressToString and RtlIpv6AddressToStringEx.
* Removed patches to fix invalid memory access in get_registry_locale_info (accepted upstream).
* Removed patches to avoid repeated FIXMEs in PsLookupProcessByProcessId stub (accepted upstream).

View File

@ -0,0 +1,96 @@
From f5c29408aee51ad967cf7aa02578c72d3b573198 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 11 Apr 2015 10:06:05 +0200
Subject: dinput: Reset device state in SysKeyboard*Impl_Acquire.
---
dlls/dinput/keyboard.c | 27 +++++++++++++++++++++++++--
dlls/dinput/tests/keyboard.c | 20 ++++++++++++++++++++
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index a5967d7..f3ac30e 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -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,
- IDirectInputDevice2AImpl_Acquire,
+ SysKeyboardAImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
SysKeyboardAImpl_GetDeviceState,
IDirectInputDevice2AImpl_GetDeviceData,
@@ -651,7 +674,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
IDirectInputDevice2WImpl_EnumObjects,
SysKeyboardWImpl_GetProperty,
IDirectInputDevice2WImpl_SetProperty,
- IDirectInputDevice2WImpl_Acquire,
+ SysKeyboardWImpl_Acquire,
IDirectInputDevice2WImpl_Unacquire,
SysKeyboardWImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData,
diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index ef5f06a..eaec276 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -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(4,) 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);
}
--
2.3.5

View File

@ -0,0 +1 @@
Fixes: [11607] Reset device state in SysKeyboard*Impl_Acquire

View File

@ -95,6 +95,7 @@ patch_enable_all ()
enable_ddraw_EnumSurfaces="$1"
enable_ddraw_Hotpatch="$1"
enable_ddraw_d3d_execute_buffer="$1"
enable_dinput_DeviceState="$1"
enable_dinput_Events="$1"
enable_dsound_EAX="$1"
enable_dsound_Fast_Mixer="$1"
@ -353,6 +354,9 @@ patch_enable ()
ddraw-d3d_execute_buffer)
enable_ddraw_d3d_execute_buffer="$2"
;;
dinput-DeviceState)
enable_dinput_DeviceState="$2"
;;
dinput-Events)
enable_dinput_Events="$2"
;;
@ -1847,6 +1851,21 @@ if test "$enable_ddraw_d3d_execute_buffer" -eq 1; then
) >> "$patchlist"
fi
# Patchset dinput-DeviceState
# |
# | This patchset fixes the following Wine bugs:
# | * [#11607] Reset device state in SysKeyboard*Impl_Acquire
# |
# | Modified files:
# | * dlls/dinput/keyboard.c, dlls/dinput/tests/keyboard.c
# |
if test "$enable_dinput_DeviceState" -eq 1; then
patch_apply dinput-DeviceState/0001-dinput-Reset-device-state-in-SysKeyboard-Impl_Acquir.patch
(
echo '+ { "Sebastian Lackner", "dinput: Reset device state in SysKeyboard*Impl_Acquire.", 1 },';
) >> "$patchlist"
fi
# Patchset dinput-Events
# |
# | This patchset fixes the following Wine bugs: