Subject: bug#31324: 26.0.91; Wrong AXSubrole of childframe on macOS

From: Alan Third <[email-masked]>
Date: Tue, 1 May 2018 21:37:58 +0100

On Mon, Apr 30, 2018 at 07:46:55PM -0400, Fu Yuan wrote:
> 
> * Symptom
> 
> On macOS, the AXSubrole of a childframe is set to AXStandardWindow. This
> setting causes other applications on the same machine to possible
> interfere Emacs. For example, a windows manager will reposition the
> childframe, as descussed here:
> https://github.com/emacs-lsp/lsp-ui/issues/107#issuecomment-385377352
> 
> In the discussion, koekeishiya suggested to set the attribute to
> kAXDialogSubrole or kAXFloatingWindowSubrole.

Unfortunately those are Carbon attributes and I don’t think we can (or
want to) set them directly.

It looks like the nearest equivalent is the NSWindow level attribute,
which we’re using for z‐groups.

Can you please try the following:

    (let ((frame (selected-frame)))
      (make-frame-command)
      (set-frame-parameter nil 'parent-frame frame)
      (set-frame-parameter nil 'z-group 'above))

and see what the UIElementInspector returns? (I can’t build it as I
don’t have xcode installed.)

If you’re able you could try applying this patch:

1 file changed, 1 insertion(+), 1 deletion(-)
src/nsterm.m | 2 +-

modified   src/nsterm.m
@@ -2028,7 +2028,7 @@ so some key presses (TAB) are swallowed by the system. */
     }
   else if (EQ (new_value, Qabove))
     {
-      window.level = NSNormalWindowLevel + 1;
+      window.level = NSFloatingWindowLevel;
       FRAME_Z_GROUP (f) = z_group_above;
     }
   else if (EQ (new_value, Qabove_suspended))

and run the lisp above again and see if it’s different.

-- 
Alan Third