@@ -760,6 +760,17 @@ - (void)drawRect:(NSRect)rect
760
760
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults ];
761
761
const BOOL clipTextToRow = [ud boolForKey: MMRendererClipToRowKey]; // Specify whether to clip tall characters by the row boundary.
762
762
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
+
763
774
NSGraphicsContext *context = [NSGraphicsContext currentContext ];
764
775
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
765
776
CGContextRef ctx = context.CGContext ;
@@ -791,7 +802,14 @@ - (void)drawRect:(NSRect)rect
791
802
const unsigned defaultBg = defaultBackgroundColor.argbInt ;
792
803
CGContextSetFillColor (ctx, COMPONENTS (defaultBg));
793
804
805
+ if (clipBackground) {
806
+ CGContextSaveGState (ctx);
807
+ CGContextClipToRect (ctx, self.bounds );
808
+ }
794
809
CGContextFillRect (ctx, rect);
810
+ if (clipBackground) {
811
+ CGContextRestoreGState (ctx);
812
+ }
795
813
796
814
// Function to draw all rows
797
815
void (^drawAllRows)(void (^)(CGContextRef ,CGRect ,int )) = ^(void (^drawFunc)(CGContextRef ,CGRect ,int )){
0 commit comments