Alexandre Julliard : dinput: Get rid of some redundant coordinate mappings.
Alexandre Julliard
julliard at winehq.org
Tue Apr 26 11:35:46 CDT 2011
Module: wine
Branch: master
Commit: 8578f9c37579ea8b9856aa1838244afe44ba0996
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8578f9c37579ea8b9856aa1838244afe44ba0996
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Apr 26 12:26:16 2011 +0200
dinput: Get rid of some redundant coordinate mappings.
---
dlls/dinput/mouse.c | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index ace9fe2..9434888 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -66,7 +66,6 @@ struct SysMouseImpl
/* These are used in case of relative -> absolute transitions */
POINT org_coords;
POINT mapped_center;
- DWORD win_centerX, win_centerY;
/* 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;
@@ -419,20 +418,12 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
static BOOL dinput_window_check(SysMouseImpl* This) {
RECT rect;
- DWORD centerX, centerY;
/* make sure the window hasn't moved */
if(!GetWindowRect(This->base.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) {
- This->win_centerX = centerX;
- This->win_centerY = centerY;
- }
- This->mapped_center.x = This->win_centerX;
- This->mapped_center.y = This->win_centerY;
- MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
+ This->mapped_center.x = (rect.left + rect.right) / 2;
+ This->mapped_center.y = (rect.top + rect.bottom) / 2;
return TRUE;
}
@@ -488,15 +479,12 @@ static HRESULT WINAPI SysMouseWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
/* Get the window dimension and find the center */
GetWindowRect(This->base.win, &rect);
- This->win_centerX = (rect.right - rect.left) / 2;
- This->win_centerY = (rect.bottom - rect.top ) / 2;
+ This->mapped_center.x = (rect.left + rect.right) / 2;
+ This->mapped_center.y = (rect.top + rect.bottom) / 2;
/* Warp the mouse to the center of the window */
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
{
- This->mapped_center.x = This->win_centerX;
- This->mapped_center.y = This->win_centerY;
- MapWindowPoints(This->base.win, HWND_DESKTOP, &This->mapped_center, 1);
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->last_warped = GetCurrentTime();
More information about the wine-cvs
mailing list