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
adadb5be
Commit
adadb5be
authored
Sep 16, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Sep 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Return proper errors in SetCooperativeLevel.
parent
a9768075
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
3 deletions
+70
-3
mouse.c
dlls/dinput/mouse.c
+12
-3
mouse.c
dlls/dinput/tests/mouse.c
+58
-0
No files found.
dlls/dinput/mouse.c
View file @
adadb5be
...
...
@@ -363,14 +363,23 @@ static HRESULT WINAPI SysMouseAImpl_SetCooperativeLevel(
TRACE
(
" cooperative level : "
);
_dump_cooperativelevel_DI
(
dwflags
);
}
if
((
dwflags
&
(
DISCL_EXCLUSIVE
|
DISCL_NONEXCLUSIVE
))
==
0
||
(
dwflags
&
(
DISCL_EXCLUSIVE
|
DISCL_NONEXCLUSIVE
))
==
(
DISCL_EXCLUSIVE
|
DISCL_NONEXCLUSIVE
)
||
(
dwflags
&
(
DISCL_FOREGROUND
|
DISCL_BACKGROUND
))
==
0
||
(
dwflags
&
(
DISCL_FOREGROUND
|
DISCL_BACKGROUND
))
==
(
DISCL_FOREGROUND
|
DISCL_BACKGROUND
))
return
DIERR_INVALIDPARAM
;
if
(
dwflags
==
(
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
))
hwnd
=
GetDesktopWindow
();
if
(
!
hwnd
)
return
E_HANDLE
;
if
(
dwflags
&
DISCL_EXCLUSIVE
&&
dwflags
&
DISCL_BACKGROUND
)
{
return
DIERR_UNSUPPORTED
;
}
/* Store the window which asks for the mouse */
if
(
!
hwnd
)
hwnd
=
GetDesktopWindow
();
This
->
win
=
hwnd
;
This
->
dwCoopLevel
=
dwflags
;
...
...
dlls/dinput/tests/mouse.c
View file @
adadb5be
/*
* Copyright (c) 2005 Robert Reif
* Copyright (c) 2006 Vitaliy Margolen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -18,6 +19,7 @@
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <windows.h>
...
...
@@ -32,8 +34,64 @@
#include "dxerr8.h"
#include "dinput_test.h"
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_HANDLE
,
E_HANDLE
,
E_INVALIDARG
,
E_INVALIDARG
,
E_HANDLE
,
S_OK
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
};
static
const
HRESULT
SetCoop_real_window
[
16
]
=
{
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
S_OK
,
S_OK
,
E_INVALIDARG
,
E_INVALIDARG
,
E_NOTIMPL
,
S_OK
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
};
static
void
test_set_coop
(
LPDIRECTINPUT
pDI
,
HWND
hwnd
)
{
HRESULT
hr
;
LPDIRECTINPUTDEVICE
pMouse
=
NULL
;
int
i
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
FAILED
(
hr
))
return
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
NULL
,
i
);
ok
(
hr
==
SetCoop_null_window
[
i
],
"SetCooperativeLevel(NULL, %d): %s
\n
"
,
i
,
DXGetErrorString8
(
hr
));
}
for
(
i
=
0
;
i
<
16
;
i
++
)
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
i
);
ok
(
hr
==
SetCoop_real_window
[
i
],
"SetCooperativeLevel(hwnd, %d): %s
\n
"
,
i
,
DXGetErrorString8
(
hr
));
}
if
(
pMouse
)
IUnknown_Release
(
pMouse
);
}
static
void
mouse_tests
(
void
)
{
HRESULT
hr
;
LPDIRECTINPUT
pDI
=
NULL
;
HINSTANCE
hInstance
=
GetModuleHandle
(
NULL
);
HWND
hwnd
;
hr
=
DirectInputCreate
(
hInstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
FAILED
(
hr
))
return
;
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
200
,
200
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"err: %ld
\n
"
,
GetLastError
());
if
(
!
hwnd
)
return
;
ShowWindow
(
hwnd
,
SW_SHOW
);
test_set_coop
(
pDI
,
hwnd
);
DestroyWindow
(
hwnd
);
if
(
pDI
)
IUnknown_Release
(
pDI
);
}
START_TEST
(
mouse
)
...
...
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