From 610a4a9498c78293566e3996a9672269a7f085e2 Mon Sep 17 00:00:00 2001
From: Boris Dušek <me@dusek.me>
Date: Wed, 31 Jul 2013 00:08:46 +0200
Subject: fdo#67410: VoiceOver does not provide typing or cursor movement echo
 in text
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: Ief39aecd247b612c52cd970b6c5911f34d8cb69e
Reviewed-on: https://gerrit.libreoffice.org/5208
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
---
 vcl/aqua/source/a11y/aqua11yfactory.mm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'vcl/aqua')

diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm
index 222fb6c48641..64f178314a38 100644
--- a/vcl/aqua/source/a11y/aqua11yfactory.mm
+++ b/vcl/aqua/source/a11y/aqua11yfactory.mm
@@ -155,6 +155,30 @@ static bool enabled = false;
         #endif
         {
             [ dAllWrapper setObject: aWrapper forKey: nKey ];
+            /* fdo#67410: Accessibility notifications are not delivered on NSView subclasses that do not
+               "reasonably" participate in NSView hierarchy (perhaps the only important point is
+               that the view is a transitive subview of the NSWindow's content view, but I
+               did not try to verify that).
+
+               So let the superview-subviews relationship mirror the AXParent-AXChildren relationship.
+            */
+            id parent = [aWrapper accessibilityAttributeValue:NSAccessibilityParentAttribute];
+            if (parent) {
+                if ([parent isKindOfClass:[NSView class]]) {
+                    // SAL_DEBUG("Wrapper INIT: " << [[aWrapper description] UTF8String] << " ==> " << [[parent description] UTF8String]);
+                    NSView *parentView = (NSView *)parent;
+                    [parentView addSubview:aWrapper positioned:NSWindowBelow relativeTo:nil];
+                } else if ([parent isKindOfClass:NSClassFromString(@"SalFrameWindow")]) {
+                    NSWindow *window = (NSWindow *)parent;
+                    NSView *salView = [window contentView];
+                    // SAL_DEBUG("Wrapper INIT SAL: " << [[aWrapper description] UTF8String] << " ==> " << [[salView description] UTF8String]);
+                    [salView addSubview:aWrapper positioned:NSWindowBelow relativeTo:nil];
+                } else {
+                    // SAL_DEBUG("Wrapper INIT: !! " << [[aWrapper description] UTF8String] << " !==>! " << [[parent description] UTF8String] << "!!");
+                }
+            } else {
+                // SAL_DEBUG("Wrapper INIT: " << [[aWrapper description] UTF8String] << " ==> NO PARENT");
+            }
         }
     }
     return aWrapper;
@@ -169,6 +193,9 @@ static bool enabled = false;
     // TODO: when RADIO_BUTTON search for associated RadioGroup-wrapper and delete that as well
     AquaA11yWrapper * theWrapper = [ AquaA11yFactory wrapperForAccessibleContext: rxAccessibleContext createIfNotExists: NO ];
     if ( theWrapper != nil ) {
+        if (![theWrapper isKindOfClass:NSClassFromString(@"SalFrameView")]) {
+            [theWrapper removeFromSuperview];
+        }
         [ [ AquaA11yFactory allWrapper ] removeObjectForKey: [ AquaA11yFactory keyForAccessibleContext: rxAccessibleContext ] ];
         [ theWrapper release ];
     }
-- 
cgit