From b02c7cd28f1c48c5380bb5e3f839bdfb7615f25f Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 30 May 2026 17:41:59 +0800
Subject: [PATCH] Show more languages in preferences

---
 Apptag/AppGridCollectionView.swift |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/Apptag/AppGridCollectionView.swift b/Apptag/AppGridCollectionView.swift
index 3516782..54a218b 100644
--- a/Apptag/AppGridCollectionView.swift
+++ b/Apptag/AppGridCollectionView.swift
@@ -158,7 +158,6 @@
                 iconSize: iconSize,
                 showNames: showNames,
                 showUncommonAppBubbles: showUncommonAppBubbles,
-                highlightedGroupName: highlightedGroupName,
                 contentRevision: contentRevision
             )
             if nextSignature != contentSignature {
@@ -235,7 +234,6 @@
             iconSize: CGFloat,
             showNames: Bool,
             showUncommonAppBubbles: Bool,
-            highlightedGroupName: String?,
             contentRevision: Int
         ) -> String {
             let colorPart = tagColors
@@ -247,7 +245,6 @@
                 "\(Int(iconSize.rounded()))",
                 showNames ? "names" : "nonames",
                 showUncommonAppBubbles ? "uncommon" : "allbubbles",
-                highlightedGroupName ?? "",
                 colorPart,
                 "rev=\(contentRevision)"
             ].joined(separator: "|")
@@ -255,9 +252,19 @@
     }
 }
 
+private final class AppGridScrollView: NSScrollView {
+    override var acceptsFirstResponder: Bool { true }
+
+    override func scrollWheel(with event: NSEvent) {
+        window?.makeKeyAndOrderFront(nil)
+        window?.orderFrontRegardless()
+        super.scrollWheel(with: event)
+    }
+}
+
 final class AppGridCollectionHostView: NSView, AppEmptyDropReceivingView {
     private let emptyDropTargetID = UUID()
-    private let scrollView = NSScrollView()
+    private let scrollView = AppGridScrollView()
     private let collectionView = NSCollectionView()
     private let gridLayout = AppGridContainerCollectionLayout()
     private weak var coordinator: AppGridCollectionView.Coordinator?
@@ -265,6 +272,7 @@
     private var lastLayoutSize: NSSize = .zero
     private var lastReportedBoundsOrigin: NSPoint?
     private var scrollUnfreezeWorkItem: DispatchWorkItem?
+    private var scrollActivityIsActive = false
 
     override var isFlipped: Bool { true }
 
@@ -378,14 +386,18 @@
     }
 
     private func handleScrollActivity() {
-        if coordinator?.setScrollBubbleDisabled(true) == true {
-            refreshVisibleRuntimeState()
+        if !scrollActivityIsActive {
+            scrollActivityIsActive = true
+            if coordinator?.setScrollBubbleDisabled(true) == true {
+                refreshVisibleRuntimeState()
+            }
+            coordinator?.onScrollActivity()
         }
-        coordinator?.onScrollActivity()
 
         scrollUnfreezeWorkItem?.cancel()
         let workItem = DispatchWorkItem { [weak self] in
             guard let self else { return }
+            self.scrollActivityIsActive = false
             self.replayPointerHover()
             if self.coordinator?.setScrollBubbleDisabled(false) == true {
                 self.refreshVisibleRuntimeState()
@@ -951,8 +963,9 @@
         guard let coordinator, let group else { return }
         let displayStyle = coordinator.displayStyle
         let tagColor = TagColor.nsColor(for: coordinator.tagColors[group.name] ?? 0)
+        let isNavigationHighlighted = coordinator.highlightedGroupName == group.name
         let isColorlessActive = coordinator.isColorlessContainerMode
-            && (isHovered || coordinator.highlightedGroupName == group.name)
+            && (isHovered || isNavigationHighlighted)
 
         if displayStyle.usesCardSurface {
             let rect = bounds.insetBy(dx: 0.5, dy: 0.5)
@@ -1033,10 +1046,11 @@
 
     private func updateCardShadow() {
         guard let coordinator else { return }
+        let isNavigationHighlighted = coordinator.highlightedGroupName == group?.name
         let isColorlessActive = coordinator.isColorlessContainerMode
-            && (isHovered || coordinator.highlightedGroupName == group?.name)
+            && (isHovered || isNavigationHighlighted)
         let shouldShadow = coordinator.displayStyle.usesCardSurface
-            && ((coordinator.isColoredContainerMode && isHovered) || isColorlessActive)
+            && ((coordinator.isColoredContainerMode && (isHovered || isNavigationHighlighted)) || isColorlessActive)
         layer?.shadowColor = NSColor.black.cgColor
         layer?.shadowOpacity = shouldShadow ? 0.22 : 0
         layer?.shadowRadius = shouldShadow ? 8 : 0

--
Gitblit v1.9.3