From a7f334dc2a3eec0119d8b77ec3ff35bbc8aae5f9 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 3 Oct 2018 17:34:27 +1000 Subject: ControllerInterface: Don't crash on non-X11 QPA --- .../ControllerInterface/ControllerInterface.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 0e6857c137..7be22d4a8d 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -41,12 +41,12 @@ ControllerInterface g_controller_interface; // // Detect devices and inputs outputs / will make refresh function later // -void ControllerInterface::Initialize(void* const hwnd) +void ControllerInterface::Initialize(const WindowSystemInfo& wsi) { if (m_is_init) return; - m_hwnd = hwnd; + m_wsi = wsi; m_is_populating_devices = true; #ifdef CIFACE_USE_DINPUT @@ -59,7 +59,8 @@ void ControllerInterface::Initialize(void* const hwnd) // nothing needed #endif #ifdef CIFACE_USE_OSX - ciface::OSX::Init(hwnd); + if (m_wsi.type == WindowSystemType::MacOS) + ciface::OSX::Init(wsi.render_surface); // nothing needed for Quartz #endif #ifdef CIFACE_USE_SDL @@ -92,17 +93,22 @@ void ControllerInterface::RefreshDevices() m_is_populating_devices = true; #ifdef CIFACE_USE_DINPUT - ciface::DInput::PopulateDevices(reinterpret_cast(m_hwnd)); + if (m_wsi.type == WindowSystemType::Windows) + ciface::DInput::PopulateDevices(reinterpret_cast(m_wsi.render_surface)); #endif #ifdef CIFACE_USE_XINPUT ciface::XInput::PopulateDevices(); #endif #ifdef CIFACE_USE_XLIB - ciface::XInput2::PopulateDevices(m_hwnd); + if (m_wsi.type == WindowSystemType::X11) + ciface::XInput2::PopulateDevices(m_wsi.render_surface); #endif #ifdef CIFACE_USE_OSX - ciface::OSX::PopulateDevices(m_hwnd); - ciface::Quartz::PopulateDevices(m_hwnd); + if (m_wsi.type == WindowSystemType::MacOS) + { + ciface::OSX::PopulateDevices(m_wsi.render_surface); + ciface::Quartz::PopulateDevices(m_wsi.render_surface); + } #endif #ifdef CIFACE_USE_SDL ciface::SDL::PopulateDevices(); -- cgit v1.2.3