Ignored the mouse position unless the cursor is over the Dolphin window.

Fixes issue 8673.
This commit is contained in:
skidau 2015-12-24 09:44:26 +11:00
parent 81f379b409
commit f96f90b334
1 changed files with 20 additions and 10 deletions

View File

@ -126,6 +126,10 @@ void GetMousePos(ControlState* const x, ControlState* const y)
GetCursorPos(&point);
// Get the cursor position relative to the upper left corner of the current window (separate or render to main)
HWND hwnd = WindowFromPoint(point);
DWORD processId;
GetWindowThreadProcessId(hwnd, &processId);
if (processId == GetCurrentProcessId())
{
ScreenToClient(hwnd, &point);
// Get the size of the current window. (In my case Rect.top and Rect.left was zero.)
@ -138,6 +142,12 @@ void GetMousePos(ControlState* const x, ControlState* const y)
// Return the mouse position as a range from -1 to 1
*x = (ControlState)point.x / (ControlState)win_width * 2 - 1;
*y = (ControlState)point.y / (ControlState)win_height * 2 - 1;
}
else
{
*x = (ControlState)1;
*y = (ControlState)1;
}
}
void KeyboardMouse::UpdateInput()