[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 9a90aeae07d 1/2: Merge remote-tracking branch 'origin/ma
From: |
Po Lu |
Subject: |
feature/android 9a90aeae07d 1/2: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Sun, 7 May 2023 20:36:39 -0400 (EDT) |
branch: feature/android
commit 9a90aeae07d1954aa1d1e626d1b5b1ce35a4c981
Merge: 889b61b9991 3adc1e7f379
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
src/nsterm.m | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index ecbf80ff72d..b9e3cbf81a1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7930,6 +7930,10 @@ ns_in_echo_area (void)
[self setLayerContentsRedrawPolicy:
NSViewLayerContentsRedrawOnSetNeedsDisplay];
[self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft];
+
+ /* initWithEmacsFrame can't create the toolbar before the layer is
+ set, so have another go at creating the toolbar here. */
+ [(EmacsWindow*)[self window] createToolbar:f];
#endif
if (ns_drag_types)
@@ -9174,11 +9178,18 @@ ns_in_echo_area (void)
- (void)createToolbar: (struct frame *)f
{
- if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f))
+ if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f) || [self toolbar]
!= nil)
return;
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+ /* If the view's layer isn't an EmacsLayer then we can't create the
+ toolbar yet. */
+ if (! [[view layer] isKindOfClass:[EmacsLayer class]])
+ return;
+#endif
+
EmacsToolbar *toolbar = [[EmacsToolbar alloc]
initForView:view
withIdentifier:[NSString stringWithFormat:@"%p",
f]];