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
101e9e64
Commit
101e9e64
authored
Jun 22, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Jun 23, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Warp mouse each 10ms instead of dropping events.
parent
9d449ab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
mouse.c
dlls/dinput/mouse.c
+9
-15
No files found.
dlls/dinput/mouse.c
View file @
101e9e64
...
...
@@ -136,6 +136,7 @@ struct SysMouseImpl
/* warping: whether we need to move mouse back to middle once we
* reach window borders (for e.g. shooters, "surface movement" games) */
WARP_STATUS
need_warp
;
DWORD
last_warped
;
int
acquired
;
HANDLE
hEvent
;
CRITICAL_SECTION
crit
;
...
...
@@ -418,7 +419,6 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
MSLLHOOKSTRUCT
*
hook
=
(
MSLLHOOKSTRUCT
*
)
lparam
;
SysMouseImpl
*
This
=
(
SysMouseImpl
*
)
current_lock
;
DWORD
dwCoop
;
static
long
last_event
=
0
;
int
wdata
;
if
(
code
!=
HC_ACTION
)
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
...
...
@@ -426,16 +426,6 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
EnterCriticalSection
(
&
(
This
->
crit
));
dwCoop
=
This
->
dwCoopLevel
;
/* Only allow mouse events every 10 ms.
* This is to allow the cursor to start acceleration before
* the warps happen. But if it involves a mouse button event we
* allow it since we don't want to lose the clicks.
*/
if
(((
GetCurrentTime
()
-
last_event
)
<
10
)
&&
wparam
==
WM_MOUSEMOVE
)
goto
end
;
else
last_event
=
GetCurrentTime
();
/* Mouse moved -> send event if asked */
if
(
This
->
hEvent
)
SetEvent
(
This
->
hEvent
);
...
...
@@ -623,6 +613,8 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
MapWindowPoints
(
This
->
win
,
HWND_DESKTOP
,
&
This
->
mapped_center
,
1
);
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
();
#ifdef MOUSE_HACK
This
->
need_warp
=
WARP_DONE
;
#else
...
...
@@ -698,11 +690,12 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
}
/* Check if we need to do a mouse warping */
if
(
This
->
need_warp
==
WARP_NEEDED
)
{
if
(
This
->
need_warp
==
WARP_NEEDED
&&
(
GetCurrentTime
()
-
This
->
last_warped
>
10
)
)
{
dinput_window_check
(
This
);
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
();
#ifdef MOUSE_HACK
This
->
need_warp
=
WARP_DONE
;
#else
...
...
@@ -791,11 +784,12 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
LeaveCriticalSection
(
&
(
This
->
crit
));
/* Check if we need to do a mouse warping */
if
(
This
->
need_warp
==
WARP_NEEDED
)
{
if
(
This
->
need_warp
==
WARP_NEEDED
&&
(
GetCurrentTime
()
-
This
->
last_warped
>
10
)
)
{
dinput_window_check
(
This
);
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
();
#ifdef MOUSE_HACK
This
->
need_warp
=
WARP_DONE
;
#else
...
...
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