1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Ensures that the MultiKeyboard functions.

This commit is contained in:
Thomas Harte 2020-07-31 21:48:20 -04:00
parent 671f48dc10
commit 693b889fdd
2 changed files with 4 additions and 4 deletions

View File

@ -10,12 +10,12 @@
using namespace Analyser::Dynamic; using namespace Analyser::Dynamic;
MultiKeyboardMachine::MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) : MultiKeyboardMachine::MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines) {
keyboard_(machines_) {
for(const auto &machine: machines) { for(const auto &machine: machines) {
auto keyboard_machine = machine->keyboard_machine(); auto keyboard_machine = machine->keyboard_machine();
if(keyboard_machine) machines_.push_back(keyboard_machine); if(keyboard_machine) machines_.push_back(keyboard_machine);
} }
keyboard_ = std::make_unique<MultiKeyboard>(machines_);
} }
void MultiKeyboardMachine::clear_all_keys() { void MultiKeyboardMachine::clear_all_keys() {
@ -45,7 +45,7 @@ bool MultiKeyboardMachine::can_type(char c) const {
} }
Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() { Inputs::Keyboard &MultiKeyboardMachine::get_keyboard() {
return keyboard_; return *keyboard_;
} }
MultiKeyboardMachine::MultiKeyboard::MultiKeyboard(const std::vector<::MachineTypes::KeyboardMachine *> &machines) MultiKeyboardMachine::MultiKeyboard::MultiKeyboard(const std::vector<::MachineTypes::KeyboardMachine *> &machines)

View File

@ -42,7 +42,7 @@ class MultiKeyboardMachine: public MachineTypes::KeyboardMachine {
std::set<Key> observed_keys_; std::set<Key> observed_keys_;
bool is_exclusive_ = false; bool is_exclusive_ = false;
}; };
MultiKeyboard keyboard_; std::unique_ptr<MultiKeyboard> keyboard_;
public: public:
MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines); MultiKeyboardMachine(const std::vector<std::unique_ptr<::Machine::DynamicMachine>> &machines);