unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: "Kirill A. Korinsky" <kirill@korins.ky>
Cc: 50534@debbugs.gnu.org
Subject: bug#50534: 28.0.50; Toolbar shows despite tool-bar-mode being disabled on macOS
Date: Sun, 12 Sep 2021 16:44:50 +0100	[thread overview]
Message-ID: <YT4gcnOORYdZ1jll@idiocy.org> (raw)
In-Reply-To: <FD485898-5EE1-428B-8D7D-BB361CD56FA8@korins.ky>

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

On Sun, Sep 12, 2021 at 02:54:09PM +0200, Kirill A. Korinsky wrote:
> I've tried to apply suggested patch to local 192a384408cc846d8e66e91a67cd9ad4e7f0be24 and it doesn't help.

Please try this patch.
-- 
Alan Third

[-- Attachment #2: v2-0001-Fix-incorrectly-appearing-toolbar-on-NS-bug-50534.patch --]
[-- Type: text/x-diff, Size: 3139 bytes --]

From 70dbd0c9db782d15e0036f27db13a5ed8d9bba0b Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 12 Sep 2021 12:42:11 +0100
Subject: [PATCH v2] Fix incorrectly appearing toolbar on NS (bug#50534)

* src/nsterm.h (FRAME_TOOLBAR_P): Work out whether the frame should
have a toolbar or not.
* src/nsterm.m (ns_update_begin):
([EmacsView windowDidEnterFullScreen]):
([EmacsView windowDidExitFullScreen]): Use new FRAME_TOOLBAR_P instead
of the apparently unreliable FRAME_EXTERNAL_TOOL_BAR.
* src/nsmenu.m (update_frame_tool_bar): Use new FRAME_TOOLBAR_P.
---
 src/nsmenu.m | 4 ++--
 src/nsterm.h | 3 +++
 src/nsterm.m | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 0d0b2f60c9..08d4fb830e 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1090,10 +1090,10 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
 #undef TOOLPROP
     }
 
-  if ([toolbar isVisible] != FRAME_EXTERNAL_TOOL_BAR (f))
+  if ([toolbar isVisible] != FRAME_TOOLBAR_P (f))
     {
       f->output_data.ns->in_animation = 1;
-      [toolbar setVisible: FRAME_EXTERNAL_TOOL_BAR (f)];
+      [toolbar setVisible: FRAME_TOOLBAR_P (f)];
       f->output_data.ns->in_animation = 0;
     }
 
diff --git a/src/nsterm.h b/src/nsterm.h
index 8640b97d8a..4739fe6d1c 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1044,6 +1044,9 @@ #define FIRST_CHAR_POSITION(f)				\
   (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0	\
    : FRAME_SCROLL_BAR_COLS (f))
 
+#define FRAME_TOOLBAR_P(f) (FRAME_EXTERNAL_TOOL_BAR (f)		\
+			    && FRAME_TOOL_BAR_LINES (f) > 0)
+
 extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
 extern void ns_term_shutdown (int sig);
 
diff --git a/src/nsterm.m b/src/nsterm.m
index f8b8c1e574..9f129be29c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1038,7 +1038,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
   if ([view isFullscreen] && [view fsIsNative])
   {
     // Fix reappearing tool bar in fullscreen for Mac OS X 10.7
-    BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (f) ? YES : NO;
+    BOOL tbar_visible = FRAME_TOOLBAR_P (f);
     NSToolbar *toolbar = [[FRAME_NS_VIEW (f) window] toolbar];
     if (! tbar_visible != ! [toolbar isVisible])
       [toolbar setVisible: tbar_visible];
@@ -7328,7 +7328,7 @@ - (void)windowDidEnterFullScreen /* provided for direct calls */
     }
   else
     {
-      BOOL tbar_visible = FRAME_EXTERNAL_TOOL_BAR (emacsframe) ? YES : NO;
+      BOOL tbar_visible = FRAME_TOOLBAR_P (emacsframe);
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 \
   && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
       unsigned val = (unsigned)[NSApp presentationOptions];
@@ -7387,7 +7387,7 @@ - (void)windowDidExitFullScreen /* provided for direct calls */
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
   [self updateCollectionBehavior];
 #endif
-  if (FRAME_EXTERNAL_TOOL_BAR (emacsframe))
+  if (FRAME_TOOLBAR_P (emacsframe))
     {
       [[[self window] toolbar] setVisible:YES];
       update_frame_tool_bar (emacsframe);
-- 
2.30.2


  parent reply	other threads:[~2021-09-12 15:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12  0:29 bug#50534: 28.0.50; Toolbar shows despite tool-bar-mode being disabled on macOS Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] ` <handler.50534.B.16314065846903.ack@debbugs.gnu.org>
2021-09-12  9:25   ` bug#50534: Acknowledgement (28.0.50; Toolbar shows despite tool-bar-mode being disabled on macOS) Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-12 11:48 ` bug#50534: 28.0.50; Toolbar shows despite tool-bar-mode being disabled on macOS Alan Third
2021-09-12 12:54   ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-12 15:33     ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-12 15:44     ` Alan Third [this message]
2021-09-12 16:40       ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-12 19:43         ` Alan Third
2021-09-12 19:52           ` Alan Third
2021-09-12 20:14             ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-12 20:35               ` Alan Third
2021-09-12 21:02                 ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:44                   ` Alan Third
2021-09-13 18:52                     ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:54                       ` Alan Third
2021-09-13 18:57                         ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 19:11                           ` Alan Third
2021-09-13 20:42                             ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 22:21                               ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 23:25                                 ` Alan Third
2021-09-14  0:05                                   ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14  9:21                                     ` Alan Third
2021-09-14 11:26                                       ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 12:13                                         ` Alan Third
2021-09-14 12:54                                           ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 14:17                                           ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 14:35                                             ` Alan Third
2021-09-14 14:43                                               ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-17 17:26                                               ` Alan Third
2021-09-26 10:56                                                 ` Alan Third
2021-09-26 16:23                                                   ` Mattias Engdegård
2021-09-27 10:10                                                     ` Alan Third
2021-09-28 19:00                                                       ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-28 19:14                                                         ` Alan Third
2021-09-29 10:53                                                           ` Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 16:07                                         ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=YT4gcnOORYdZ1jll@idiocy.org \
    --to=alan@idiocy.org \
    --cc=50534@debbugs.gnu.org \
    --cc=kirill@korins.ky \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).