From 4f965da4f185e654d20838f75321c5a3fe68356f Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 28 Mar 2015 11:08:25 +1100 Subject: Revert the recent changes related to updating hwnd --- .../Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 7 +------ Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface') diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index a3c14a0ab5..1330cb1e0a 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -44,7 +44,7 @@ ControllerInterface g_controller_interface; void ControllerInterface::Initialize(void* const hwnd) { if (m_is_init) - DeInit(); + return; m_hwnd = hwnd; @@ -102,11 +102,6 @@ void ControllerInterface::Shutdown() delete d; } - DeInit(); -} - -void ControllerInterface::DeInit() -{ m_devices.clear(); #ifdef CIFACE_USE_XINPUT diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 1b2c93951f..9ab8427ad2 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -117,9 +117,6 @@ public: void Initialize(void* const hwnd); void Reinitialize(); void Shutdown(); - - void DeInit(); - bool IsInit() const { return m_is_init; } void UpdateReference(ControlReference* control, const ciface::Core::DeviceQualifier& default_device) const; -- cgit v1.2.3 From 9947324296d942897b5248bd5651cddbd9078751 Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 28 Mar 2015 11:38:14 +1100 Subject: Track the co-ordinates of the mouse relative to the pointed window instead of the original hwnd. --- .../ControllerInterface/DInput/DInputKeyboardMouse.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface') diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index c96e51a830..af4e3f0981 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -31,11 +31,11 @@ static const struct }; // lil silly -static HWND hwnd; +static HWND m_hwnd; void InitKeyboardMouse(IDirectInput8* const idi8, std::vector& devices, HWND _hwnd) { - hwnd = _hwnd; + m_hwnd = _hwnd; // mouse and keyboard are a combined device, to allow shift+click and stuff // if that's dumb, I will make a VirtualDevice class that just uses ranges of inputs/outputs from other devices @@ -124,10 +124,11 @@ void GetMousePos(ControlState* const x, ControlState* const y) { POINT point = { 1, 1 }; GetCursorPos(&point); - // Get the cursor position relative to the upper left corner of the rendering window + // Get the cursor position relative to the upper left corner of the current window (separate or render to main) + HWND hwnd = WindowFromPoint(point); ScreenToClient(hwnd, &point); - // Get the size of the rendering 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.) RECT rect; GetClientRect(hwnd, &rect); // Width and height is the size of the rendering window -- cgit v1.2.3