mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Ensures key state is cleared upon activation changes.
This commit is contained in:
parent
2d223305eb
commit
be1c3e9136
@ -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);
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
||||
|
||||
bool processEvent(QKeyEvent *);
|
||||
|
||||
void changeEvent(QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void startMachine();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user