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
f83b53c1
Commit
f83b53c1
authored
Jun 03, 2007
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jun 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Acquire device only if specified window has focus in foreground coop level.
parent
6a8bf96d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
device.c
dlls/dinput/device.c
+2
-0
mouse.c
dlls/dinput/tests/mouse.c
+21
-0
No files found.
dlls/dinput/device.c
View file @
f83b53c1
...
...
@@ -556,6 +556,8 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
HRESULT
res
;
if
(
!
This
->
data_format
.
user_df
)
return
DIERR_INVALIDPARAM
;
if
(
This
->
dwCoopLevel
&
DISCL_FOREGROUND
&&
This
->
win
!=
GetForegroundWindow
())
return
DIERR_OTHERAPPHASPRIO
;
EnterCriticalSection
(
&
This
->
crit
);
res
=
This
->
acquired
?
S_FALSE
:
DI_OK
;
...
...
dlls/dinput/tests/mouse.c
View file @
f83b53c1
...
...
@@ -72,11 +72,15 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
{
HRESULT
hr
;
LPDIRECTINPUTDEVICE
pMouse
=
NULL
;
DIMOUSESTATE2
m_state
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
DISCL_NONEXCLUSIVE
|
DISCL_FOREGROUND
);
ok
(
hr
==
S_OK
,
"SetCooperativeLevel: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_SetDataFormat
(
pMouse
,
&
c_dfDIMouse
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirectInputDevice_Unacquire
(
pMouse
);
...
...
@@ -86,6 +90,23 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Acquire() should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
/* Foreground coop level requires window to have focus */
/* This should make dinput loose mouse input */
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
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
DIERR_OTHERAPPHASPRIO
,
"Acquire() should have failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
SetActiveWindow
(
hwnd
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
S_OK
,
"Acquire() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
pMouse
)
IUnknown_Release
(
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