mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-25 06:18:37 +00:00
macOS: fix render_thread "stuck" after dragging surface to another tab within the same window
The reason the thread is stuck is because the surface's occlusion state is set to invisible after target tab's activate while dragging, since the dragged surface is still in previous tree before dropping, and after dropping the occlusion state of this surface is not updated to visible, which causing the surface is accepting input but not rendering.
This commit is contained in:
@@ -292,6 +292,7 @@ class BaseTerminalController: NSWindowController,
|
||||
if to.isEmpty {
|
||||
focusedSurface = nil
|
||||
}
|
||||
syncSurfaceTreeOcclusionState()
|
||||
}
|
||||
|
||||
/// Update all surfaces with the focus state. This ensures that libghostty has an accurate view about
|
||||
@@ -1256,10 +1257,15 @@ class BaseTerminalController: NSWindowController,
|
||||
}
|
||||
|
||||
func windowDidChangeOcclusionState(_ notification: Notification) {
|
||||
syncSurfaceTreeOcclusionState()
|
||||
}
|
||||
|
||||
private func syncSurfaceTreeOcclusionState() {
|
||||
let visible = self.window?.occlusionState.contains(.visible) ?? false
|
||||
for view in surfaceTree {
|
||||
if let surface = view.surface {
|
||||
if let surface = view.surface, view.isWindowVisible != visible {
|
||||
ghostty_surface_set_occlusion(surface, visible)
|
||||
view.isWindowVisible = visible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ extension Ghostty {
|
||||
// Whether the cursor is currently visible (not hidden by typing, etc.)
|
||||
@Published private(set) var cursorVisible: Bool = true
|
||||
|
||||
/// Whether the belonging window is visible
|
||||
///
|
||||
/// We track this to restore surface occlusion state
|
||||
/// after this surface is dragged to another window
|
||||
var isWindowVisible = false
|
||||
|
||||
/// The configuration derived from the Ghostty config so we don't need to rely on references.
|
||||
@Published private(set) var derivedConfig: DerivedConfig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user