mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: fix situations from some crash reports
This commit is contained in:
@@ -68,7 +68,7 @@ class SystemPermissions {
|
||||
DispatchQueue.main.async {
|
||||
if accessibility && screenRecording {
|
||||
timer.invalidate()
|
||||
permissionsWindow.close()
|
||||
permissionsWindow?.close()
|
||||
startupBlock()
|
||||
} else {
|
||||
if accessibility != permissionsWindow.accessibilityView.isPermissionGranted {
|
||||
|
||||
@@ -83,8 +83,12 @@ class KeyboardEvents {
|
||||
eventsOfInterest: eventMask,
|
||||
callback: cgEventFlagsChangedHandler,
|
||||
userInfo: nil)
|
||||
let runLoopSource = CFMachPortCreateRunLoopSource(nil, eventTap, 0)
|
||||
CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, .commonModes)
|
||||
if let eventTap = eventTap {
|
||||
let runLoopSource = CFMachPortCreateRunLoopSource(nil, eventTap, 0)
|
||||
CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, .commonModes)
|
||||
} else {
|
||||
App.app.restart()
|
||||
}
|
||||
}
|
||||
|
||||
private static func addGlobalHandlerIfNeeded(_ shortcut: Shortcut) {
|
||||
|
||||
@@ -28,9 +28,13 @@ private func observe_() {
|
||||
eventsOfInterest: eventMask,
|
||||
callback: mouseHandler,
|
||||
userInfo: nil)
|
||||
MouseEvents.toggle(false)
|
||||
let runLoopSource = CFMachPortCreateRunLoopSource(nil, eventTap, 0)
|
||||
CFRunLoopAddSource(BackgroundWork.mouseEventsThread.runLoop, runLoopSource, .commonModes)
|
||||
if let eventTap = eventTap {
|
||||
MouseEvents.toggle(false)
|
||||
let runLoopSource = CFMachPortCreateRunLoopSource(nil, eventTap, 0)
|
||||
CFRunLoopAddSource(BackgroundWork.mouseEventsThread.runLoop, runLoopSource, .commonModes)
|
||||
} else {
|
||||
App.app.restart()
|
||||
}
|
||||
}
|
||||
|
||||
private func mouseHandler(proxy: CGEventTapProxy, type: CGEventType, cgEvent: CGEvent, userInfo: UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {
|
||||
|
||||
Reference in New Issue
Block a user