mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
InputCommon: Add Quartz InputBackend class.
This commit is contained in:
parent
9941c54911
commit
498584ac77
@ -65,7 +65,7 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
|
|||||||
// nothing needed
|
// nothing needed
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_OSX
|
#ifdef CIFACE_USE_OSX
|
||||||
// nothing needed for Quartz
|
m_input_backends.emplace_back(ciface::Quartz::CreateInputBackend(this));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_SDL
|
#ifdef CIFACE_USE_SDL
|
||||||
m_input_backends.emplace_back(ciface::SDL::CreateInputBackend(this));
|
m_input_backends.emplace_back(ciface::SDL::CreateInputBackend(this));
|
||||||
@ -166,12 +166,6 @@ void ControllerInterface::RefreshDevices(RefreshReason reason)
|
|||||||
if (m_wsi.type == WindowSystemType::X11)
|
if (m_wsi.type == WindowSystemType::X11)
|
||||||
ciface::XInput2::PopulateDevices(m_wsi.render_window);
|
ciface::XInput2::PopulateDevices(m_wsi.render_window);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_OSX
|
|
||||||
if (m_wsi.type == WindowSystemType::MacOS)
|
|
||||||
{
|
|
||||||
ciface::Quartz::PopulateDevices(m_wsi.render_window);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef CIFACE_USE_ANDROID
|
#ifdef CIFACE_USE_ANDROID
|
||||||
ciface::Android::PopulateDevices();
|
ciface::Android::PopulateDevices();
|
||||||
#endif
|
#endif
|
||||||
@ -223,9 +217,6 @@ void ControllerInterface::Shutdown()
|
|||||||
#ifdef CIFACE_USE_XLIB
|
#ifdef CIFACE_USE_XLIB
|
||||||
// nothing needed
|
// nothing needed
|
||||||
#endif
|
#endif
|
||||||
#ifdef CIFACE_USE_OSX
|
|
||||||
ciface::Quartz::DeInit();
|
|
||||||
#endif
|
|
||||||
#ifdef CIFACE_USE_ANDROID
|
#ifdef CIFACE_USE_ANDROID
|
||||||
ciface::Android::Shutdown();
|
ciface::Android::Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "InputCommon/ControllerInterface/InputBackend.h"
|
||||||
|
|
||||||
namespace ciface::Quartz
|
namespace ciface::Quartz
|
||||||
{
|
{
|
||||||
void PopulateDevices(void* window);
|
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface);
|
||||||
void DeInit();
|
|
||||||
} // namespace ciface::Quartz
|
} // namespace ciface::Quartz
|
||||||
|
@ -7,15 +7,25 @@
|
|||||||
|
|
||||||
namespace ciface::Quartz
|
namespace ciface::Quartz
|
||||||
{
|
{
|
||||||
void PopulateDevices(void* window)
|
class InputBackend final : public ciface::InputBackend
|
||||||
{
|
{
|
||||||
if (!window)
|
public:
|
||||||
|
using ciface::InputBackend::InputBackend;
|
||||||
|
void PopulateDevices() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface)
|
||||||
|
{
|
||||||
|
return std::make_unique<InputBackend>(controller_interface);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputBackend::PopulateDevices()
|
||||||
|
{
|
||||||
|
const WindowSystemInfo wsi = GetControllerInterface().GetWindowSystemInfo();
|
||||||
|
if (wsi.type != WindowSystemType::MacOS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_controller_interface.AddDevice(std::make_shared<KeyboardAndMouse>(window));
|
GetControllerInterface().AddDevice(std::make_shared<KeyboardAndMouse>(wsi.render_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeInit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
} // namespace ciface::Quartz
|
} // namespace ciface::Quartz
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
|
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
#include "InputCommon/ControllerInterface/Quartz/Quartz.h"
|
||||||
|
|
||||||
/// Helper class to get window position data from threads other than the main thread
|
/// Helper class to get window position data from threads other than the main thread
|
||||||
@interface DolWindowPositionObserver : NSObject
|
@interface DolWindowPositionObserver : NSObject
|
||||||
|
Loading…
x
Reference in New Issue
Block a user