From a2203ab2b11ceb5c5cc31ffdaaa13349d4f2c66e Mon Sep 17 00:00:00 2001 From: Istvan Toth <37590873+waydabber@users.noreply.github.com> Date: Tue, 16 Nov 2021 11:56:49 +0100 Subject: [PATCH] Removed OSD lock popup completely (#791) --- MonitorControl/Support/MediaKeyTapManager.swift | 10 ---------- MonitorControl/Support/OSDUtils.swift | 13 ------------- 2 files changed, 23 deletions(-) diff --git a/MonitorControl/Support/MediaKeyTapManager.swift b/MonitorControl/Support/MediaKeyTapManager.swift index 906156b..adab913 100644 --- a/MonitorControl/Support/MediaKeyTapManager.swift +++ b/MonitorControl/Support/MediaKeyTapManager.swift @@ -21,7 +21,6 @@ class MediaKeyTapManager: MediaKeyTapDelegate { return } guard app.sleepID == 0, app.reconfigureID == 0 else { - self.showOSDLock(mediaKey) return } if isPressed, self.handleOpenPrefPane(mediaKey: mediaKey, event: event, modifiers: modifiers) { @@ -68,15 +67,6 @@ class MediaKeyTapManager: MediaKeyTapDelegate { } } - private func showOSDLock(_ mediaKey: MediaKey) { - if [.brightnessUp, .brightnessDown].contains(mediaKey) { - OSDUtils.showOSDLockOnAllDisplays(osdImage: OSDUtils.OSDImage.brightness.rawValue) - } - if [.volumeUp, .volumeDown, .mute].contains(mediaKey) { - OSDUtils.showOSDLockOnAllDisplays(osdImage: OSDUtils.OSDImage.audioSpeaker.rawValue) - } - } - private func sendDisplayCommand(mediaKey: MediaKey, isRepeat: Bool, isSmallIncrement: Bool, isPressed: Bool, isContrast: Bool = false) { self.sendDisplayCommandVolumeMute(mediaKey: mediaKey, isRepeat: isRepeat, isSmallIncrement: isSmallIncrement, isPressed: isPressed) self.sendDisplayCommandBrightnessContrast(mediaKey: mediaKey, isRepeat: isRepeat, isSmallIncrement: isSmallIncrement, isPressed: isPressed, isContrast: isContrast) diff --git a/MonitorControl/Support/OSDUtils.swift b/MonitorControl/Support/OSDUtils.swift index b3b7207..a250273 100644 --- a/MonitorControl/Support/OSDUtils.swift +++ b/MonitorControl/Support/OSDUtils.swift @@ -74,17 +74,4 @@ class OSDUtils: NSObject { static func getDistance(fromNearestChiclet chiclet: Float) -> Float { abs(chiclet.rounded(.towardZero) - chiclet) } - - static func showOSDLockOnAllDisplays(osdImage: Int64) { - var displayCount: UInt32 = 0 - var onlineDisplays = [CGDirectDisplayID](repeating: 0, count: Int(16)) - if CGGetOnlineDisplayList(16, &onlineDisplays, &displayCount) == CGError.success { - let displayIDs = onlineDisplays.prefix(Int(displayCount)) - for id in displayIDs { - if let manager = OSDManager.sharedManager() as? OSDManager { - manager.showImage(osdImage, onDisplayID: id, priority: 0x1F4, msecUntilFade: 1000, filledChiclets: 0, totalChiclets: 100, locked: true) - } - } - } - } }