From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Kirill A. Korinsky" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50534: 28.0.50; Toolbar shows despite tool-bar-mode being disabled on macOS Date: Tue, 14 Sep 2021 00:21:27 +0200 Message-ID: References: <1F1BB95A-CCD9-4602-9CBB-0539D311B438@korins.ky> <63382A54-A99A-45DD-9527-F1DF742ABEEB@korins.ky> <43E37DDD-8314-4A12-8111-A7C48F625BD7@korins.ky> Reply-To: "Kirill A. Korinsky" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: multipart/signed; boundary="Apple-Mail=_5C89989F-F0E9-46FE-A2A2-AD07C38B2FE5"; protocol="application/pgp-signature"; micalg=pgp-sha512 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20452"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50534@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 14 00:22:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPuLF-00058Z-Js for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Sep 2021 00:22:21 +0200 Original-Received: from localhost ([::1]:45874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPuLE-0002Jn-5i for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Sep 2021 18:22:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPuKw-0002Ja-QS for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 18:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPuKw-0000TQ-Gz for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 18:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPuKw-0003Me-95 for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2021 18:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Kirill A. Korinsky" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Sep 2021 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50534 X-GNU-PR-Package: emacs Original-Received: via spool by 50534-submit@debbugs.gnu.org id=B50534.163157170112904 (code B ref 50534); Mon, 13 Sep 2021 22:22:02 +0000 Original-Received: (at 50534) by debbugs.gnu.org; 13 Sep 2021 22:21:41 +0000 Original-Received: from localhost ([127.0.0.1]:47031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPuKa-0003M3-LD for submit@debbugs.gnu.org; Mon, 13 Sep 2021 18:21:40 -0400 Original-Received: from sender4-op-o12.zoho.com ([136.143.188.12]:17217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPuKZ-0003Lv-5h for 50534@debbugs.gnu.org; Mon, 13 Sep 2021 18:21:40 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1631571695; cv=none; d=zohomail.com; s=zohoarc; b=Ymxenb74OQ9H8mYIfjsSNvZuMNXTzaTOtp37Qwgpa3LI2QwPmDyJmEir+rmy/j8rmtSL4/G6RQ/39UzxWrMRN7Y1F2xeWD71jc8+l3ssyR9X16RkmQ9inft/5Vj0Yvv/qQKbHKpqJcrvsHaqV+udDyukKwrkF/yv/SIyKwema3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631571695; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=UnBHFVAKY+HqUmn+NXfS/LtNx7/us57ZTs1OdSFASn0=; b=nED4IuKxYex6gCaFAVuQBErcET6lKSZvGZDpj1J+BF3K+27V63rSEsXdUtBZ0YWObADbRtnzO/9F9icvtiL6T6FjQorPGupU8cxJlOTMmETWNBtIuvTotm7SZ/Q3MbJN74musgSsopHnGAaZqnC+e934UFH0DK6mlRFAcBhEYsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=korins.ky; spf=pass smtp.mailfrom=kirill@korins.ky; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1631571695; s=april2018zoho; d=korins.ky; i=kirill@korins.ky; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Message-Id:References:To; bh=UnBHFVAKY+HqUmn+NXfS/LtNx7/us57ZTs1OdSFASn0=; b=BfI0q6nYohzaJRn/fNtprRBDCteJeruGcJOOVM+qj53q5YRgGXnHuHzJ21fLMFBE hZwSXeQ6WkXKwRuU7/s7ZV3sBwngdV2P3bhYfAYoJ2HtPM3B1P6X3/uVLIE9UJwOQUA 8QtF5RBRFrs7egqutfPGCW7chteTnnBfx8vNa32g= Original-Received: from smtpclient.apple (sa31.catap.net [90.187.54.213]) by mx.zohomail.com with SMTPS id 1631571691923666.686929887285; Mon, 13 Sep 2021 15:21:31 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Zoho-Virus-Status: 1 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214268 Archived-At: --Apple-Mail=_5C89989F-F0E9-46FE-A2A2-AD07C38B2FE5 Content-Type: multipart/alternative; boundary="Apple-Mail=_8201D922-D9B7-4E34-B79A-482D155235EE" --Apple-Mail=_8201D922-D9B7-4E34-B79A-482D155235EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Maybe it can be for some use. I've attached the minimal patch which fixed issue for me. This patch reverted some of your changes. Because when I move to full screen =3D> toolbar is dissapear, I feel = that the root cause is replacing layoutSublayersOfLayer to layout. Anyway, I don't know quartz and I can't minimize it future. -- wbr, Kirill > On 13. Sep 2021, at 22:42, Kirill A. Korinsky = wrote: >=20 > Same. >=20 > -- > wbr, Kirill >=20 >> On 13. Sep 2021, at 21:11, Alan Third > wrote: >>=20 >> On Mon, Sep 13, 2021 at 08:57:12PM +0200, Kirill A. Korinsky via Bug = reports for GNU Emacs, the Swiss army knife of text editors wrote: >>> Nope, toolbar exists >>=20 >> Please try the attached patch. >> -- >> Alan Third >> >=20 --Apple-Mail=_8201D922-D9B7-4E34-B79A-482D155235EE Content-Type: multipart/mixed; boundary="Apple-Mail=_3E0672CE-0F32-48EA-A10E-1B34487A41C6" --Apple-Mail=_3E0672CE-0F32-48EA-A10E-1B34487A41C6 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii Maybe it can be for some use.

I've attached the minimal patch which fixed issue for me.

This patch reverted some of your changes.

Because when I move to full screen => toolbar is dissapear, I feel that the root cause is replacing layoutSublayersOfLayer to layout.

Anyway, I don't know quartz and I can't minimize it future.

-- 
wbr, Kirill

--Apple-Mail=_3E0672CE-0F32-48EA-A10E-1B34487A41C6 Content-Disposition: attachment; filename=worckaround-bug-50534.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="worckaround-bug-50534.diff" Content-Transfer-Encoding: 7bit index 8d88f7bd3d..2ee502fa99 100644 --- src/nsterm.m +++ src/nsterm.m @@ -6956,6 +6956,43 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize } +- (void)windowDidResize: (NSNotification *)notification +{ + NSTRACE ("[EmacsView windowDidResize:]"); + if (!FRAME_LIVE_P (emacsframe)) + { + NSTRACE_MSG ("Ignored (frame dead)"); + return; + } + if (emacsframe->output_data.ns->in_animation) + { + NSTRACE_MSG ("Ignored (in animation)"); + return; + } + + if (! [self fsIsNative]) + { + NSWindow *theWindow = [notification object]; + /* We can get notification on the non-FS window when in + fullscreen mode. */ + if ([self window] != theWindow) return; + } + + NSTRACE_RECT ("frame", [[notification object] frame]); + +#ifdef NS_IMPL_GNUSTEP + NSWindow *theWindow = [notification object]; + + /* In GNUstep, at least currently, it's possible to get a didResize + without getting a willResize, therefore we need to act as if we got + the willResize now. */ + NSSize sz = [theWindow frame].size; + sz = [self windowWillResize: theWindow toSize: sz]; +#endif /* NS_IMPL_GNUSTEP */ + + ns_send_appdefined (-1); +} + #ifdef NS_IMPL_COCOA - (void)viewDidEndLiveResize { @@ -6973,30 +7010,38 @@ - (void)viewDidEndLiveResize #endif /* NS_IMPL_COCOA */ -- (void)resizeWithOldSuperviewSize: (NSSize)oldSize +- (void)viewDidResize:(NSNotification *)notification { - NSRect frame; - int width, height; - - NSTRACE ("[EmacsView resizeWithOldSuperviewSize:]"); - - [super resizeWithOldSuperviewSize:oldSize]; + NSRect frame = [self frame]; + int neww, newh, oldw, oldh; if (! FRAME_LIVE_P (emacsframe)) return; - frame = [self frame]; - width = (int)NSWidth (frame); - height = (int)NSHeight (frame); + NSTRACE ("[EmacsView viewDidResize]"); + + neww = (int)NSWidth (frame); + newh = (int)NSHeight (frame); + oldw = FRAME_PIXEL_WIDTH (emacsframe); + oldh = FRAME_PIXEL_HEIGHT (emacsframe); - NSTRACE_SIZE ("New size", NSMakeSize (width, height)); - NSTRACE_SIZE ("Original size", size); + /* Don't want to do anything when the view size hasn't changed. */ + if (emacsframe->new_size_p + ? (newh == emacsframe->new_height + && neww == emacsframe->new_width) + : (oldh == newh && oldw == neww)) + { + NSTRACE_MSG ("No change"); + return; + } - change_frame_size (emacsframe, width, height, false, YES, false); + NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); + NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); + + change_frame_size (emacsframe, neww, newh, false, YES, false); SET_FRAME_GARBAGED (emacsframe); cancel_mouse_face (emacsframe); - ns_send_appdefined (-1); } @@ -7132,7 +7177,7 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f /* These settings mean AppKit will retain the contents of the frame on resize. Unfortunately it also means the frame will not be automatically marked for display, but we can do that ourselves in - resizeWithOldSuperviewSize. */ + viewDidResize. */ [self setWantsLayer:YES]; [self setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawOnSetNeedsDisplay]; @@ -7152,6 +7197,13 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f [NSApp registerServicesMenuSendTypes: ns_send_types returnTypes: [NSArray array]]; + /* Set up view resize notifications. */ + [self setPostsFrameChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector (viewDidResize:) + name:NSViewFrameDidChangeNotification object:nil]; + ns_window_num++; return self; } @@ -7938,28 +7990,24 @@ - (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect redisplay before drawing. This used to be done in viewWillDraw, but with the custom layer - that method is not called. We cannot call redisplay directly from - [NSView layout], because it may trigger another round of layout by - changing the frame size and recursive layout calls are banned. It - appears to be safe to call redisplay here. */ -- (void)layoutSublayersOfLayer:(CALayer *)layer -{ - if (!redisplaying_p && FRAME_GARBAGED_P (emacsframe)) - { - /* If there is IO going on when redisplay is run here Emacs - crashes. I think it's because this code will always be run - within the run loop and for whatever reason processing input - is dangerous. This technique was stolen wholesale from - nsmenu.m and seems to work. */ - bool owfi = waiting_for_input; - waiting_for_input = 0; - block_input (); + that method is not called. */ +- (void)layout +{ + [super layout]; + + /* If there is IO going on when redisplay is run here Emacs + crashes. I think it's because this code will always be run + within the run loop and for whatever reason processing input + is dangerous. This technique was stolen wholesale from + nsmenu.m and seems to work. */ + bool owfi = waiting_for_input; + waiting_for_input = 0; + block_input (); - redisplay (); + redisplay (); - unblock_input (); - waiting_for_input = owfi; - } + unblock_input (); + waiting_for_input = owfi; } #endif --Apple-Mail=_3E0672CE-0F32-48EA-A10E-1B34487A41C6 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii

On 13. Sep 2021, at 22:42, Kirill A. Korinsky <kirill@korins.ky> wrote:

Same.

-- 
wbr, Kirill

On 13. Sep 2021, at 21:11, Alan Third <alan@idiocy.org> wrote:

On Mon, Sep 13, 2021 at 08:57:12PM +0200, Kirill A. Korinsky via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
Nope, toolbar exists

Please try the attached patch.
--
Alan Third
<v3-0001-Fix-incorrectly-appearing-toolbar-on-NS-bug-50534.patch>


--Apple-Mail=_3E0672CE-0F32-48EA-A10E-1B34487A41C6-- --Apple-Mail=_8201D922-D9B7-4E34-B79A-482D155235EE-- --Apple-Mail=_5C89989F-F0E9-46FE-A2A2-AD07C38B2FE5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE3/KLNtcfWfLw7JxqmNjZhndZIm4FAmE/zucACgkQmNjZhndZ Im6w9A//cujkBrmxB9HIc8M8sCDA12Vr3i2jjOUeITfH+vjj27nA9SyV7AMMceZ2 +Nqi9GL5nK3zsAohc9YmMAcw+knIBaQ5hT6bklWeKKZIwU47eZQjNtINIOjEt0HS QBI2fLZKBPj4V+X7OS+8NkAchwQ9R9hQvTYWvrTiIO0tNskhF0NonN5ATJFX2274 Cl7kaeOePe6qxpi7V4aR1rcietNAYI2ImNCWMQ9EwCkwXNVm9UobbWwQsfyNUqOX M9+sEzDQNqO9jwkEFRecmsUzkRnUEU+B7V2b7ox/4K0hsWgaCiBypr4AF4PbdCiC qyFW/4pemweQoAKsqX9rmr25f2iMne/1GB3shv4b/RqTNxE9m5GiZvYi/5k1qvVk qstz/ynjYJAnJc+PckbFzMSBz5i66vJepCR8sbFC+RkGArRZC+j7UGkvCRi950PA FACtcsiKbbeH7XJw8WO0HcFs7Kwo8+cjiVsGs9C4TDBsl7W/vgVb2cAgZuxZSbQQ GJu6Ti6Xe/7qhaeyblB6wbVcBaPY2TvU1MjmcvUhH7FcXCRRR5LGcMl5xa+3tN36 7R6/QKGMZJbWTsaPP8dYZejJsS1wFYB28sSK7+pbVA31fsCCQLlihivaAyxW/mz3 e1U5AgsvqgajJj7AnCAVBangpxgNAeg9WqM4GSncocdMueexLXA= =JHvN -----END PGP SIGNATURE----- --Apple-Mail=_5C89989F-F0E9-46FE-A2A2-AD07C38B2FE5--