From 6983a4ed2137bf1a8377e5d1cf82183e02e617f8 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 13 Jun 2026 14:08:17 +0800
Subject: [PATCH] Fix multi-page targeting and split view tile QA

---
 C1.source/Sources/Aligner/QuickSwitchRootView.swift |   45 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index 4ea3319..3d16422 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -3087,13 +3087,16 @@
 
     private func layoutSpaceLaneSegmentContents(_ segment: SpaceLaneSegmentLayers) {
         let bounds = segment.containerLayer.bounds
+        let splitAppNames = splitViewAppNames(for: segment.space)
+        let isSplitView = splitAppNames.count >= 2
         segment.labelLayer.frame = CGRect(x: 10, y: bounds.height - 29, width: max(1, bounds.width - 48), height: 20)
         segment.countLayer.frame = CGRect(x: bounds.width - 34, y: bounds.height - 29, width: 24, height: 20)
+        segment.countLayer.string = isSplitView ? "" : "\(segment.space.windowCount)"
+        segment.countLayer.isHidden = isSplitView
         if segment.space.type == .fullscreen {
             let markerFrame = fullscreenMarkerFrame(in: bounds)
-            let splitAppNames = splitViewAppNames(for: segment.space)
-            segment.appLayer.isHidden = splitAppNames.count >= 2
-            if splitAppNames.count >= 2 {
+            segment.appLayer.isHidden = isSplitView
+            if isSplitView {
                 let labelY = markerFrame.midY - 8.5
                 let halfWidth = markerFrame.width / 2
                 for (index, splitAppLayer) in segment.splitAppLayers.enumerated() {
@@ -3128,7 +3131,7 @@
             layoutFullscreenMarkerLayer(
                 fullscreenMarkerLayer,
                 in: bounds,
-                isSplitView: splitViewAppNames(for: segment.space).count >= 2
+                isSplitView: isSplitView
             )
         }
 
@@ -4740,17 +4743,11 @@
 
         let bounds = shapeLayer.bounds
         if isSplitView {
-            let insetBounds = bounds.insetBy(dx: 0.6, dy: 0.6)
-            let radius = min(7, max(5, insetBounds.height * 0.22))
             let path = CGMutablePath()
-            path.addRoundedRect(
-                in: insetBounds,
-                cornerWidth: radius,
-                cornerHeight: radius
-            )
-            path.move(to: CGPoint(x: bounds.midX, y: insetBounds.minY + 1.5))
-            path.addLine(to: CGPoint(x: bounds.midX, y: insetBounds.maxY - 1.5))
+            path.move(to: CGPoint(x: bounds.midX, y: bounds.minY))
+            path.addLine(to: CGPoint(x: bounds.midX, y: bounds.maxY))
             shapeLayer.path = path
+            shapeLayer.lineCap = .butt
             return
         }
 
@@ -4774,6 +4771,7 @@
         path.addLine(to: CGPoint(x: 0, y: bounds.maxY - cornerLength))
 
         shapeLayer.path = path
+        shapeLayer.lineCap = .round
     }
 
     private func fullscreenMarkerFrame(in segmentBounds: CGRect) -> CGRect {
@@ -5176,6 +5174,10 @@
                         markerLayer: segment.fullscreenMarkerLayer,
                         splitAppNames: splitAppNames
                     ),
+                    "fullscreenMarkerPathStyle": fullscreenMarkerPathStyle(
+                        markerLayer: segment.fullscreenMarkerLayer,
+                        splitAppNames: splitAppNames
+                    ),
                     "fullscreenMarkerFrame": fullscreenMarkerFrame.map { dictionary(from: $0) } ?? NSNull(),
                     "fullscreenMarkerCenterRatio": fullscreenMarkerCenterRatio ?? NSNull(),
                     "splitViewAppNames": splitAppNames,
@@ -5187,6 +5189,8 @@
                     "windowBlockColors": segment.windowBlocks.map { colorDictionary(from: $0.backgroundColor) },
                     "windowBlockFrames": segment.windowBlocks.map { dictionary(from: $0.frame) },
                     "labelColor": colorDictionary(from: segment.labelLayer.foregroundColor),
+                    "countText": string(from: segment.countLayer.string),
+                    "countVisible": !segment.countLayer.isHidden && segment.countLayer.opacity > 0,
                     "countColor": colorDictionary(from: segment.countLayer.foregroundColor),
                     "appColor": colorDictionary(from: segment.appLayer.foregroundColor),
                     "fullscreenMarkerStrokeColor": colorDictionary(
@@ -5229,6 +5233,11 @@
     private func fullscreenMarkerKind(markerLayer: CALayer?, splitAppNames: [String]) -> String {
         guard markerLayer != nil else { return "none" }
         return splitAppNames.count >= 2 ? "splitViewPair" : "cornerBracket"
+    }
+
+    private func fullscreenMarkerPathStyle(markerLayer: CALayer?, splitAppNames: [String]) -> String {
+        guard markerLayer != nil else { return "none" }
+        return splitAppNames.count >= 2 ? "centerDividerOnly" : "cornerBracket"
     }
 
     private func visualStates(for space: QuickSwitchSpaceViewModel) -> [String] {
@@ -5282,6 +5291,16 @@
         ]
     }
 
+    private func string(from textLayerValue: Any?) -> String {
+        if let string = textLayerValue as? String {
+            return string
+        }
+        if let attributedString = textLayerValue as? NSAttributedString {
+            return attributedString.string
+        }
+        return ""
+    }
+
     private func colorDictionary(from color: CGColor?) -> [String: Double] {
         guard let color,
               let nsColor = NSColor(cgColor: color)?.usingColorSpace(.deviceRGB)

--
Gitblit v1.9.3