summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2021-05-01 19:36:55 (GMT)
committerculler <culler>2021-05-01 19:36:55 (GMT)
commitb0cb1a48cb0c4a0118d45e8804476a6b4ab502c8 (patch)
tree79b5c3aef21b5d78411c40b8a36fb34042be1b98
parenta723a9e97cc86c5cbee7c26aca2d344ad18c12a1 (diff)
downloadtk-b0cb1a48cb0c4a0118d45e8804476a6b4ab502c8.zip
tk-b0cb1a48cb0c4a0118d45e8804476a6b4ab502c8.tar.gz
tk-b0cb1a48cb0c4a0118d45e8804476a6b4ab502c8.tar.bz2
Fix [eafa029f3a]: blurry text on retina screens when using backing CALayer. Sets the layer.contentsScale to equal the backingScaleFactor of the screen where its view is being displayed.
-rw-r--r--macosx/tkMacOSXWindowEvent.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index f7a160a..c4b8c07 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -948,6 +948,19 @@ ConfigureRestrictProc(
return NO;
}
+- (void) viewDidChangeBackingProperties
+{
+
+ /*
+ * Make sure that the layer uses a contentScale that matches the
+ * backing scale factor of the screen. This avoids blurry text whe
+ * the view is on a Retina display, as well as incorrect size when
+ * the view is on a normal display.
+ */
+
+ self.layer.contentsScale = self.window.screen.backingScaleFactor;
+}
+
- (void) addTkDirtyRect: (NSRect) rect
{
_tkNeedsDisplay = YES;