1b2a80cabc
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@1437 6952d904-891a-0410-993b-d76249ca496b
69 lines
3.0 KiB
Diff
69 lines
3.0 KiB
Diff
|
|
--- a/dlls/dinput/mouse.c
|
|
+++ b/dlls/dinput/mouse.c
|
|
@@ -55,7 +55,8 @@ typedef enum
|
|
{
|
|
WARP_DEFAULT,
|
|
WARP_DISABLE,
|
|
- WARP_FORCE_ON
|
|
+ WARP_FORCE_ON,
|
|
+ WARP_FORCE_EDGE
|
|
} WARP_MOUSE;
|
|
|
|
struct SysMouseImpl
|
|
@@ -205,6 +206,8 @@ static SysMouseImpl *alloc_device(REFGUID rguid, const void *mvt, IDirectInputIm
|
|
newDevice->warp_override = WARP_DISABLE;
|
|
else if (!strcasecmp(buffer, "force"))
|
|
newDevice->warp_override = WARP_FORCE_ON;
|
|
+ else if (!strcasecmp(buffer, "force_edge"))
|
|
+ newDevice->warp_override = WARP_FORCE_EDGE;
|
|
}
|
|
if (appkey) RegCloseKey(appkey);
|
|
if (hkey) RegCloseKey(hkey);
|
|
@@ -331,8 +334,16 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
|
}
|
|
|
|
This->need_warp = This->warp_override != WARP_DISABLE &&
|
|
- (pt.x || pt.y) &&
|
|
- (dwCoop & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON);
|
|
+ (
|
|
+ ((pt.x || pt.y) && This->warp_override != WARP_FORCE_EDGE) ||
|
|
+ (
|
|
+ (
|
|
+ hook->pt.x<2 || hook->pt.y<2 ||
|
|
+ hook->pt.x>((2 * This->win_centerX)-2) || hook->pt.y>((2 * This->win_centerY)-2)
|
|
+ ) && This->warp_override == WARP_FORCE_EDGE
|
|
+ )
|
|
+ ) &&
|
|
+ (dwCoop & DISCL_EXCLUSIVE || This->warp_override >= WARP_FORCE_ON);
|
|
break;
|
|
}
|
|
case WM_MOUSEWHEEL:
|
|
@@ -453,7 +464,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|
}
|
|
|
|
/* Need a window to warp mouse in. */
|
|
- if (This->warp_override == WARP_FORCE_ON && !This->base.win)
|
|
+ if (This->warp_override >= WARP_FORCE_ON && !This->base.win)
|
|
This->base.win = GetDesktopWindow();
|
|
|
|
/* Get the window dimension and find the center */
|
|
@@ -462,7 +473,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|
This->win_centerY = (rect.bottom - rect.top ) / 2;
|
|
|
|
/* Warp the mouse to the center of the window */
|
|
- if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
|
|
+ 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;
|
|
@@ -496,7 +507,7 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|
}
|
|
|
|
/* And put the mouse cursor back where it was at acquire time */
|
|
- if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override == WARP_FORCE_ON)
|
|
+ if (This->base.dwCoopLevel & DISCL_EXCLUSIVE || This->warp_override >= WARP_FORCE_ON)
|
|
{
|
|
TRACE(" warping mouse back to (%d , %d)\n", This->org_coords.x, This->org_coords.y);
|
|
SetCursorPos(This->org_coords.x, This->org_coords.y);
|