Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
41ce4a01
Commit
41ce4a01
authored
Jul 15, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jul 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Use CALLWINDPROC hook to monitor focus loses away from acquired windows.
parent
233cd46a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
dinput_main.c
dlls/dinput/dinput_main.c
+58
-0
mouse.c
dlls/dinput/tests/mouse.c
+0
-1
No files found.
dlls/dinput/dinput_main.c
View file @
41ce4a01
...
...
@@ -848,6 +848,41 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
}
static
LRESULT
CALLBACK
callwndproc_proc
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
)
{
CWPSTRUCT
*
msg
=
(
CWPSTRUCT
*
)
lparam
;
IDirectInputImpl
*
dinput
;
HWND
foreground
;
if
(
code
!=
HC_ACTION
||
msg
->
message
!=
WM_KILLFOCUS
)
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
foreground
=
GetForegroundWindow
();
EnterCriticalSection
(
&
dinput_hook_crit
);
LIST_FOR_EACH_ENTRY
(
dinput
,
&
direct_input_list
,
IDirectInputImpl
,
entry
)
{
IDirectInputDevice2AImpl
*
dev
;
EnterCriticalSection
(
&
dinput
->
crit
);
LIST_FOR_EACH_ENTRY
(
dev
,
&
dinput
->
devices_list
,
IDirectInputDevice2AImpl
,
entry
)
{
if
(
!
dev
->
acquired
)
continue
;
if
(
msg
->
hwnd
==
dev
->
win
&&
msg
->
hwnd
!=
foreground
)
{
TRACE
(
"%p window is not foreground - unacquiring %p
\n
"
,
dev
->
win
,
dev
);
IDirectInputDevice_Unacquire
(
(
LPDIRECTINPUTDEVICE8A
)
dev
);
}
}
LeaveCriticalSection
(
&
dinput
->
crit
);
}
LeaveCriticalSection
(
&
dinput_hook_crit
);
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
}
static
DWORD
WINAPI
hook_thread_proc
(
void
*
param
)
{
static
HHOOK
kbd_hook
,
mouse_hook
;
...
...
@@ -976,7 +1011,30 @@ static BOOL check_hook_thread(void)
void
check_dinput_hooks
(
LPDIRECTINPUTDEVICE8A
iface
)
{
static
HHOOK
callwndproc_hook
;
static
ULONG
foreground_cnt
;
IDirectInputDevice2AImpl
*
dev
=
(
IDirectInputDevice2AImpl
*
)
iface
;
EnterCriticalSection
(
&
dinput_hook_crit
);
if
(
dev
->
dwCoopLevel
&
DISCL_FOREGROUND
)
{
if
(
dev
->
acquired
)
foreground_cnt
++
;
else
foreground_cnt
--
;
}
if
(
foreground_cnt
&&
!
callwndproc_hook
)
callwndproc_hook
=
SetWindowsHookExW
(
WH_CALLWNDPROC
,
callwndproc_proc
,
DINPUT_instance
,
GetCurrentThreadId
()
);
else
if
(
!
foreground_cnt
&&
callwndproc_hook
)
{
UnhookWindowsHookEx
(
callwndproc_hook
);
callwndproc_hook
=
NULL
;
}
PostThreadMessageW
(
hook_thread_id
,
WM_USER
+
0x10
,
1
,
0
);
LeaveCriticalSection
(
&
dinput_hook_crit
);
}
dlls/dinput/tests/mouse.c
View file @
41ce4a01
...
...
@@ -95,7 +95,6 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
SetActiveWindow
(
0
);
hr
=
IDirectInputDevice_GetDeviceState
(
pMouse
,
sizeof
(
m_state
),
&
m_state
);
todo_wine
ok
(
hr
==
DIERR_NOTACQUIRED
,
"GetDeviceState() should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
/* Workaround so we can test other things. Remove when Wine is fixed */
IDirectInputDevice_Unacquire
(
pMouse
);
...
...
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