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
0036e438
Commit
0036e438
authored
Apr 26, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Pass mouse messages through if the request to clip the cursor is rejected.
parent
c52f4154
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
mouse.c
dlls/dinput/mouse.c
+12
-11
No files found.
dlls/dinput/mouse.c
View file @
0036e438
...
...
@@ -66,6 +66,7 @@ struct SysMouseImpl
/* These are used in case of relative -> absolute transitions */
POINT
org_coords
;
POINT
mapped_center
;
BOOL
clipped
;
/* warping: whether we need to move mouse back to middle once we
* reach window borders (for e.g. shooters, "surface movement" games) */
BOOL
need_warp
;
...
...
@@ -319,21 +320,20 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
{
MSLLHOOKSTRUCT
*
hook
=
(
MSLLHOOKSTRUCT
*
)
lparam
;
SysMouseImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
DWORD
dwCoop
;
int
wdata
=
0
,
inst_id
=
-
1
,
ret
;
TRACE
(
"msg %lx @ (%d %d)
\n
"
,
wparam
,
hook
->
pt
.
x
,
hook
->
pt
.
y
);
EnterCriticalSection
(
&
This
->
base
.
crit
);
dwCoop
=
This
->
base
.
dwCoopLevel
;
ret
=
dwCoop
&
DISCL_EXCLUSIVE
;
ret
=
This
->
clipped
;
switch
(
wparam
)
{
case
WM_MOUSEMOVE
:
{
POINT
pt
,
pt1
;
GetCursorPos
(
&
pt
);
if
(
This
->
clipped
)
pt
=
This
->
mapped_center
;
else
GetCursorPos
(
&
pt
);
This
->
m_state
.
lX
+=
pt
.
x
=
hook
->
pt
.
x
-
pt
.
x
;
This
->
m_state
.
lY
+=
pt
.
y
=
hook
->
pt
.
y
-
pt
.
y
;
...
...
@@ -422,28 +422,29 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
static
HRESULT
warp_check
(
SysMouseImpl
*
This
,
BOOL
force
)
{
DWORD
now
=
GetCurrentTime
();
const
DWORD
interval
=
(
This
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
)
?
500
:
10
;
const
DWORD
interval
=
This
->
clipped
?
500
:
10
;
if
(
force
||
(
This
->
need_warp
&&
(
now
-
This
->
last_warped
>
interval
)))
{
RECT
rect
;
RECT
rect
,
new_rect
;
This
->
last_warped
=
now
;
This
->
need_warp
=
FALSE
;
if
(
!
GetWindowRect
(
This
->
base
.
win
,
&
rect
))
return
DIERR_GENERIC
;
This
->
mapped_center
.
x
=
(
rect
.
left
+
rect
.
right
)
/
2
;
This
->
mapped_center
.
y
=
(
rect
.
top
+
rect
.
bottom
)
/
2
;
if
(
!
This
->
clipped
)
{
TRACE
(
"Warping mouse to %d - %d
\n
"
,
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
SetCursorPos
(
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
}
if
(
This
->
base
.
dwCoopLevel
&
DISCL_EXCLUSIVE
)
{
SetRect
(
&
rect
,
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
,
This
->
mapped_center
.
x
+
1
,
This
->
mapped_center
.
y
+
1
);
TRACE
(
"Clipping mouse to %s
\n
"
,
wine_dbgstr_rect
(
&
rect
));
ClipCursor
(
&
rect
);
}
else
{
TRACE
(
"Warping mouse to %d - %d
\n
"
,
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
SetCursorPos
(
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
This
->
clipped
=
GetClipCursor
(
&
new_rect
)
&&
EqualRect
(
&
rect
,
&
new_rect
);
}
}
return
DI_OK
;
...
...
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