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

View file

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