diff --git a/Cartfile.resolved b/Cartfile.resolved index a60a0a3..2a795ea 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "reitermarkus/DDC.swift" "a29f1975f46745580990269a3dc26873737f24bb" +github "reitermarkus/DDC.swift" "05141d5bb5d5fd77b22701d03fbec7586aad8fd7" github "rnine/AMCoreAudio" "3.2.1" github "shpakovski/MASPreferences" "1.3" github "the0neyouseek/MediaKeyTap" "abfe09f53ccabb1aa14a0f4ab99cfb8812f41919" diff --git a/MonitorControl/Display.swift b/MonitorControl/Display.swift index d0fcf03..363e219 100644 --- a/MonitorControl/Display.swift +++ b/MonitorControl/Display.swift @@ -28,18 +28,7 @@ class Display { } _ = self.ddc?.write(command: .onScreenDisplay, value: 1) - - DispatchQueue.global(qos: .background).asyncAfter(deadline: DispatchTime.now() + 0.000001) { - _ = self.ddc?.write(command: .onScreenDisplay, value: 1) - } - - DispatchQueue.global(qos: .background).asyncAfter(deadline: DispatchTime.now() + 0.00001) { - _ = self.ddc?.write(command: .onScreenDisplay, value: 1) - } - - DispatchQueue.global(qos: .background).asyncAfter(deadline: DispatchTime.now() + 0.0001) { - _ = self.ddc?.write(command: .onScreenDisplay, value: 1) - } + _ = self.ddc?.write(command: .onScreenDisplay, value: 1) } func mute() { @@ -51,14 +40,18 @@ class Display { self.isMuted = true } - _ = self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) - self.hideDisplayOsd() + DispatchQueue.global(qos: .userInitiated).async { + guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) == true else { + return + } + + self.hideDisplayOsd() + self.showOsd(command: .audioSpeakerVolume, value: value) + } if let slider = volumeSliderHandler?.slider { slider.intValue = Int32(value) } - - self.showOsd(command: .audioSpeakerVolume, value: value) } func setVolume(to value: Int) { @@ -66,38 +59,53 @@ class Display { self.isMuted = false } - _ = self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) - self.hideDisplayOsd() + DispatchQueue.global(qos: .userInitiated).async { + guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) == true else { + return + } + + self.hideDisplayOsd() + self.showOsd(command: .audioSpeakerVolume, value: value) + } if let slider = volumeSliderHandler?.slider { slider.intValue = Int32(value) } - self.showOsd(command: .audioSpeakerVolume, value: value) self.saveValue(value, for: .audioSpeakerVolume) } func setBrightness(to value: Int) { if self.prefs.bool(forKey: Utils.PrefKeys.lowerContrast.rawValue) { if value == 0 { - _ = self.ddc?.write(command: .contrast, value: UInt8(value)) + DispatchQueue.global(qos: .userInitiated).async { + _ = self.ddc?.write(command: .contrast, value: UInt8(value)) + } if let slider = contrastSliderHandler?.slider { slider.intValue = Int32(value) } } else if self.prefs.integer(forKey: "\(DDC.Command.brightness.value)-\(self.identifier)") == 0 { let contrastValue = self.prefs.integer(forKey: "\(DDC.Command.contrast.value)-\(self.identifier)") - _ = self.ddc?.write(command: .contrast, value: UInt8(contrastValue)) + + DispatchQueue.global(qos: .userInitiated).async { + _ = self.ddc?.write(command: .contrast, value: UInt8(contrastValue)) + } } } - _ = self.ddc?.write(command: .brightness, value: UInt8(value)) + DispatchQueue.global(qos: .userInitiated).async { + guard self.ddc?.write(command: .brightness, value: UInt8(value)) == true else { + return + } + + self.showOsd(command: .brightness, value: value) + } if let slider = brightnessSliderHandler?.slider { slider.intValue = Int32(value) } - self.showOsd(command: .brightness, value: value) self.saveValue(value, for: .brightness) } diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 78dcdc0..7e8cc82 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.5.1 CFBundleVersion - 289 + 318 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControlHelper/Info.plist b/MonitorControlHelper/Info.plist index 1f39d73..1fa178f 100644 --- a/MonitorControlHelper/Info.plist +++ b/MonitorControlHelper/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.5.1 CFBundleVersion - 289 + 318 LSApplicationCategoryType public.app-category.utilities LSBackgroundOnly