From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#31324: 26.0.91; Wrong AXSubrole of childframe on macOS Date: Sun, 13 May 2018 11:14:02 +0100 Message-ID: <20180513101402.GB15823@breton.holly.idiocy.org> References: <58a8e0b4-311c-4aa4-a5f1-f968ca93b6d3@Spark> <20180501203758.GA74662@breton.holly.idiocy.org> <034b13c0-b1c0-4340-bfd5-3de34f60322f@Spark> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="2B/JsCI69OhZNC5r" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1526206391 2254 195.159.176.226 (13 May 2018 10:13:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 13 May 2018 10:13:11 +0000 (UTC) User-Agent: Mutt/1.9.3 (2018-01-21) Cc: 31324@debbugs.gnu.org To: Fu Yuan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 13 12:13:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHo00-0000RJ-Hb for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 May 2018 12:13:04 +0200 Original-Received: from localhost ([::1]:57639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHo27-0007Tq-PS for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 May 2018 06:15:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHo1y-0007LZ-B6 for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 06:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHo1u-0001F4-6q for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 06:15:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHo1u-0001Er-05 for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 06:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fHo1t-0006tA-OF for bug-gnu-emacs@gnu.org; Sun, 13 May 2018 06:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 May 2018 10:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31324 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31324-submit@debbugs.gnu.org id=B31324.152620645326408 (code B ref 31324); Sun, 13 May 2018 10:15:01 +0000 Original-Received: (at 31324) by debbugs.gnu.org; 13 May 2018 10:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:60208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHo16-0006rs-Ka for submit@debbugs.gnu.org; Sun, 13 May 2018 06:14:12 -0400 Original-Received: from mail-wr0-f176.google.com ([209.85.128.176]:43026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHo15-0006rf-Bz for 31324@debbugs.gnu.org; Sun, 13 May 2018 06:14:11 -0400 Original-Received: by mail-wr0-f176.google.com with SMTP id v15-v6so9295916wrm.10 for <31324@debbugs.gnu.org>; Sun, 13 May 2018 03:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ANaeKaPWRgfecwWexdv9OFg/hlt7DG4FeENd2o4i4C0=; b=O3EB8bl9tHz2wnAuTl0yNp1wwI9c1i7/zIMqlaC5PjL4XZTHKtlhoNgqrsj39rTpj3 CCjtXQm6BHww2FeEvOaH/rWhZ7yArPOtS+g5vmCmpXNgrJanjxpTCdc6C9xU/zpa+kxl VO8afeZR6F7nY3L9vkKvO+j8H3MeMdMf1a+G7g8yn4nIO4bLvfpf9+7FDfQNXjokTkJV 1Nabhs1qPTwA5LMj90oxYBnVpZBRgb0X2oqUWGF05QQMDcrJBOwRtNHG1g/RaDlUYht5 /OguZ6YwSpsx7UcD7QD4KzGgoqLYjthiyrzqKtRA1n3iYES0NqyEnReAI5UjwEIodLVh 2BDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ANaeKaPWRgfecwWexdv9OFg/hlt7DG4FeENd2o4i4C0=; b=ZGGyXZ6cH84MzDgLwUTymKRy61sGWmjh2zN7om1aJDpy2lR/Sub5GOpz6HGKnl/khX wAw0EFrWvzVmc0qVorZGXU0KhnkjlhiBWl1SJPTn0FczUvHxKHq1PIy4VpCy7pDoj9Wx S6iMpUR5K+vMb8ug5M11BB891Eut4TXKF7/0PdPijAm+ajc1fBk6Zhc0uR6jZSah0d5X lm2h30sqW4iIthGwoRWGdYwf7xdyZY0CYm5pnmh41nzyPKHOSt2S8IGT2ViQuufRQAVq u1CYqyPbfqz0OkWYqkM86wFw10x/YoAOFRiGoVB/Uq+39HWJ3SjAt7PfPxthFBc+yoTE +AFw== X-Gm-Message-State: ALKqPwdxOCbQwDVJaFSD62migoXpIg02Rofo3SXACej27tPrjaIjDCUR EI6/Kfz3YYcSL7T0wPC/O1g= X-Google-Smtp-Source: AB8JxZrXc/lm+11iQr5IacNH8IGoWtDxipK+Osp1aS9raxY3ychhY3Zh/VB7tyUS4+N4firORo47wg== X-Received: by 2002:adf:8505:: with SMTP id 5-v6mr3827219wrh.77.1526206445624; Sun, 13 May 2018 03:14:05 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-3195-ed66-b02d-6c9f.holly.idiocy.org. [2001:8b0:3f8:8129:3195:ed66:b02d:6c9f]) by smtp.gmail.com with ESMTPSA id f192-v6sm5140038wmg.14.2018.05.13.03.14.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 May 2018 03:14:04 -0700 (PDT) Content-Disposition: inline In-Reply-To: <034b13c0-b1c0-4340-bfd5-3de34f60322f@Spark> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146145 Archived-At: --2B/JsCI69OhZNC5r Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Please keep the bug tracker Cc’d in. On Fri, May 11, 2018 at 09:31:14PM +0800, Fu Yuan wrote: > I first ran the lisp code and nothing changed. Then I patched source > file and compiled, then ran the lisp code on the compiled emacs. > Nothing different on that Emacs. The UIElementInspecter shows > AXStandardWindow. Of course both time I used “emacs" command with > “-Q" flag. > > Is there anything else I can do? OK, I looked into this a bit further and it seems this stuff is in the accessibility API. I’ve attached a couple of patches, please apply ‘fix redefinition of child frames on NS’, then ‘Set accessibility subroles for child frame’ and see if it does what you expect. This will only work on macOS >= 10.10. I think there must be another way of doing it on older versions but I haven’t found it yet. I’ll see if this works before digging any more. -- Alan Third --2B/JsCI69OhZNC5r Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-redefinition-of-child-frames-on-NS.patch" >From a33d6248a7369fc18111e42b6157a6bf84c5578a Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 13 May 2018 10:33:44 +0100 Subject: [PATCH] Fix redefinition of child frames on NS * src/nsterm.m (x_set_parent_frame): If the NSWindow has an existing parent frame, remove it. --- src/nsterm.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index c8ae31abc0..df883346de 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1958,12 +1958,20 @@ so some key presses (TAB) are swallowed by the system. */ if (p != FRAME_PARENT_FRAME (f)) { - parent = [FRAME_NS_VIEW (p) window]; + block_input (); child = [FRAME_NS_VIEW (f) window]; - block_input (); - [parent addChildWindow: child - ordered: NSWindowAbove]; + if ([child parentWindow] != nil) + [[child parentWindow] removeChildWindow:child]; + + if (!NILP (new_value)) + { + parent = [FRAME_NS_VIEW (p) window]; + + [parent addChildWindow: child + ordered: NSWindowAbove]; + } + unblock_input (); fset_parent_frame (f, new_value); -- 2.16.1 --2B/JsCI69OhZNC5r Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Set-accessibility-subroles-for-child-frame-bug-31324.patch" >From 8f1502d98ed40ba6c750bd6ab48fb7812d3c937e Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 13 May 2018 11:02:00 +0100 Subject: [PATCH] Set accessibility subroles for child frame (bug#31324) ; Depends on patch in bug#31440. * src/nsterm.m (x_set_parent_frame): Set subrole depending on whether frame is a child or not. --- src/nsterm.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/nsterm.m b/src/nsterm.m index df883346de..97682f7a47 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1962,7 +1962,15 @@ so some key presses (TAB) are swallowed by the system. */ child = [FRAME_NS_VIEW (f) window]; if ([child parentWindow] != nil) - [[child parentWindow] removeChildWindow:child]; + { + [[child parentWindow] removeChildWindow:child]; +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 + if ([child respondsToSelector:@selector(setAccessibilitySubrole:)] +#endif + [child setAccessibilitySubrole:NSAccessibilityStandardWindowSubrole]; +#endif + } if (!NILP (new_value)) { @@ -1970,6 +1978,12 @@ so some key presses (TAB) are swallowed by the system. */ [parent addChildWindow: child ordered: NSWindowAbove]; +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 + if ([child respondsToSelector:@selector(setAccessibilitySubrole:)] +#endif + [child setAccessibilitySubrole:NSAccessibilityFloatingWindowSubrole]; +#endif } unblock_input (); -- 2.16.1 --2B/JsCI69OhZNC5r--