Subject: bug#69525: 30.0.50; MacOS: New warnings on stderr

From: Gerd Möllmann <[email-masked]>
Date: Fri, 26 Jul 2024 11:56:21 +0200

Gerd Möllmann <[email-masked]> writes:

> The following warnings are printed to stderr, which I haven't seen
> previously. Maybe canBecomeKeyWindow should be implemented?
>
> 2024-03-03 17:10:16.334906+0100 emacs[12805:61381] [Window] Warning: -[NSWindow makeKeyWindow] called on EmacsWindow 0x7f7d90a34030 which returned NO from -[NSWindow canBecomeKeyWindow].
> 2024-03-03 17:10:35.434255+0100 emacs[12805:61381] [CursorUI] -[TUINSCursorUIController activate:]: EmacsView doesn't conform to NSTextInputClient protocol.
> 2024-03-03 17:10:37.073109+0100 emacs[12805:61381] [Window] Warning: -[NSWindow makeKeyWindow] called on EmacsWindow 0x7f7d90a34030 which returned NO from -[NSWindow canBecomeKeyWindow].
> 2024-03-03 17:13:19.141805+0100 emacs[12805:61381] [CursorUI] -[TUINSCursorUIController activate:]: EmacsView doesn't conform to NSTextInputClient protocol.
>
> In GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin23.3.0, NS
>  appkit-2487.40 Version 14.3.1 (Build 23D60)) of 2024-03-01 built on
>  Pro.fritz.box
> Repository revision: 862dfef88d8e62d12bac3ca2e44e035a2ff5b298
> Repository branch: master
> Windowing system distributor 'Apple', version 10.3.2487
> System Description:  macOS 14.3.1

The attached patch fixes this for me, and seems logical.

>From c447ae1512cb274b5f7d47ffe479520c12392c67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <[email-masked]>
Date: Fri, 26 Jul 2024 11:48:24 +0200
Subject: [PATCH] NS: prevent makeKeyWindow warnings (bug#69525)

* src/nsterm.m (ns_raise_frame): Don't makeKeyWindow if frame has
no_accept_focus set.
---
 src/nsterm.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index b9193f62e80..cd6ffabddde 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1413,7 +1413,7 @@ -(void)remove
   block_input ();
   if (FRAME_VISIBLE_P (f))
     {
-      if (make_key)
+      if (make_key && !f->no_accept_focus)
         [[view window] makeKeyAndOrderFront: NSApp];
       else
         [[view window] orderFront: NSApp];
-- 
2.45.2