From bf6fd4abe583b7a0f2f339c7b9e762d4399e4991 Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Sun, 12 Apr 2026 12:45:35 +0200 Subject: [PATCH] macOS: add `focusDidChange` & `sizeDidChange` placeholders to `OSSurfaceView` --- macos/Sources/Ghostty/Surface View/OSSurfaceView.swift | 6 ++++++ macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift | 4 ++-- macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift index de71dc997..0a26425a6 100644 --- a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift @@ -91,6 +91,12 @@ extension Ghostty { self?.highlighted = false } } + + // MARK: - Placeholders + + func focusDidChange(_ focused: Bool) {} + + func sizeDidChange(_ size: CGSize) {} } } diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index db8f02494..ce754db9e 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -389,7 +389,7 @@ extension Ghostty { progressReportTimer?.invalidate() } - func focusDidChange(_ focused: Bool) { + override func focusDidChange(_ focused: Bool) { guard let surface = self.surface else { return } guard self.focused != focused else { return } self.focused = focused @@ -426,7 +426,7 @@ extension Ghostty { } } - func sizeDidChange(_ size: CGSize) { + override func sizeDidChange(_ size: CGSize) { // Ghostty wants to know the actual framebuffer size... It is very important // here that we use "size" and NOT the view frame. If we're in the middle of // an animation (i.e. a fullscreen animation), the frame will not yet be updated. diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift index a4a643bb1..6c1480b4e 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift @@ -45,7 +45,7 @@ extension Ghostty { ghostty_surface_free(surface) } - func focusDidChange(_ focused: Bool) { + override func focusDidChange(_ focused: Bool) { guard let surface = self.surface else { return } ghostty_surface_set_focus(surface, focused) @@ -55,7 +55,7 @@ extension Ghostty { } } - func sizeDidChange(_ size: CGSize) { + override func sizeDidChange(_ size: CGSize) { guard let surface = self.surface else { return } // Ghostty wants to know the actual framebuffer size... It is very important