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
db782fe0
Commit
db782fe0
authored
Sep 22, 2006
by
Ivan Leo
Committed by
Alexandre Julliard
Sep 26, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Add some error checks to mouse.c.
parent
e1fa51f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
mouse.c
dlls/dinput/mouse.c
+9
-5
No files found.
dlls/dinput/mouse.c
View file @
db782fe0
...
...
@@ -551,12 +551,13 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
}
static
void
dinput_window_check
(
SysMouseImpl
*
This
)
{
static
BOOL
dinput_window_check
(
SysMouseImpl
*
This
)
{
RECT
rect
;
DWORD
centerX
,
centerY
;
/* make sure the window hasn't moved */
GetWindowRect
(
This
->
win
,
&
rect
);
if
(
!
GetWindowRect
(
This
->
win
,
&
rect
))
return
FALSE
;
centerX
=
(
rect
.
right
-
rect
.
left
)
/
2
;
centerY
=
(
rect
.
bottom
-
rect
.
top
)
/
2
;
if
(
This
->
win_centerX
!=
centerX
||
This
->
win_centerY
!=
centerY
)
{
...
...
@@ -566,6 +567,7 @@ static void dinput_window_check(SysMouseImpl* This) {
This
->
mapped_center
.
x
=
This
->
win_centerX
;
This
->
mapped_center
.
y
=
This
->
win_centerY
;
MapWindowPoints
(
This
->
win
,
HWND_DESKTOP
,
&
This
->
mapped_center
,
1
);
return
TRUE
;
}
...
...
@@ -700,7 +702,8 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
/* Check if we need to do a mouse warping */
if
(
This
->
need_warp
==
WARP_NEEDED
&&
(
GetCurrentTime
()
-
This
->
last_warped
>
10
))
{
dinput_window_check
(
This
);
if
(
!
dinput_window_check
(
This
))
return
DIERR_GENERIC
;
TRACE
(
"Warping mouse to %ld - %ld
\n
"
,
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
SetCursorPos
(
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
This
->
last_warped
=
GetCurrentTime
();
...
...
@@ -794,7 +797,8 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
/* Check if we need to do a mouse warping */
if
(
This
->
need_warp
==
WARP_NEEDED
&&
(
GetCurrentTime
()
-
This
->
last_warped
>
10
))
{
dinput_window_check
(
This
);
if
(
!
dinput_window_check
(
This
))
return
DIERR_GENERIC
;
TRACE
(
"Warping mouse to %ld - %ld
\n
"
,
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
SetCursorPos
(
This
->
mapped_center
.
x
,
This
->
mapped_center
.
y
);
This
->
last_warped
=
GetCurrentTime
();
...
...
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