Savestates/Mouse: Fix Mouse handler use

This commit is contained in:
Elad Ashkenazi 2024-06-20 19:23:36 +03:00
parent 649714429b
commit bceaf46e2f
3 changed files with 9 additions and 8 deletions

View File

@ -213,12 +213,6 @@ void raw_mouse::update_values(const RAWMOUSE& state)
}
#endif
raw_mouse_handler::raw_mouse_handler(bool is_for_gui)
: MouseHandlerBase()
, m_is_for_gui(is_for_gui)
{
}
raw_mouse_handler::~raw_mouse_handler()
{
if (m_thread)

View File

@ -65,11 +65,17 @@ private:
class raw_mouse_handler final : public MouseHandlerBase
{
public:
raw_mouse_handler(bool is_for_gui = false);
using MouseHandlerBase::MouseHandlerBase;
virtual ~raw_mouse_handler();
void Init(const u32 max_connect) override;
void SetIsForGui(bool value)
{
m_is_for_gui = value;
}
const std::map<void*, raw_mouse>& get_mice() const { return m_raw_mice; };
void set_mouse_press_callback(std::function<void(const std::string&, s32, bool)> cb)

View File

@ -65,7 +65,8 @@ raw_mouse_settings_dialog::raw_mouse_settings_dialog(QWidget* parent)
constexpr u32 max_devices = 16;
g_raw_mouse_handler = std::make_unique<raw_mouse_handler>(true);
g_raw_mouse_handler = std::make_unique<raw_mouse_handler>();
g_raw_mouse_handler->SetIsForGui(true);
g_raw_mouse_handler->Init(std::max(max_devices, ::size32(g_cfg_raw_mouse.players)));
g_raw_mouse_handler->set_mouse_press_callback([this](const std::string& device_name, s32 cell_code, bool pressed)
{