--- macosx/tkMacOSXWindowEvent.c.orig 2025-07-26 14:20:28.000000000 +0100 +++ macosx/tkMacOSXWindowEvent.c 2025-07-26 14:24:11.000000000 +0100 @@ -977,8 +977,11 @@ self.layer = [CALayer layer]; self.wantsLayer = YES; self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawOnSetNeedsDisplay; - self.layer.contentsGravity = self.layer.contentsAreFlipped ? - kCAGravityTopLeft : kCAGravityBottomLeft; + if (self.layer.contentsAreFlipped) { + self.layer.contentsGravity = kCAGravityTopLeft; + } else { + self.layer.contentsGravity = kCAGravityBottomLeft; + } /* * Nothing gets drawn at all if the layer does not have a delegate.