#endif
+/* macOS 10.14 and above cannot draw directly "to the glass" and
+ therefore we draw to an offscreen buffer and swap it in when the
+ toolkit wants to draw the frame. GNUstep and macOS 10.7 and below
+ do not support this method, so we revert to drawing directly to the
+ glass.
+
+ FIXME: Should we make this macOS 10.8+, or macOS 10.14+? I'm
+ inclined to go with 10.14+ as there have been some reports of funny
+ behaviour on 10.13 and below. It may be worth adding a variable to
+ allow people in the overlapping region to switch between drawing
+ paths. */
+#if defined (NS_IMPL_COCOA) && defined (MAC_OS_X_VERSION_10_14)
+#define NS_DRAW_TO_BUFFER 1
+#endif
+
+
/* ==========================================================================
NSColor, EmacsColor category.
int maximized_width, maximized_height;
NSWindow *nonfs_window;
BOOL fs_is_native;
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
CGContextRef drawingBuffer;
#endif
@public
#endif
- (int)fullscreenState;
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
- (void)focusOnDrawingBuffer;
+- (void)createDrawingBuffer;
#endif
- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect;
-- (void)createDrawingBuffer;
/* Non-notification versions of NSView methods. Used for direct calls. */
- (void)windowWillEnterFullScreen;
#endif
ns_updating_frame = f;
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
[view focusOnDrawingBuffer];
#else
[view lockFocus];
/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
MOUSE_HL_INFO (f)->mouse_face_defer = 0;
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
[NSGraphicsContext setCurrentContext:nil];
#else
block_input ();
}
if (f != ns_updating_frame)
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
[view focusOnDrawingBuffer];
#else
{
from non-native fullscreen, in other circumstances it appears
to be a noop. (bug#28872) */
wr = NSMakeRect (0, 0, neww, newh);
- [self createDrawingBuffer];
[view setFrame: wr];
+#ifdef NS_DRAW_TO_BUFFER
+ [self createDrawingBuffer];
+#endif
// To do: consider using [NSNotificationCenter postNotificationName:].
[self windowDidMove: // Update top/left.
maximizing_resize = NO;
#endif
+#ifdef NS_DRAW_TO_BUFFER
[self createDrawingBuffer];
+#endif
win = [[EmacsWindow alloc]
initWithContentRect: r
}
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
- (void)createDrawingBuffer
/* Create and store a new CGGraphicsContext for Emacs to draw into.
expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
}
}
-#endif /* NS_IMPL_COCOA */
+#endif /* NS_DRAW_TO_BUFFER */
- (void)copyRect:(NSRect)srcRect to:(NSRect)dstRect
NSTRACE_RECT ("Source", srcRect);
NSTRACE_RECT ("Destination", dstRect);
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
CGImageRef copy;
NSRect frame = [self frame];
NSAffineTransform *setOrigin = [NSAffineTransform transform];
}
-#ifdef NS_IMPL_COCOA
+#ifdef NS_DRAW_TO_BUFFER
- (BOOL)wantsUpdateLayer
{
return YES;