swipe misses focus
This commit is contained in:
@@ -97,6 +97,7 @@ final class Overlays {
|
||||
if switcher != nil {
|
||||
return
|
||||
}
|
||||
logFocus("open switcher")
|
||||
switcher = SwitcherModel(store: store, overlays: self, anchor: pickerFrame)
|
||||
}
|
||||
|
||||
@@ -183,6 +184,14 @@ final class Overlays {
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func logFocus(_ what: String) {
|
||||
let key = NSApp.keyWindow
|
||||
let main = NSApp.mainWindow
|
||||
let responder = key?.firstResponder.map { String(describing: type(of: $0)) } ?? "nil"
|
||||
log.notice("focus debug: \(what, privacy: .public) active=\(NSApp.isActive) key=\(key?.title ?? "nil", privacy: .public) main=\(main?.title ?? "nil", privacy: .public) mainIsKey=\(main?.isKeyWindow ?? false) responder=\(responder, privacy: .public)")
|
||||
}
|
||||
|
||||
struct ModalText: View {
|
||||
let text: String
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ final class PaneFocus {
|
||||
for name in [NSWindow.didBecomeKeyNotification, NSWindow.didResignKeyNotification] {
|
||||
observers.append(center.addObserver(forName: name, object: window, queue: .main) { [weak self] _ in
|
||||
MainActor.assumeIsolated {
|
||||
logFocus(name.rawValue)
|
||||
self?.update()
|
||||
}
|
||||
})
|
||||
@@ -37,6 +38,7 @@ final class PaneFocus {
|
||||
for name in [NSApplication.didBecomeActiveNotification, NSApplication.didResignActiveNotification] {
|
||||
observers.append(center.addObserver(forName: name, object: nil, queue: .main) { [weak self] _ in
|
||||
MainActor.assumeIsolated {
|
||||
logFocus(name.rawValue)
|
||||
self?.update()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -383,7 +383,11 @@ private struct SwitcherBox: View {
|
||||
.shadow(color: .black.opacity(0.18), radius: 14, y: 8)
|
||||
.onAppear {
|
||||
DispatchQueue.main.async {
|
||||
logFocus("switcher before focus")
|
||||
focused = true
|
||||
DispatchQueue.main.async {
|
||||
logFocus("switcher after focus focused=\(focused)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: model.focusRequest) {
|
||||
|
||||
Reference in New Issue
Block a user