From cc207537a32901197034038d91a7703980af0b9f Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 3 Nov 2018 00:27:40 +0100 Subject: [PATCH] Fix for unintended snapshots while parenting/un-parenting --- interface/src/Application.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b085f0b4de..5256ef2c6a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4039,21 +4039,23 @@ void Application::keyPressEvent(QKeyEvent* event) { break; case Qt::Key_P: { - AudioInjectorOptions options; - options.localOnly = true; - options.stereo = true; - Setting::Handle notificationSounds{ MenuOption::NotificationSounds, true}; - Setting::Handle notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true}; - if (notificationSounds.get() && notificationSoundSnapshot.get()) { - if (_snapshotSoundInjector) { - _snapshotSoundInjector->setOptions(options); - _snapshotSoundInjector->restart(); - } else { - QByteArray samples = _snapshotSound->getByteArray(); - _snapshotSoundInjector = AudioInjector::playSound(samples, options); + if (!isShifted && !isMeta && !isOption && !event->isAutoRepeat()) { + AudioInjectorOptions options; + options.localOnly = true; + options.stereo = true; + Setting::Handle notificationSounds{ MenuOption::NotificationSounds, true }; + Setting::Handle notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true }; + if (notificationSounds.get() && notificationSoundSnapshot.get()) { + if (_snapshotSoundInjector) { + _snapshotSoundInjector->setOptions(options); + _snapshotSoundInjector->restart(); + } else { + QByteArray samples = _snapshotSound->getByteArray(); + _snapshotSoundInjector = AudioInjector::playSound(samples, options); + } } + takeSnapshot(true); } - takeSnapshot(true); break; }