From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#48162: 28.0.50; Resizing using set-frame-width doesn't expand mode-line Date: Sun, 2 May 2021 22:49:40 +0100 Message-ID: References: <0a6dc056-4950-0c3b-0d0a-733cc0ecddab@gmx.at> <28c3ab57-5735-58fb-8008-dbb1b57c88f6@gmx.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fmLIXedQg4WM4ty2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2391"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pankaj@codeisgreat.org, 48162@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 02 23:50:11 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 1ldJyc-0000Ut-Is for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 23:50:10 +0200 Original-Received: from localhost ([::1]:47764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldJyb-0004UU-Ll for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 17:50:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldJyU-0004UJ-Bi for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 17:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldJyU-0006Cz-4m for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 17:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldJyU-0003OV-39 for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 17:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2021 21:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48162 X-GNU-PR-Package: emacs Original-Received: via spool by 48162-submit@debbugs.gnu.org id=B48162.161999219413037 (code B ref 48162); Sun, 02 May 2021 21:50:02 +0000 Original-Received: (at 48162) by debbugs.gnu.org; 2 May 2021 21:49:54 +0000 Original-Received: from localhost ([127.0.0.1]:44944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldJyM-0003Nn-Ej for submit@debbugs.gnu.org; Sun, 02 May 2021 17:49:54 -0400 Original-Received: from outbound.soverin.net ([116.202.65.218]:56391) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldJyK-0003Ng-Ux for 48162@debbugs.gnu.org; Sun, 02 May 2021 17:49:53 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 9816760109; Sun, 2 May 2021 21:49:46 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1619992185; bh=cRfuSMVXFxxl4/GGQbUyG/kaUidx5yuoPc+aNPL4jYY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U1qflXA/n2Q9ewV9jgjgUy4PqPb6n6Rj4rfQwQ1nJBdF4mqzDl5mOH6pA82M7G4E7 obeQFdAa4sI+nbNK5V+ZDRVehHg2mYjik5RjG/v7ZbhYAXtAdKl+f5g8ggwpLtb77k j862zZFiUL/THUKvIgpB/ghKOgY5qUZXQfox4VwlFuKqttTJdV50EquFh5hx4oPKg4 YvRRJneZI3QtKkHgtQRT5Lh1udRV5Le6p36vkHsshGAoWxwv7WldZqdyEpOFNsjCSR WS/tbDNGiIuyMstGbmahjkFElk6H8IHtFNCk0OXtf/CK3clcFeVeUQN7MPkZWwutHp kAdFdahgdqLTA== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.94) (envelope-from ) id 1ldJy8-0005Bx-O0; Sun, 02 May 2021 22:49:40 +0100 Mail-Followup-To: Alan Third , martin rudalics , 48162@debbugs.gnu.org, pankaj@codeisgreat.org Content-Disposition: inline In-Reply-To: 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:205453 Archived-At: --fmLIXedQg4WM4ty2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, May 02, 2021 at 09:19:20PM +0200, martin rudalics wrote: > > Perhaps it just needs to look like this? > > > > if ((oldh == newh && oldw == neww) > > || (newh == emacsframe->new_height > > && neww == emacsframe->new_width)) > > > > This is hard, because I can't replicate either of the reported bugs > > and I suspect my reasoning is very off here. > > I think I understand now: When Emacs is busy it cannot set oldh and oldw > immediately so oldh == newh && oldw == neww will continue to fail and we > cannot return. How about something like the below? I think the attached works. I finally managed to reproduce the bug and realised that the offscreen buffer's size doesn't really have anything to do with what Emacs thinks the frame size is, so I've separated its resizing code out. Your suggested code for dealing with the Emacs frame size appears to work right without any crashes on GNUstep too, so I've included it. Now I just need to work out why using the menus causes GNUstep builds to crash and we might have a semi-usable port again. ;) -- Alan Third --fmLIXedQg4WM4ty2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-incorrect-resizing-behaviour-on-macOS-bug-48157-.patch" >From c4048b3cd6841a7f2ccdfb3f6c880c9ee176390a Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 2 May 2021 22:38:13 +0100 Subject: [PATCH] Fix incorrect resizing behaviour on macOS (bug#48157, bug#48162) * src/nsterm.m ([EmacsView viewDidResize:]): The drawing buffer can be resized independently of Emacs's idea of the frame size. Co-authored-by: martin rudalics --- src/nsterm.m | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 6e7ab1266b..bb20886ab1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7303,16 +7303,34 @@ - (void)viewDidResize:(NSNotification *)notification NSTRACE ("[EmacsView viewDidResize]"); +#ifdef NS_DRAW_TO_BUFFER + /* If the buffer size doesn't match the view's backing size, destroy + the buffer and let it be recreated at the correct size later. */ + if ([self wantsUpdateLayer] && surface) + { + NSRect surfaceRect = {{0, 0}, [surface getSize]}; + NSRect frameRect = [[self window] convertRectToBacking:frame]; + + if (!NSEqualRects (frameRect, surfaceRect)) + { + [surface release]; + surface = nil; + + [self setNeedsDisplay:YES]; + } + } +#endif + neww = (int)NSWidth (frame); newh = (int)NSHeight (frame); oldw = FRAME_PIXEL_WIDTH (emacsframe); oldh = FRAME_PIXEL_HEIGHT (emacsframe); /* Don't want to do anything when the view size hasn't changed. */ - if ((oldh == newh && oldw == neww) - || (emacsframe->new_size_p - && newh == emacsframe->new_height - && neww == emacsframe->new_width)) + if (emacsframe->new_size_p + ? (newh == emacsframe->new_height + && neww == emacsframe->new_width) + : (oldh == newh && oldw == neww)) { NSTRACE_MSG ("No change"); return; @@ -7321,16 +7339,6 @@ - (void)viewDidResize:(NSNotification *)notification NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); -#ifdef NS_DRAW_TO_BUFFER - if ([self wantsUpdateLayer]) - { - [surface release]; - surface = nil; - - [self setNeedsDisplay:YES]; - } -#endif - change_frame_size (emacsframe, neww, newh, false, YES, false); SET_FRAME_GARBAGED (emacsframe); -- 2.30.2 --fmLIXedQg4WM4ty2--