1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Ensures key state is cleared upon activation changes.

This commit is contained in:
Thomas Harte 2020-07-08 21:31:29 -04:00
parent 2d223305eb
commit be1c3e9136
2 changed files with 16 additions and 0 deletions

View File

@ -757,6 +757,20 @@ void MainWindow::setWindowTitle() {
// MARK: - Event Processing
void MainWindow::changeEvent(QEvent *event) {
// Clear current key state upon any window activation change.
if(event->type() == QEvent::ActivationChange) {
const auto keyboardMachine = machine->keyboard_machine();
if(keyboardMachine) {
keyboardMachine->clear_all_keys();
return;
}
}
event->ignore();
}
void MainWindow::keyPressEvent(QKeyEvent *event) {
processEvent(event);
}

View File

@ -74,6 +74,8 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
bool processEvent(QKeyEvent *);
void changeEvent(QEvent *) override;
private slots:
void startMachine();