@@ -760,6 +760,17 @@ - (void)drawRect:(NSRect)rect
760760 NSUserDefaults *ud = [NSUserDefaults standardUserDefaults ];
761761 const BOOL clipTextToRow = [ud boolForKey: MMRendererClipToRowKey]; // Specify whether to clip tall characters by the row boundary.
762762
763+
764+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0
765+ // On macOS 14+ by default views don't clip their content, which is good as it allows tall texts
766+ // on first line to be drawn fully without getting clipped. However, in this case we should make
767+ // sure the background color fill is clipped properly, as otherwise it will interfere with
768+ // non-native fullscreen's background color setting.
769+ const BOOL clipBackground = !self.clipsToBounds ;
770+ #else
771+ const BOOL clipBackground = NO ;
772+ #endif
773+
763774 NSGraphicsContext *context = [NSGraphicsContext currentContext ];
764775#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
765776 CGContextRef ctx = context.CGContext ;
@@ -791,7 +802,14 @@ - (void)drawRect:(NSRect)rect
791802 const unsigned defaultBg = defaultBackgroundColor.argbInt ;
792803 CGContextSetFillColor (ctx, COMPONENTS (defaultBg));
793804
805+ if (clipBackground) {
806+ CGContextSaveGState (ctx);
807+ CGContextClipToRect (ctx, self.bounds );
808+ }
794809 CGContextFillRect (ctx, rect);
810+ if (clipBackground) {
811+ CGContextRestoreGState (ctx);
812+ }
795813
796814 // Function to draw all rows
797815 void (^drawAllRows)(void (^)(CGContextRef,CGRect,int )) = ^(void (^drawFunc)(CGContextRef,CGRect,int )){
0 commit comments