aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nsterm.m33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 26cc9486141..f6e16035ea5 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7454,6 +7454,15 @@ not_in_argv (NSString *arg)
7454 [self initWithFrame: r]; 7454 [self initWithFrame: r];
7455 [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; 7455 [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
7456 7456
7457 /* These settings mean AppKit will retain the contents of the frame
7458 on resize. Unfortunately it also means the frame will not be
7459 automatically marked for display, but we can do that ourselves in
7460 viewDidResize. */
7461 [self setWantsLayer:YES];
7462 [self setLayerContentsRedrawPolicy:
7463 NSViewLayerContentsRedrawOnSetNeedsDisplay];
7464 [self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft];
7465
7457 FRAME_NS_VIEW (f) = self; 7466 FRAME_NS_VIEW (f) = self;
7458 emacsframe = f; 7467 emacsframe = f;
7459#ifdef NS_IMPL_COCOA 7468#ifdef NS_IMPL_COCOA
@@ -8254,10 +8263,23 @@ not_in_argv (NSString *arg)
8254 8263
8255- (void)viewWillDraw 8264- (void)viewWillDraw
8256{ 8265{
8257 /* If the frame has been garbaged there's no point in redrawing 8266 if (FRAME_GARBAGED_P (emacsframe)
8258 anything. */ 8267 && !redisplaying_p)
8259 if (FRAME_GARBAGED_P (emacsframe)) 8268 {
8260 [self setNeedsDisplay:NO]; 8269 /* If there is IO going on when redisplay is run here Emacs
8270 crashes. I think it's because this code will always be run
8271 within the run loop and for whatever reason processing input
8272 is dangerous. This technique was stolen wholesale from
8273 nsmenu.m and seems to work. */
8274 bool owfi = waiting_for_input;
8275 waiting_for_input = 0;
8276 block_input ();
8277
8278 redisplay ();
8279
8280 unblock_input ();
8281 waiting_for_input = owfi;
8282 }
8261} 8283}
8262 8284
8263- (void)drawRect: (NSRect)rect 8285- (void)drawRect: (NSRect)rect
@@ -8268,7 +8290,8 @@ not_in_argv (NSString *arg)
8268 NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]", 8290 NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
8269 NSTRACE_ARG_RECT(rect)); 8291 NSTRACE_ARG_RECT(rect));
8270 8292
8271 if (!emacsframe || !emacsframe->output_data.ns) 8293 if (!emacsframe || !emacsframe->output_data.ns
8294 || FRAME_GARBAGED_P (emacsframe))
8272 return; 8295 return;
8273 8296
8274 block_input (); 8297 block_input ();