summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp2
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp5
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
index 806fd31f3d..e09bd2fdd9 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
@@ -71,7 +71,7 @@ void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
InitKeyboardMouse(idi8, devices, hwnd);
#endif
#ifdef CIFACE_USE_DINPUT_JOYSTICK
- InitJoystick(idi8, devices/*, hwnd*/);
+ InitJoystick(idi8, devices, hwnd);
#endif
idi8->Release();
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
index 337936f3a4..40823d617d 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
@@ -142,7 +142,7 @@ LCleanup:
}
#endif
-void InitJoystick( IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices/*, HWND hwnd*/ )
+void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
{
std::list<DIDEVICEINSTANCE> joysticks;
idi8->EnumDevices( DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY );
@@ -171,8 +171,7 @@ void InitJoystick( IDirectInput8* const idi8, std::vector<ControllerInterface::D
{
if (SUCCEEDED(js_device->SetDataFormat(&c_dfDIJoystick)))
{
- // using foregroundwindow seems like a hack
- if (FAILED(js_device->SetCooperativeLevel(GetForegroundWindow(), DISCL_BACKGROUND | DISCL_EXCLUSIVE)))
+ if (FAILED(js_device->SetCooperativeLevel(GetAncestor(hwnd, GA_ROOT), DISCL_BACKGROUND | DISCL_EXCLUSIVE)))
{
//PanicAlert("SetCooperativeLevel(DISCL_EXCLUSIVE) failed!");
// fall back to non-exclusive mode, with no rumble
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
index 35faf2ee95..a1bdcde0e8 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
@@ -21,7 +21,7 @@ namespace ciface
namespace DInput
{
-void InitJoystick( IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices/*, HWND hwnd*/ );
+void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd);
class Joystick : public ControllerInterface::Device
{