From 9c898b0ca61c090e5e327f750f6c73e28475e10b Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Fri, 12 Jun 2026 19:30:19 +0800
Subject: [PATCH] Fix space filter visual and close verification
---
C1.source/Sources/Aligner/QuickSwitchSessionController.swift | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/C1.source/Sources/Aligner/QuickSwitchSessionController.swift b/C1.source/Sources/Aligner/QuickSwitchSessionController.swift
index 03e9501..947b96e 100644
--- a/C1.source/Sources/Aligner/QuickSwitchSessionController.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchSessionController.swift
@@ -19,6 +19,7 @@
private let windowCloseService: any WindowCloseServiceProtocol
private let systemCriticalWindowDetector: any SystemCriticalWindowDetecting
private let disableScreenshotRefresh: Bool
+ private var waterfallViewMode: QuickSwitchWaterfallViewMode
private var closeConfirmationRequired: Bool
private let onCloseConfirmationDisabled: (() -> Void)?
private let debugOverlayWidth: CGFloat?
@@ -85,6 +86,7 @@
private var lifecycleResidualOverlayWindows = 0
private var lifecycleResidualVisibleOverlayWindows = 0
var onSnapshotUpdated: (() -> Void)?
+ var onOpenSettings: (() -> Void)?
private struct PendingCloseVerification {
let request: QuickSwitchCloseRequest
@@ -120,6 +122,7 @@
),
systemCriticalWindowDetector: any SystemCriticalWindowDetecting = CGWindowSystemCriticalWindowDetector(),
disableScreenshotRefresh: Bool = false,
+ waterfallViewMode: QuickSwitchWaterfallViewMode = .verticalColumns,
closeConfirmationRequired: Bool = true,
onCloseConfirmationDisabled: (() -> Void)? = nil,
debugHoveredAppGroupIndex: Int? = nil,
@@ -135,6 +138,7 @@
self.windowCloseService = windowCloseService
self.systemCriticalWindowDetector = systemCriticalWindowDetector
self.disableScreenshotRefresh = disableScreenshotRefresh
+ self.waterfallViewMode = waterfallViewMode
self.closeConfirmationRequired = closeConfirmationRequired
self.onCloseConfirmationDisabled = onCloseConfirmationDisabled
self.debugOverlayWidth = debugOverlayWidth
@@ -209,6 +213,9 @@
view.onBackgroundClick = { [weak self] in
self?.handleBackgroundClick() ?? false
}
+ view.onOpenSettings = { [weak self] in
+ self?.onOpenSettings?()
+ }
view.setSuppressEventInput(!debugMouseSequence.isEmpty || !debugKeySequence.isEmpty)
view.onRequestClose = { [weak self] request in
self?.requestClose(request)
@@ -219,6 +226,7 @@
self.onCloseConfirmationDisabled?()
}
view.setCloseConfirmationRequired(closeConfirmationRequired)
+ view.setWaterfallViewMode(waterfallViewMode)
view.apply(viewModel: nil)
view.beginPerformanceFirstFrameMeasurement()
coordinator.openQuickSwitch()
@@ -273,6 +281,23 @@
func retriggerFromShortcut() {
DevelopmentDiagnostics.log("quickSwitch.session.retriggerFromShortcut")
show()
+ }
+
+ func setWaterfallViewMode(_ mode: QuickSwitchWaterfallViewMode) {
+ guard waterfallViewMode != mode else { return }
+
+ waterfallViewMode = mode
+ DevelopmentDiagnostics.log("quickSwitch.session.waterfallViewModeChanged", [
+ "mode": mode.rawValue,
+ "visible": isVisible,
+ "hasViewModel": currentViewModel != nil
+ ])
+
+ view.setWaterfallViewMode(mode)
+ if isVisible, let currentViewModel {
+ view.applyProjected(viewModel: currentViewModel)
+ }
+ onSnapshotUpdated?()
}
func reportDictionary() -> [String: Any] {
@@ -819,12 +844,12 @@
"result": Self.closeResultString(result)
])
if result == .requested {
- suppressCloseTarget(request)
DevelopmentDiagnostics.log("quickSwitch.close.request.refreshAfterClose", [
"targetKind": request.kindDescription,
"appGroupIndex": request.appGroupIndex,
"appName": request.appName,
- "windowID": request.windowID
+ "windowID": request.windowID,
+ "optimisticRemove": false
])
pendingCloseVerification = PendingCloseVerification(
request: request,
@@ -1461,6 +1486,7 @@
let debugWindowActivation: Bool
let debugWindowClose: Bool
let disableScreenshotRefresh: Bool
+ let waterfallViewMode: QuickSwitchWaterfallViewMode?
let lifecycleCycles: Int?
let lifecycleInterval: TimeInterval
let lifecycleVisibleDuration: TimeInterval
@@ -1488,6 +1514,7 @@
debugWindowActivation: arguments.contains("--round01-debug-window-activation"),
debugWindowClose: arguments.contains("--round01-debug-window-close"),
disableScreenshotRefresh: arguments.contains("--round01-disable-screenshot-refresh"),
+ waterfallViewMode: waterfallViewModeValue(for: "--round01-waterfall-view-mode", in: arguments),
lifecycleCycles: intValue(for: "--round01-quick-switch-lifecycle-cycles", in: arguments),
lifecycleInterval: timeInterval(for: "--round01-quick-switch-lifecycle-interval", in: arguments) ?? 0.02,
lifecycleVisibleDuration: timeInterval(for: "--round01-quick-switch-lifecycle-visible-duration", in: arguments) ?? 0.16
@@ -1512,6 +1539,22 @@
return String(argument.dropFirst(prefix.count))
}
+ private static func waterfallViewModeValue(
+ for key: String,
+ in arguments: [String]
+ ) -> QuickSwitchWaterfallViewMode? {
+ guard let value = stringValue(for: key, in: arguments) else { return nil }
+
+ switch value {
+ case "vertical", "vertical-columns", "verticalColumns":
+ return .verticalColumns
+ case "horizontal", "horizontal-masonry", "horizontalMasonry":
+ return .horizontalMasonry
+ default:
+ return nil
+ }
+ }
+
private static func intValue(for key: String, in arguments: [String]) -> Int? {
stringValue(for: key, in: arguments).flatMap(Int.init)
}
--
Gitblit v1.9.3