From 53ac0aa975f24831c16f5bdff7fe44ada5da31c1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 23 Dec 2024 13:01:37 -0800 Subject: [PATCH] macos: update content scale whenever the screen changes Related to #2731 I'm not fully sure if this will fix this issue since I can't reproduce it but I don't see a downside to doing this and it might fix it. --- macos/Sources/Ghostty/SurfaceView_AppKit.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macos/Sources/Ghostty/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/SurfaceView_AppKit.swift index 14f2a43c8c..5576515e3d 100644 --- a/macos/Sources/Ghostty/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/SurfaceView_AppKit.swift @@ -409,6 +409,11 @@ extension Ghostty { // ID. If vsync is enabled, this will be used with the CVDisplayLink to ensure // the proper refresh rate is going. ghostty_surface_set_display_id(surface, screen.displayID ?? 0) + + // We also just trigger a backing property change. Just in case the screen has + // a different scaling factor, this ensures that we update our content scale. + // Issue: https://github.com/ghostty-org/ghostty/issues/2731 + viewDidChangeBackingProperties() } // MARK: - NSView