fix: alt-tab would show on the wrong screen (closes #2003)
This commit is contained in:
1 parent
5830958478
commit
b72c4db334
1 file changed
+7
-3
@@ -97,6 +97,8 @@ fileprivate func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) thro
|
||||
let level = try wid.level()
|
||||
let position = try element.position()
|
||||
let size = try element.size()
|
||||
let parent = try element.parent()
|
||||
let parentWid = try parent?.cgWindowId()
|
||||
DispatchQueue.main.async {
|
||||
if let windows = Windows.updateLastFocus(element, wid) {
|
||||
App.app.refreshOpenUi(windows)
|
||||
@@ -106,6 +108,11 @@ fileprivate func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) thro
|
||||
Windows.appendAndUpdateFocus(window)
|
||||
App.app.refreshOpenUi([window])
|
||||
}
|
||||
// if the window is shown by alt-tab, we mark her as focused for this app
|
||||
// this avoids issues with dialogs, quicklook, etc (see scenarios from #1044 and #2003)
|
||||
if let w = (Windows.list.first { $0.isEqualRobust(element, wid) }) {
|
||||
Applications.find(pid)?.focusedWindow = w
|
||||
}
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
@@ -118,9 +125,6 @@ fileprivate func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) thro
|
||||
}
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
Applications.find(pid)?.focusedWindow = Windows.list.first { $0.isEqualRobust(element, wid) }
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
Applications.find(pid)?.focusedWindow = nil
|
||||
|
||||
Reference in new issue
Block a user