mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
InputCommon: Handle window change in Quartz.
This commit is contained in:
@ -3,9 +3,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "InputCommon/ControllerInterface/InputBackend.h"
|
||||
|
||||
namespace ciface::Quartz
|
||||
{
|
||||
std::string GetSourceName();
|
||||
|
||||
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface);
|
||||
} // namespace ciface::Quartz
|
||||
|
@ -7,11 +7,17 @@
|
||||
|
||||
namespace ciface::Quartz
|
||||
{
|
||||
std::string GetSourceName()
|
||||
{
|
||||
return "Quartz";
|
||||
}
|
||||
|
||||
class InputBackend final : public ciface::InputBackend
|
||||
{
|
||||
public:
|
||||
using ciface::InputBackend::InputBackend;
|
||||
void PopulateDevices() override;
|
||||
void HandleWindowChange() override;
|
||||
};
|
||||
|
||||
std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* controller_interface)
|
||||
@ -19,6 +25,15 @@ std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* co
|
||||
return std::make_unique<InputBackend>(controller_interface);
|
||||
}
|
||||
|
||||
void InputBackend::HandleWindowChange()
|
||||
{
|
||||
const std::string source_name = GetSourceName();
|
||||
GetControllerInterface().RemoveDevice(
|
||||
[&](const auto* dev) { return dev->GetSource() == source_name; }, true);
|
||||
|
||||
PopulateDevices();
|
||||
}
|
||||
|
||||
void InputBackend::PopulateDevices()
|
||||
{
|
||||
const WindowSystemInfo wsi = GetControllerInterface().GetWindowSystemInfo();
|
||||
|
@ -280,7 +280,7 @@ std::string KeyboardAndMouse::GetName() const
|
||||
|
||||
std::string KeyboardAndMouse::GetSource() const
|
||||
{
|
||||
return "Quartz";
|
||||
return Quartz::GetSourceName();
|
||||
}
|
||||
|
||||
ControlState KeyboardAndMouse::Cursor::GetState() const
|
||||
|
Reference in New Issue
Block a user