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
bed2b9c3
Commit
bed2b9c3
authored
Feb 11, 2003
by
Ove Kaaven
Committed by
Alexandre Julliard
Feb 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only install the keyboard hook on device creation.
parent
fa05849e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
dinput_main.c
dlls/dinput/dinput_main.c
+0
-2
dinput_private.h
dlls/dinput/dinput_private.h
+0
-4
main.c
dlls/dinput/keyboard/main.c
+34
-2
No files found.
dlls/dinput/dinput_main.c
View file @
bed2b9c3
...
...
@@ -58,10 +58,8 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserv)
{
case
DLL_PROCESS_ATTACH
:
DINPUT_instance
=
inst
;
keyboard_hook
=
SetWindowsHookExW
(
WH_KEYBOARD_LL
,
KeyboardCallback
,
inst
,
0
);
break
;
case
DLL_PROCESS_DETACH
:
UnhookWindowsHookEx
(
keyboard_hook
);
break
;
}
return
TRUE
;
...
...
dlls/dinput/dinput_private.h
View file @
bed2b9c3
...
...
@@ -42,10 +42,6 @@ typedef struct dinput_device {
extern
void
dinput_register_device
(
dinput_device
*
device
)
;
HHOOK
keyboard_hook
;
LRESULT
CALLBACK
KeyboardCallback
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
);
extern
HINSTANCE
DINPUT_instance
;
#endif
/* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */
dlls/dinput/keyboard/main.c
View file @
bed2b9c3
...
...
@@ -70,7 +70,9 @@ but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
static
BYTE
DInputKeyState
[
256
];
/* array for 'GetDeviceState' */
HHOOK
keyboard_hook
;
static
CRITICAL_SECTION
keyboard_crit
=
CRITICAL_SECTION_INIT
(
"dinput_keyboard"
);
static
DWORD
keyboard_users
;
static
HHOOK
keyboard_hook
;
LRESULT
CALLBACK
KeyboardCallback
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
)
{
...
...
@@ -162,6 +164,11 @@ static SysKeyboardAImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputAIm
memcpy
(
&
(
newDevice
->
guid
),
rguid
,
sizeof
(
*
rguid
));
newDevice
->
dinput
=
dinput
;
EnterCriticalSection
(
&
keyboard_crit
);
if
(
!
keyboard_users
++
)
keyboard_hook
=
SetWindowsHookExW
(
WH_KEYBOARD_LL
,
KeyboardCallback
,
DINPUT_instance
,
0
);
LeaveCriticalSection
(
&
keyboard_crit
);
return
newDevice
;
}
...
...
@@ -193,6 +200,31 @@ static dinput_device keyboarddev = {
DECL_GLOBAL_CONSTRUCTOR
(
keyboarddev_register
)
{
dinput_register_device
(
&
keyboarddev
);
}
static
ULONG
WINAPI
SysKeyboardAImpl_Release
(
LPDIRECTINPUTDEVICE8A
iface
)
{
ICOM_THIS
(
SysKeyboardAImpl
,
iface
);
This
->
ref
--
;
if
(
This
->
ref
)
return
This
->
ref
;
EnterCriticalSection
(
&
keyboard_crit
);
if
(
!--
keyboard_users
)
{
UnhookWindowsHookEx
(
keyboard_hook
);
keyboard_hook
=
0
;
}
LeaveCriticalSection
(
&
keyboard_crit
);
/* Free the data queue */
if
(
This
->
buffer
!=
NULL
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
buffer
);
DeleteCriticalSection
(
&
(
This
->
crit
));
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
static
HRESULT
WINAPI
SysKeyboardAImpl_SetProperty
(
LPDIRECTINPUTDEVICE8A
iface
,
REFGUID
rguid
,
LPCDIPROPHEADER
ph
)
...
...
@@ -400,7 +432,7 @@ static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt =
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirectInputDevice2AImpl_QueryInterface
,
IDirectInputDevice2AImpl_AddRef
,
IDirectInputDevice2
AImpl_Release
,
SysKeyboard
AImpl_Release
,
SysKeyboardAImpl_GetCapabilities
,
IDirectInputDevice2AImpl_EnumObjects
,
IDirectInputDevice2AImpl_GetProperty
,
...
...
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