mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
wip: sequoia bug
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -259,4 +259,4 @@ func SLSWindowIteratorGetParentID(_ iterator: CFTypeRef) -> CGWindowID
|
||||
func SLSWindowIteratorGetWindowID(_ iterator: CFTypeRef) -> CGWindowID
|
||||
|
||||
@_silgen_name("SLSWindowIteratorGetTags")
|
||||
func SLSWindowIteratorGetTags(_ iterator: CFTypeRef) -> UInt
|
||||
func SLSWindowIteratorGetTags(_ iterator: CFTypeRef) -> UInt
|
||||
|
||||
@@ -129,6 +129,9 @@ class Windows {
|
||||
if list.count > ThumbnailsView.recycledViews.count {
|
||||
ThumbnailsView.recycledViews.append(ThumbnailView())
|
||||
}
|
||||
var windowIds = list.compactMap { $0.cgWindowId }
|
||||
let cgError = SLSRequestNotificationsForWindows(CGS_CONNECTION, &windowIds, windowIds.count);
|
||||
Logger.error(cgError.rawValue, windowIds)
|
||||
}
|
||||
|
||||
static func removeAndUpdateFocus(_ window: Window) {
|
||||
|
||||
@@ -127,9 +127,14 @@ fileprivate func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) thro
|
||||
|
||||
fileprivate func windowDestroyed(_ element: AXUIElement, _ pid: pid_t) throws {
|
||||
let wid = try element.cgWindowId()
|
||||
windowDestroyed_(wid, element, pid)
|
||||
}
|
||||
|
||||
fileprivate func windowDestroyed_(_ wid: CGWindowID?, _ element: AXUIElement?, _ pid: pid_t?) {
|
||||
DispatchQueue.main.async {
|
||||
if let index = (Windows.list.firstIndex { $0.isEqualRobust(element, wid) }) {
|
||||
if let index = (Windows.list.firstIndex { element == nil ? $0.cgWindowId == wid : $0.isEqualRobust(element!, wid) }) {
|
||||
let window = Windows.list[index]
|
||||
let pid = pid != nil ? pid : window.application.pid
|
||||
Windows.removeAndUpdateFocus(window)
|
||||
if window.application.addWindowlessWindowIfNeeded() != nil {
|
||||
Applications.find(pid)?.focusedWindow = nil
|
||||
@@ -199,3 +204,13 @@ func updateWindowSizeAndPositionAndFullscreen(_ element: AXUIElement, _ wid: CGW
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let notifyCallback: NotifyCallback = { type, data, dataLength, context, cid in
|
||||
Logger.error("-----", type)
|
||||
if type == 804, let data {
|
||||
// var wid: UInt32
|
||||
// memcpy(&wid, &data, MemoryLayout<UInt32>.size)
|
||||
let wid = data.load(as: UInt32.self)
|
||||
windowDestroyed_(wid, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +326,10 @@ extension App: NSApplicationDelegate {
|
||||
#if DEBUG
|
||||
// self.showPreferencesWindow()
|
||||
#endif
|
||||
// if (workspace_is_macos_sequoia()) {
|
||||
let cgError = SLSRegisterConnectionNotifyProc(CGS_CONNECTION, notifyCallback, NotifyEvent.windowDestroyed.rawValue, nil)
|
||||
Logger.error(cgError.rawValue)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user