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
6e0dd0d8
Commit
6e0dd0d8
authored
Feb 11, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Merge mouse and rawmouse acquired lists.
parent
5c16cda6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
dinput_main.c
dlls/dinput/dinput_main.c
+23
-22
No files found.
dlls/dinput/dinput_main.c
View file @
6e0dd0d8
...
...
@@ -89,7 +89,6 @@ static CRITICAL_SECTION_DEBUG dinput_critsect_debug =
static
CRITICAL_SECTION
dinput_hook_crit
=
{
&
dinput_critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
list
acquired_mouse_list
=
LIST_INIT
(
acquired_mouse_list
);
static
struct
list
acquired_rawmouse_list
=
LIST_INIT
(
acquired_rawmouse_list
);
static
struct
list
acquired_keyboard_list
=
LIST_INIT
(
acquired_keyboard_list
);
static
struct
list
acquired_device_list
=
LIST_INIT
(
acquired_device_list
);
...
...
@@ -99,7 +98,7 @@ void dinput_hooks_acquire_device( IDirectInputDevice8W *iface )
EnterCriticalSection
(
&
dinput_hook_crit
);
if
(
IsEqualGUID
(
&
impl
->
guid
,
&
GUID_SysMouse
))
list_add_tail
(
impl
->
use_raw_input
?
&
acquired_rawmouse_list
:
&
acquired_mouse_list
,
&
impl
->
entry
);
list_add_tail
(
&
acquired_mouse_list
,
&
impl
->
entry
);
else
if
(
IsEqualGUID
(
&
impl
->
guid
,
&
GUID_SysKeyboard
))
list_add_tail
(
&
acquired_keyboard_list
,
&
impl
->
entry
);
else
...
...
@@ -184,12 +183,6 @@ static void dinput_unacquire_window_devices( HWND window )
TRACE
(
"%p window is not foreground - unacquiring %p
\n
"
,
impl
->
win
,
impl
);
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
}
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_rawmouse_list
,
struct
dinput_device
,
entry
)
{
if
(
window
!=
impl
->
win
)
continue
;
TRACE
(
"%p window is not foreground - unacquiring %p
\n
"
,
impl
->
win
,
impl
);
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
}
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_keyboard_list
,
struct
dinput_device
,
entry
)
{
if
(
window
!=
impl
->
win
)
continue
;
...
...
@@ -210,8 +203,6 @@ static void dinput_unacquire_devices(void)
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_mouse_list
,
struct
dinput_device
,
entry
)
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_rawmouse_list
,
struct
dinput_device
,
entry
)
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_keyboard_list
,
struct
dinput_device
,
entry
)
dinput_device_internal_unacquire
(
&
impl
->
IDirectInputDevice8W_iface
,
STATUS_UNACQUIRED
);
...
...
@@ -233,7 +224,7 @@ static LRESULT CALLBACK cbt_hook_proc( int code, WPARAM wparam, LPARAM lparam )
static
void
input_thread_update_device_list
(
struct
input_thread_state
*
state
)
{
RAWINPUTDEVICE
rawinput_mouse
=
{.
usUsagePage
=
HID_USAGE_PAGE_GENERIC
,
.
usUsage
=
HID_USAGE_GENERIC_MOUSE
,
.
dwFlags
=
RIDEV_REMOVE
};
UINT
count
=
0
,
keyboard_count
=
0
,
mouse_count
=
0
,
foreground_count
=
0
;
UINT
count
=
0
,
keyboard_count
=
0
,
mouse_
ll_
count
=
0
,
foreground_count
=
0
;
struct
dinput_device
*
device
;
EnterCriticalSection
(
&
dinput_hook_crit
);
...
...
@@ -247,19 +238,29 @@ static void input_thread_update_device_list( struct input_thread_state *state )
}
state
->
events_count
=
count
;
LIST_FOR_EACH_ENTRY
(
device
,
&
acquired_
raw
mouse_list
,
struct
dinput_device
,
entry
)
LIST_FOR_EACH_ENTRY
(
device
,
&
acquired_mouse_list
,
struct
dinput_device
,
entry
)
{
RAWINPUTDEVICE
*
rawinput_device
=
NULL
;
if
(
device
->
dwCoopLevel
&
DISCL_FOREGROUND
)
foreground_count
++
;
if
(
device
->
dwCoopLevel
&
DISCL_BACKGROUND
)
rawinput_mouse
.
dwFlags
|=
RIDEV_INPUTSINK
;
if
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
)
rawinput_mouse
.
dwFlags
|=
RIDEV_NOLEGACY
|
RIDEV_CAPTUREMOUSE
;
rawinput_mouse
.
dwFlags
&=
~
RIDEV_REMOVE
;
rawinput_mouse
.
hwndTarget
=
di_em_win
;
if
(
count
<
INPUT_THREAD_MAX_DEVICES
)
dinput_device_internal_addref
(
(
state
->
devices
[
count
++
]
=
device
)
);
switch
(
GET_DIDEVICE_TYPE
(
device
->
instance
.
dwDevType
))
{
case
DIDEVTYPE_MOUSE
:
case
DI8DEVTYPE_MOUSE
:
if
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
)
rawinput_mouse
.
dwFlags
|=
RIDEV_CAPTUREMOUSE
;
if
(
!
device
->
use_raw_input
)
mouse_ll_count
++
;
else
rawinput_device
=
&
rawinput_mouse
;
break
;
}
LIST_FOR_EACH_ENTRY
(
device
,
&
acquired_mouse_list
,
struct
dinput_device
,
entry
)
if
(
rawinput_device
)
{
if
(
device
->
dwCoopLevel
&
DISCL_FOREGROUND
)
foreground_count
++
;
mouse_count
++
;
if
(
device
->
dwCoopLevel
&
DISCL_BACKGROUND
)
rawinput_device
->
dwFlags
|=
RIDEV_INPUTSINK
;
if
(
device
->
dwCoopLevel
&
DISCL_EXCLUSIVE
)
rawinput_device
->
dwFlags
|=
RIDEV_NOLEGACY
;
rawinput_device
->
dwFlags
&=
~
RIDEV_REMOVE
;
rawinput_device
->
hwndTarget
=
di_em_win
;
}
if
(
count
<
INPUT_THREAD_MAX_DEVICES
)
dinput_device_internal_addref
(
(
state
->
devices
[
count
++
]
=
device
)
);
}
LIST_FOR_EACH_ENTRY
(
device
,
&
acquired_keyboard_list
,
struct
dinput_device
,
entry
)
...
...
@@ -287,9 +288,9 @@ static void input_thread_update_device_list( struct input_thread_state *state )
state
->
keyboard_ll_hook
=
NULL
;
}
if
(
mouse_count
&&
!
state
->
mouse_ll_hook
)
if
(
mouse_
ll_
count
&&
!
state
->
mouse_ll_hook
)
state
->
mouse_ll_hook
=
SetWindowsHookExW
(
WH_MOUSE_LL
,
input_thread_ll_hook_proc
,
DINPUT_instance
,
0
);
else
if
(
!
mouse_count
&&
state
->
mouse_ll_hook
)
else
if
(
!
mouse_
ll_
count
&&
state
->
mouse_ll_hook
)
{
UnhookWindowsHookEx
(
state
->
mouse_ll_hook
);
state
->
mouse_ll_hook
=
NULL
;
...
...
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