[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/ns/surface-stuff 6bf7625 3/4: Make the NS buffer copy happen bef
From: |
Alan Third |
Subject: |
scratch/ns/surface-stuff 6bf7625 3/4: Make the NS buffer copy happen before we need it |
Date: |
Mon, 31 May 2021 12:14:53 -0400 (EDT) |
branch: scratch/ns/surface-stuff
commit 6bf76258161ca724a87fab2066c1c862ee61cf88
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>
Make the NS buffer copy happen before we need it
* src/nsterm.m ([EmacsView viewWillDraw]): Move releaseContext to
updateLayer.
([EmacsView updateLayer]): Send a request for getContext, which will
copy the buffer and create the context if it doesn't already exist, to
the NS run loop.
---
src/nsterm.m | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index 6b6ad0c..f616824 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8482,8 +8482,6 @@ not_in_argv (NSString *arg)
unblock_input ();
waiting_for_input = owfi;
}
-
- [surface releaseContext];
}
@@ -8515,7 +8513,11 @@ not_in_argv (NSString *arg)
There's a private method, -[CALayer setContentsChanged], that we
could use to force it, but we shouldn't often get the same
surface twice in a row. */
+ [surface releaseContext];
[[self layer] setContents:(id)[surface getSurface]];
+ [surface performSelectorOnMainThread:@selector (getContext)
+ withObject:nil
+ waitUntilDone:NO];
}
#endif