diff options
| author | Alan Third | 2021-05-01 17:50:25 +0100 |
|---|---|---|
| committer | Alan Third | 2021-05-01 19:13:07 +0100 |
| commit | 6b2d017ead856c244a0b5c5a162254094877bc54 (patch) | |
| tree | d550d8314d31caad578caccf33c06a7bf5a7b50e /src | |
| parent | a65eb23f5cbf1ff408585574e4c95a9eebf2a9dc (diff) | |
| download | emacs-6b2d017ead856c244a0b5c5a162254094877bc54.tar.gz emacs-6b2d017ead856c244a0b5c5a162254094877bc54.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index b135e359f5d..f2d03967f90 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -7296,7 +7296,7 @@ not_in_argv (NSString *arg) | |||
| 7296 | - (void)viewDidResize:(NSNotification *)notification | 7296 | - (void)viewDidResize:(NSNotification *)notification |
| 7297 | { | 7297 | { |
| 7298 | NSRect frame = [self frame]; | 7298 | NSRect frame = [self frame]; |
| 7299 | int neww, newh; | 7299 | int neww, newh, oldw, oldh; |
| 7300 | 7300 | ||
| 7301 | if (! FRAME_LIVE_P (emacsframe)) | 7301 | if (! FRAME_LIVE_P (emacsframe)) |
| 7302 | return; | 7302 | return; |
| @@ -7305,25 +7305,22 @@ not_in_argv (NSString *arg) | |||
| 7305 | 7305 | ||
| 7306 | neww = (int)NSWidth (frame); | 7306 | neww = (int)NSWidth (frame); |
| 7307 | newh = (int)NSHeight (frame); | 7307 | newh = (int)NSHeight (frame); |
| 7308 | oldw = FRAME_PIXEL_WIDTH (emacsframe); | ||
| 7309 | oldh = FRAME_PIXEL_HEIGHT (emacsframe); | ||
| 7310 | |||
| 7308 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); | 7311 | NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); |
| 7312 | NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); | ||
| 7313 | |||
| 7314 | /* Don't want to do anything when the view size hasn't changed. */ | ||
| 7315 | if (oldh == newh && oldw == neww) | ||
| 7316 | { | ||
| 7317 | NSTRACE_MSG ("No change"); | ||
| 7318 | return; | ||
| 7319 | } | ||
| 7309 | 7320 | ||
| 7310 | #ifdef NS_DRAW_TO_BUFFER | 7321 | #ifdef NS_DRAW_TO_BUFFER |
| 7311 | if ([self wantsUpdateLayer]) | 7322 | if ([self wantsUpdateLayer]) |
| 7312 | { | 7323 | { |
| 7313 | CGFloat scale = [[self window] backingScaleFactor]; | ||
| 7314 | NSSize size = [surface getSize]; | ||
| 7315 | int oldw = size.width / scale; | ||
| 7316 | int oldh = size.height / scale; | ||
| 7317 | |||
| 7318 | NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); | ||
| 7319 | |||
| 7320 | /* Don't want to do anything when the view size hasn't changed. */ | ||
| 7321 | if ((oldh == newh && oldw == neww)) | ||
| 7322 | { | ||
| 7323 | NSTRACE_MSG ("No change"); | ||
| 7324 | return; | ||
| 7325 | } | ||
| 7326 | |||
| 7327 | [surface release]; | 7324 | [surface release]; |
| 7328 | surface = nil; | 7325 | surface = nil; |
| 7329 | 7326 | ||
| @@ -7331,10 +7328,6 @@ not_in_argv (NSString *arg) | |||
| 7331 | } | 7328 | } |
| 7332 | #endif | 7329 | #endif |
| 7333 | 7330 | ||
| 7334 | /* I'm not sure if it's safe to call this every time the view | ||
| 7335 | changes size, as Emacs may already know about the change. | ||
| 7336 | Unfortunately there doesn't seem to be a bullet-proof method of | ||
| 7337 | determining whether we need to call it or not. */ | ||
| 7338 | change_frame_size (emacsframe, neww, newh, false, YES, false); | 7331 | change_frame_size (emacsframe, neww, newh, false, YES, false); |
| 7339 | 7332 | ||
| 7340 | SET_FRAME_GARBAGED (emacsframe); | 7333 | SET_FRAME_GARBAGED (emacsframe); |