diff options
author | culler <culler> | 2021-05-01 19:36:55 (GMT) |
---|---|---|
committer | culler <culler> | 2021-05-01 19:36:55 (GMT) |
commit | b0cb1a48cb0c4a0118d45e8804476a6b4ab502c8 (patch) | |
tree | 79b5c3aef21b5d78411c40b8a36fb34042be1b98 | |
parent | a723a9e97cc86c5cbee7c26aca2d344ad18c12a1 (diff) | |
download | tk-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.c | 13 |
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; |