all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Fu Yuan <casouri@gmail.com>
Cc: 31324@debbugs.gnu.org
Subject: bug#31324: 26.0.91; Wrong AXSubrole of childframe on macOS
Date: Sun, 13 May 2018 11:14:02 +0100	[thread overview]
Message-ID: <20180513101402.GB15823@breton.holly.idiocy.org> (raw)
In-Reply-To: <034b13c0-b1c0-4340-bfd5-3de34f60322f@Spark>

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

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

[-- Attachment #2: 0001-Fix-redefinition-of-child-frames-on-NS.patch --]
[-- Type: text/plain, Size: 1222 bytes --]

From a33d6248a7369fc18111e42b6157a6bf84c5578a Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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


[-- Attachment #3: 0001-Set-accessibility-subroles-for-child-frame-bug-31324.patch --]
[-- Type: text/plain, Size: 1707 bytes --]

From 8f1502d98ed40ba6c750bd6ab48fb7812d3c937e Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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


  parent reply	other threads:[~2018-05-13 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <58a8e0b4-311c-4aa4-a5f1-f968ca93b6d3@Spark>
2018-05-01 20:37 ` bug#31324: 26.0.91; Wrong AXSubrole of childframe on macOS Alan Third
     [not found]   ` <034b13c0-b1c0-4340-bfd5-3de34f60322f@Spark>
2018-05-13 10:14     ` Alan Third [this message]
2018-05-13 10:17       ` Fu Yuan
2018-05-13 10:33         ` Alan Third
2018-05-20  6:33           ` Fu Yuan
2018-05-22 19:40             ` Alan Third
2018-05-23  2:27               ` Eli Zaretskii
2018-06-03 19:35                 ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180513101402.GB15823@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=31324@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.