Merge pull request #3387 from skidau/Mouse-In-Separate-Window-By-ProcessId
Ignored the mouse position unless the cursor is over the Dolphin window.
This commit is contained in:
commit
fc86a9e626
|
@ -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.)
|
||||||
|
@ -138,6 +142,12 @@ void GetMousePos(ControlState* const x, ControlState* const y)
|
||||||
// Return the mouse position as a range from -1 to 1
|
// Return the mouse position as a range from -1 to 1
|
||||||
*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()
|
||||||
|
|
Loading…
Reference in New Issue