emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6b2d017 2/2: Fix infinite loop on GNUstep when toolbar updated


From: Alan Third
Subject: master 6b2d017 2/2: Fix infinite loop on GNUstep when toolbar updated
Date: Sat, 1 May 2021 14:14:05 -0400 (EDT)

branch: master
commit 6b2d017ead856c244a0b5c5a162254094877bc54
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    Fix infinite loop on GNUstep when toolbar updated
    
    * src/nsterm.m ([EmacsView viewDidResize:]): Use Emacs's existing
    knowledge of the frame size to decide whether to resize or not.
---
 src/nsterm.m | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index b135e35..f2d0396 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7296,7 +7296,7 @@ not_in_argv (NSString *arg)
 - (void)viewDidResize:(NSNotification *)notification
 {
   NSRect frame = [self frame];
-  int neww, newh;
+  int neww, newh, oldw, oldh;
 
   if (! FRAME_LIVE_P (emacsframe))
     return;
@@ -7305,25 +7305,22 @@ not_in_argv (NSString *arg)
 
   neww = (int)NSWidth (frame);
   newh = (int)NSHeight (frame);
+  oldw = FRAME_PIXEL_WIDTH (emacsframe);
+  oldh = FRAME_PIXEL_HEIGHT (emacsframe);
+
   NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
+  NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
+
+  /* Don't want to do anything when the view size hasn't changed. */
+  if (oldh == newh && oldw == neww)
+    {
+      NSTRACE_MSG ("No change");
+      return;
+    }
 
 #ifdef NS_DRAW_TO_BUFFER
   if ([self wantsUpdateLayer])
     {
-      CGFloat scale = [[self window] backingScaleFactor];
-      NSSize size = [surface getSize];
-      int oldw = size.width / scale;
-      int oldh = size.height / scale;
-
-      NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh));
-
-      /* Don't want to do anything when the view size hasn't changed. */
-      if ((oldh == newh && oldw == neww))
-        {
-          NSTRACE_MSG ("No change");
-          return;
-        }
-
       [surface release];
       surface = nil;
 
@@ -7331,10 +7328,6 @@ not_in_argv (NSString *arg)
     }
 #endif
 
-  /* I'm not sure if it's safe to call this every time the view
-     changes size, as Emacs may already know about the change.
-     Unfortunately there doesn't seem to be a bullet-proof method of
-     determining whether we need to call it or not.  */
   change_frame_size (emacsframe, neww, newh, false, YES, false);
 
   SET_FRAME_GARBAGED (emacsframe);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]