refactor: fix non-impactful compiler warnings

This commit is contained in:
Louis Pontoise authored and lwouis committed 2021-11-13 01:39:28 +09:00
1 parent 4a264abadd
commit f4eb6ff49d
5 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ class Application: NSObject {
if runningApplication.isFinishedLaunching && runningApplication.activationPolicy != .prohibited && axUiElement == nil {
axUiElement = AXUIElementCreateApplication(pid)
AXObserverCreate(pid, axObserverCallback, &axObserver)
debugPrint("Adding app", pid, runningApplication.bundleIdentifier ?? "nil")
debugPrint("Adding app", pid ?? "nil", runningApplication.bundleIdentifier ?? "nil")
observeEvents()
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ extension NSScreen {
// * if NSScreen.screensHaveSeparateSpaces == false, and key window is on another screen than screens[0], it still returns screens[0]
// we find the screen with the key window ourselves manually
static func active() -> NSScreen? {
if let app = Applications.list.first { $0.pid == NSWorkspace.shared.frontmostApplication?.processIdentifier },
if let app = (Applications.list.first { $0.pid == NSWorkspace.shared.frontmostApplication?.processIdentifier }),
let focusedWindow = app.focusedWindow {
return NSScreen.screens.first { focusedWindow.isOnScreen($0) }
}
+1 -1
View File
@@ -25,7 +25,7 @@ class Windows {
}
static func setInitialFocusedWindowIndex() {
if let app = Applications.list.first { $0.pid == NSWorkspace.shared.frontmostApplication?.processIdentifier },
if let app = (Applications.list.first { $0.pid == NSWorkspace.shared.frontmostApplication?.processIdentifier }),
app.focusedWindow == nil,
let lastFocusedWindowIndex = getLastFocusedWindowIndex() {
updateFocusedWindowIndex(lastFocusedWindowIndex)
+3 -2
View File
@@ -67,8 +67,9 @@ class KeyboardEvents {
}
private static func addLocalMonitorForKeyDownAndKeyUp() {
localMonitor = NSEvent.addLocalMonitorForEvents(matching: [.keyDown, .keyUp]) { event in
return handleEvent(nil, nil, event.type == .keyDown ? UInt32(event.keyCode) : nil, cocoaToCarbonFlags(event.modifierFlags), event.type == .keyDown ? event.isARepeat : false) ? nil : event
localMonitor = NSEvent.addLocalMonitorForEvents(matching: [.keyDown, .keyUp]) { (event: NSEvent) in
let someShortcutTriggered = handleEvent(nil, nil, event.type == .keyDown ? UInt32(event.keyCode) : nil, cocoaToCarbonFlags(event.modifierFlags), event.type == .keyDown ? event.isARepeat : false)
return someShortcutTriggered ? nil : event
}
}
+1
View File
@@ -178,6 +178,7 @@ class ThumbnailView: NSStackView {
}
}
@discardableResult
func updateDockLabelIcon(_ dockLabel: Int?) -> Bool {
assignIfDifferent(&dockLabelIcon.isHidden, dockLabel == nil || Preferences.hideAppBadges || Preferences.iconSize == 0)
if !dockLabelIcon.isHidden, let dockLabel = dockLabel {