fix: code compile compatibility with old macos
- .zero in Int/Int32/UInt32 is missing here
This commit is contained in:
1 parent
bdb51b604e
commit
10552a017a
3 files changed
+4
-4
No files matched your search
@@ -6,7 +6,7 @@ class CoreGraphicsApis {
|
||||
return (CGWindowListCopyWindowInfo([.excludeDesktopElements, .optionOnScreenOnly], kCGNullWindowID) as! [NSDictionary])
|
||||
.filter {
|
||||
// workaround: filtering this criteria seems to remove non-windows UI elements
|
||||
let isWindowNotMenubarOrOthers = value($0, kCGWindowLayer, Int.zero) == 0
|
||||
let isWindowNotMenubarOrOthers = value($0, kCGWindowLayer, Int(0)) == 0
|
||||
let windowBounds = CGRect(dictionaryRepresentation: value($0, kCGWindowBounds, [:] as CFDictionary))!
|
||||
// workaround: some apps like chrome use a window to implement the search popover
|
||||
let isReasonablyBig = windowBounds.width > Preferences.minimumWindowSize && windowBounds.height > Preferences.minimumWindowSize
|
||||
|
||||
@@ -14,7 +14,7 @@ class SystemPermissions {
|
||||
|
||||
static func ensureScreenRecordingCheckboxIsChecked() {
|
||||
let firstWindow = CoreGraphicsApis.windows()[0]
|
||||
let windowNumber = CoreGraphicsApis.value(firstWindow, kCGWindowNumber, CGWindowID.zero)
|
||||
let windowNumber = CoreGraphicsApis.value(firstWindow, kCGWindowNumber, UInt32(0))
|
||||
if CoreGraphicsApis.image(windowNumber) == nil {
|
||||
debugPrint("Before using this app, you need to give permission in System Preferences > Security & Privacy > Privacy > Screen Recording.",
|
||||
"Please authorize and re-launch.",
|
||||
|
||||
@@ -74,10 +74,10 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate {
|
||||
// we rely on the fact that CG and AX APIs arrays follow the same order to match objects from both APIs
|
||||
var pidAndCurrentIndex: [pid_t: Int] = [:]
|
||||
for cgWindow in CoreGraphicsApis.windows() {
|
||||
let cgId = CoreGraphicsApis.value(cgWindow, kCGWindowNumber, CGWindowID.zero)
|
||||
let cgId = CoreGraphicsApis.value(cgWindow, kCGWindowNumber, UInt32(0))
|
||||
let cgTitle = CoreGraphicsApis.value(cgWindow, kCGWindowName, "")
|
||||
let cgOwnerName = CoreGraphicsApis.value(cgWindow, kCGWindowOwnerName, "")
|
||||
let cgOwnerPid = CoreGraphicsApis.value(cgWindow, kCGWindowOwnerPID, pid_t.zero)
|
||||
let cgOwnerPid = CoreGraphicsApis.value(cgWindow, kCGWindowOwnerPID, Int32(0))
|
||||
let i = pidAndCurrentIndex.index(forKey: cgOwnerPid)
|
||||
pidAndCurrentIndex[cgOwnerPid] = (i == nil ? 0 : pidAndCurrentIndex[i!].value + 1)
|
||||
let axWindows_ = AccessibilityApis.windows(cgOwnerPid)
|
||||
|
||||
Reference in new issue
Block a user