Subject: Re: bug#62234: Toolbar does not work properly (with Emacs 29 or 30)

From: Daniel Martín <[email-masked]>
Date: Sat, 18 Mar 2023 11:25:51 +0100

Po Lu <[email-masked]> writes:

>> +-(BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
>> +{
>> +    return [toolbarItem isEnabled];
>> +}
>> +
>
> This does no harm on GNUstep.  However, please indent with two spaces,
> and place spaces after -, :, and ):
>
> - (BOOL) validateToolbarItem: (NSToolBarItem *) toolbarItem
> {
>   return [toolbarItem isEnabled];
> }
>
> Otherwise, LGTM.  Thanks.

OK, I've attached a new version of the patch.  Konrad, could you check
if with this patch the Emacs toolbar works as you expect?  Thanks.

>From b994036d9475e2ae4f4adea8b3a29eff054e354a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <[email-masked]>
Date: Sat, 18 Mar 2023 01:47:32 +0100
Subject: [PATCH] Fix toolbar item validation in the NS port

* src/nsterm.m ([EmacsView validateToolbarItem:]): Implement this
NSToolbarItemValidation method, which is called by AppKit when it
needs to validate an image item in a toolbar.
---
 src/nsterm.m | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/nsterm.m b/src/nsterm.m
index 0e75cbf3f0f..46007ec4fcb 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8573,6 +8573,10 @@ - (instancetype)toolbarClicked: (id)item
   return self;
 }
 
+- (BOOL) validateToolbarItem: (NSToolbarItem *) toolbarItem
+{
+  return [toolbarItem isEnabled];
+}
 
 - (instancetype)toggleToolbar: (id)sender
 {
-- 
2.34.1