summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2021-06-12 10:25:47 +0100
committerAlan Third <alan@idiocy.org>2021-07-31 11:13:05 +0100
commit1ba02d85a964e1b2c6a9735cd3decdc524e06dc1 (patch)
tree8afa9b753aba88e993a0bc4ed5fa088c1a2d9243
parent960f3fc589d8d021e1ed1a505e660929e4c13d0a (diff)
downloademacs-1ba02d85a964e1b2c6a9735cd3decdc524e06dc1.tar.gz
emacs-1ba02d85a964e1b2c6a9735cd3decdc524e06dc1.tar.bz2
emacs-1ba02d85a964e1b2c6a9735cd3decdc524e06dc1.zip
Fix macOS live resize drawing
* src/nsterm.m ([EmacsView layout]): ([EmacsView layoutSublayersOfLayer:]): Rename layout to layoutSublayersOfLayer.
-rw-r--r--src/nsterm.m41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index a005c4e8139..b8b306e685a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8040,24 +8040,33 @@ not_in_argv (NSString *arg)
redisplay before drawing.
This used to be done in viewWillDraw, but with the custom layer
- 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 ();
+ 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.
- redisplay ();
+ FIXME: I can't provoke a crash using layoutSublayersOfLayer,
+ however I can't understand why it would be different from
+ viewWillDraw. I'll leave this commented out for now, but if
+ nobody reports a crash it can be removed. */
+ // bool owfi = waiting_for_input;
+ // waiting_for_input = 0;
+ // block_input ();
- unblock_input ();
- waiting_for_input = owfi;
+ redisplay ();
+
+ // unblock_input ();
+ // waiting_for_input = owfi;
+ }
}
#endif