[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/ns/refactor 6cbbfa0 6/8: Fix macOS live resize drawing
From: |
Alan Third |
Subject: |
scratch/ns/refactor 6cbbfa0 6/8: Fix macOS live resize drawing |
Date: |
Sat, 12 Jun 2021 16:48:53 -0400 (EDT) |
branch: scratch/ns/refactor
commit 6cbbfa08844eb7b683f4c5614851bf567e981b06
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>
Fix macOS live resize drawing
* src/nsterm.m ([EmacsView layout]):
([EmacsView layoutSublayersOfLayer:]): Rename layout to
layoutSublayersOfLayer.
---
src/nsterm.m | 41 +++++++++++++++++++++++++----------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index ae97112..19e5d3c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8145,24 +8145,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
- branch scratch/ns/refactor created (now 06aa958), Alan Third, 2021/06/12
- scratch/ns/refactor f77cdc1 1/8: Simplify macOS drawing code, Alan Third, 2021/06/12
- scratch/ns/refactor 17c9369 2/8: Fix GNUstep build warnings, Alan Third, 2021/06/12
- scratch/ns/refactor 7d71f37 3/8: Tidy up NS port OS window handling, Alan Third, 2021/06/12
- scratch/ns/refactor 27df712 4/8: Change NS port resize detection, Alan Third, 2021/06/12
- scratch/ns/refactor f766a85 5/8: Fix GNUstep menu update crashes, Alan Third, 2021/06/12
- scratch/ns/refactor 6cbbfa0 6/8: Fix macOS live resize drawing,
Alan Third <=
- scratch/ns/refactor 13dd79a 7/8: Move NS port toolbar handling to the window, Alan Third, 2021/06/12
- scratch/ns/refactor 06aa958 8/8: Move parent frame setting code into EmacsWindow, Alan Third, 2021/06/12