From 0b259c12a1bcdb5dedee7a9c71bffd142588b2ce Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Tue, 14 Dec 2021 15:18:49 -0500 Subject: [PATCH] Send Accessibility Change Notifications In a few strategic spots, if there's an accesibility handler on the object, send accessibility notificatios for the object. Addresses #4616 --- src/surge-xt/gui/SurgeGUIEditor.cpp | 14 ++++++++++++++ src/surge-xt/gui/widgets/WidgetBaseMixin.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp index 6ece58d6766..57aa558df18 100644 --- a/src/surge-xt/gui/SurgeGUIEditor.cpp +++ b/src/surge-xt/gui/SurgeGUIEditor.cpp @@ -1892,6 +1892,10 @@ void SurgeGUIEditor::openOrRecreateEditor() patchSelector->grabKeyboardFocus(); } + if (auto *handler = frame->getAccessibilityHandler()) + { + handler->notifyAccessibilityEvent(juce::AccessibilityEvent::structureChanged); + } frame->repaint(); } @@ -6279,6 +6283,16 @@ void SurgeGUIEditor::addComponentWithTracking(juce::Component *target, juce::Com auto cf = containedComponents.find(&source); if (cf != containedComponents.end()) containedComponents.erase(cf); + + /* Place this accessibility invalidation here in either case */ + if (auto *handler = source.getAccessibilityHandler()) + { + if (handler->getValueInterface()) + { + handler->notifyAccessibilityEvent(juce::AccessibilityEvent::valueChanged); + } + handler->notifyAccessibilityEvent(juce::AccessibilityEvent::titleChanged); + } } void SurgeGUIEditor::addAndMakeVisibleWithTracking(juce::Component *target, juce::Component &source) { diff --git a/src/surge-xt/gui/widgets/WidgetBaseMixin.h b/src/surge-xt/gui/widgets/WidgetBaseMixin.h index 1e36a554e6a..b1aeb02bfa3 100644 --- a/src/surge-xt/gui/widgets/WidgetBaseMixin.h +++ b/src/surge-xt/gui/widgets/WidgetBaseMixin.h @@ -47,6 +47,11 @@ struct WidgetBaseMixin : public Surge::GUI::SkinConsumingComponent, { for (auto t : listeners) t->valueChanged(this); + + if (auto *handler = asT()->getAccessibilityHandler(); handler->getValueInterface()) + { + handler->notifyAccessibilityEvent(juce::AccessibilityEvent::valueChanged); + } } void notifyControlModifierClicked(const juce::ModifierKeys &k, bool addRMB = false) {