Repository navigation
Fix spinner hang after display resolution changes #1549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8573,6 +8573,23 @@ struct GhosttyTerminalView: NSViewRepresentable { | |
| return !hostedViewHasSuperview | ||
| } | ||
|
|
||
| private static func synchronizePortalGeometry( | ||
| for host: HostContainerView, | ||
| coordinator: Coordinator | ||
| ) { | ||
| let geometryRevision = host.geometryRevision | ||
| guard coordinator.lastSynchronizedHostGeometryRevision != geometryRevision else { return } | ||
| coordinator.lastSynchronizedHostGeometryRevision = geometryRevision | ||
| if host.inLiveResize || host.window?.inLiveResize == true { | ||
| TerminalWindowPortalRegistry.synchronizeForAnchor(host) | ||
| return | ||
| } | ||
| // Avoid synchronizing the terminal portal while AppKit is still inside | ||
| // the current layout turn. Re-entrant syncs here can wedge window resize | ||
| // handling and leave the app spinning on the wait cursor. | ||
| TerminalWindowPortalRegistry.scheduleExternalGeometrySynchronizeForAllWindows() | ||
|
Comment on lines
+8582
to
+8590
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| func makeNSView(context: Context) -> NSView { | ||
| let container = HostContainerView() | ||
| container.wantsLayer = false | ||
|
|
@@ -8732,8 +8749,10 @@ struct GhosttyTerminalView: NSViewRepresentable { | |
| hostedView.setActive(coordinator.desiredIsActive) | ||
| hostedView.setNotificationRing(visible: coordinator.desiredShowsUnreadNotificationRing) | ||
| } | ||
| TerminalWindowPortalRegistry.synchronizeForAnchor(host) | ||
| coordinator.lastSynchronizedHostGeometryRevision = host.geometryRevision | ||
| Self.synchronizePortalGeometry( | ||
| for: host, | ||
| coordinator: coordinator | ||
| ) | ||
| } | ||
|
|
||
| if host.window != nil, hostOwnsPortalNow { | ||
|
|
@@ -8768,8 +8787,10 @@ struct GhosttyTerminalView: NSViewRepresentable { | |
| coordinator.lastBoundHostId = hostId | ||
| coordinator.lastSynchronizedHostGeometryRevision = geometryRevision | ||
| } else if coordinator.lastSynchronizedHostGeometryRevision != geometryRevision { | ||
| TerminalWindowPortalRegistry.synchronizeForAnchor(host) | ||
| coordinator.lastSynchronizedHostGeometryRevision = geometryRevision | ||
| Self.synchronizePortalGeometry( | ||
| for: host, | ||
| coordinator: coordinator | ||
| ) | ||
| } | ||
| } else if hostOwnsPortalNow { | ||
| // Bind is deferred until host moves into a window. Update the | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid immediate portal synchronization during live-resize churn
Line 8584 still calls the immediate
synchronizeForAnchorpath during live resize. That can re-enter AppKit layout/resize work and reintroduce the spinner-hang path this PR is targeting.💡 Proposed fix
🤖 Prompt for AI Agents