From 693b889fdd085f02b8e681d6e2a93c69dd66185f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 31 Jul 2020 21:48:20 -0400 Subject: [PATCH] Ensures that the MultiKeyboard functions. --- .../MultiMachine/Implementation/MultiKeyboardMachine.cpp | 6 +++--- .../MultiMachine/Implementation/MultiKeyboardMachine.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp index 5c12ff92f..d2557968a 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.cpp @@ -10,12 +10,12 @@ using namespace Analyser::Dynamic; -MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) : - keyboard_(machines_) { +MultiKeyboardMachine::MultiKeyboardMachine(const std::vector> &machines) { for(const auto &machine: machines) { auto keyboard_machine = machine->keyboard_machine(); if(keyboard_machine) machines_.push_back(keyboard_machine); } + keyboard_ = std::make_unique(machines_); } void MultiKeyboardMachine::clear_all_keys() { @@ -45,7 +45,7 @@ bool MultiKeyboardMachine::can_type(char c) const { } Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() { - return keyboard_; + return *keyboard_; } MultiKeyboardMachine::MultiKeyboard::MultiKeyboard(const std::vector<::MachineTypes::KeyboardMachine *> &machines) diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp index aa5433563..2de296456 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiKeyboardMachine.hpp @@ -42,7 +42,7 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine { std::set observed_keys_; bool is_exclusive_ = false; }; - MultiKeyboard keyboard_; + std::unique_ptr keyboard_; public: MultiKeyboardMachine(const std::vector> &machines);