diff --git a/.gitignore b/.gitignore index 633f55e..fae4784 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,6 @@ Carthage/Build # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md fastlane/report.xml -fastlane/screenshots \ No newline at end of file +fastlane/screenshots + +.DS_Store \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8bfdbcf --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ddcctl"] + path = ddcctl + url = https://github.com/kfix/ddcctl diff --git a/BrightnessMenulet/AppDelegate.h b/AppDelegate.h similarity index 100% rename from BrightnessMenulet/AppDelegate.h rename to AppDelegate.h diff --git a/BrightnessMenulet/AppDelegate.m b/AppDelegate.m similarity index 91% rename from BrightnessMenulet/AppDelegate.m rename to AppDelegate.m index 6278050..4cdf6a1 100644 --- a/BrightnessMenulet/AppDelegate.m +++ b/AppDelegate.m @@ -41,10 +41,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - if(![[[defaults dictionaryRepresentation] allKeys] containsObject:@"LMUUpdateInterval"]) + if (![[[defaults dictionaryRepresentation] allKeys] containsObject:@"LMUUpdateInterval"]) [defaults setFloat:0.5 forKey:@"LMUUpdateInterval"]; - if([defaults boolForKey:@"autoBrightOnStartup"]) + if ([defaults boolForKey:@"autoBrightOnStartup"]) [lmuCon startMonitoring]; } diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/TemplateIcon.icns b/BrightnessMenulet.xcodeproj/TemplateIcon.icns similarity index 100% rename from BrightnessMenulet/BrightnessMenulet.xcodeproj/TemplateIcon.icns rename to BrightnessMenulet.xcodeproj/TemplateIcon.icns diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.pbxproj b/BrightnessMenulet.xcodeproj/project.pbxproj similarity index 52% rename from BrightnessMenulet/BrightnessMenulet.xcodeproj/project.pbxproj rename to BrightnessMenulet.xcodeproj/project.pbxproj index 01f7fd7..7f455ed 100755 --- a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.pbxproj +++ b/BrightnessMenulet.xcodeproj/project.pbxproj @@ -3,56 +3,56 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ 0B38B5E619E8EF9200D72911 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B38B5E519E8EF9200D72911 /* AppDelegate.m */; }; - 0B4E1FEC19E5FD4B0044BAFE /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0B4E1FEB19E5FD4B0044BAFE /* Preferences.xib */; }; - 0B4E1FEF19E5FEBB0044BAFE /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B4E1FEE19E5FEBB0044BAFE /* PreferencesController.m */; }; - 0BCFE67319C9F1B40094B561 /* DDCControls.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCFE67219C9F1B30094B561 /* DDCControls.m */; }; - 7D2FF98311406B0100707C79 /* MainMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2FF98211406B0100707C79 /* MainMenuController.m */; }; - 7D2FF98611406B2C00707C79 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2FF98411406B2C00707C79 /* icon.png */; }; - 7D2FF98711406B2C00707C79 /* icon-alt.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2FF98511406B2C00707C79 /* icon-alt.png */; }; 7D2FF9FC1140B94600707C79 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D2FF9FB1140B94600707C79 /* IOKit.framework */; }; - 7D2FFBA21140CC8700707C79 /* brightness-sun-transparent-black.icns in Resources */ = {isa = PBXBuildFile; fileRef = 7D2FFBA11140CC8700707C79 /* brightness-sun-transparent-black.icns */; }; - 863E61681C5C51DD00C2419C /* LMUController.m in Sources */ = {isa = PBXBuildFile; fileRef = 863E61671C5C51DD00C2419C /* LMUController.m */; }; - 863E616B1C5D33C600C2419C /* Screen.m in Sources */ = {isa = PBXBuildFile; fileRef = 863E616A1C5D33C600C2419C /* Screen.m */; }; - 864C8A2B1BF9B9BD00D87B1A /* ddc.c in Sources */ = {isa = PBXBuildFile; fileRef = 864C8A291BF9B9BD00D87B1A /* ddc.c */; }; - 8670E94C1BC44EB800402DE5 /* Menu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8670E94B1BC44EB800402DE5 /* Menu.xib */; }; - 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + C0391E771E6E81EC00AF4839 /* MainMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E751E6E81EC00AF4839 /* MainMenuController.m */; }; + C0391E781E6E81EC00AF4839 /* Menu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0391E761E6E81EC00AF4839 /* Menu.xib */; }; + C0391E7C1E6E820200AF4839 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0391E791E6E820200AF4839 /* Preferences.xib */; }; + C0391E7D1E6E820200AF4839 /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E7B1E6E820200AF4839 /* PreferencesController.m */; }; + C0391E811E6E820E00AF4839 /* LMUController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E7F1E6E820E00AF4839 /* LMUController.m */; }; + C0391E861E6E821E00AF4839 /* DDCControls.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E831E6E821E00AF4839 /* DDCControls.m */; }; + C0391E871E6E821E00AF4839 /* Screen.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E851E6E821E00AF4839 /* Screen.m */; }; + C0391E8C1E6E823500AF4839 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C0391E8A1E6E823500AF4839 /* main.m */; }; + C0391E901E6E824D00AF4839 /* brightness-sun-transparent-black.icns in Resources */ = {isa = PBXBuildFile; fileRef = C0391E8D1E6E824D00AF4839 /* brightness-sun-transparent-black.icns */; }; + C0391E911E6E824D00AF4839 /* icon-alt.png in Resources */ = {isa = PBXBuildFile; fileRef = C0391E8E1E6E824D00AF4839 /* icon-alt.png */; }; + C0391E921E6E824D00AF4839 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = C0391E8F1E6E824D00AF4839 /* icon.png */; }; + C0391E951E6E841F00AF4839 /* DDC.c in Sources */ = {isa = PBXBuildFile; fileRef = C0391E931E6E841F00AF4839 /* DDC.c */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0B38B5E419E8EF9200D72911 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 0B38B5E519E8EF9200D72911 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 0B4E1FEB19E5FD4B0044BAFE /* Preferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Preferences.xib; sourceTree = ""; }; - 0B4E1FED19E5FEBB0044BAFE /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = ""; }; - 0B4E1FEE19E5FEBB0044BAFE /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesController.m; sourceTree = ""; }; - 0BCFE67119C9F1B30094B561 /* DDCControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDCControls.h; sourceTree = ""; }; - 0BCFE67219C9F1B30094B561 /* DDCControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDCControls.m; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* BrightnessMenulet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrightnessMenulet_Prefix.pch; sourceTree = ""; }; - 7D2FF98111406B0100707C79 /* MainMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainMenuController.h; sourceTree = ""; }; - 7D2FF98211406B0100707C79 /* MainMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainMenuController.m; sourceTree = ""; }; - 7D2FF98411406B2C00707C79 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; - 7D2FF98511406B2C00707C79 /* icon-alt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-alt.png"; sourceTree = ""; }; 7D2FF9FB1140B94600707C79 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 7D2FFBA11140CC8700707C79 /* brightness-sun-transparent-black.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "brightness-sun-transparent-black.icns"; sourceTree = ""; }; 7DECCAE1114E12DD0068E5DB /* Brightness Menulet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Brightness Menulet.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 863E61661C5C51DD00C2419C /* LMUController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LMUController.h; sourceTree = ""; }; - 863E61671C5C51DD00C2419C /* LMUController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LMUController.m; sourceTree = ""; }; - 863E61691C5D33C600C2419C /* Screen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Screen.h; sourceTree = ""; }; - 863E616A1C5D33C600C2419C /* Screen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Screen.m; sourceTree = ""; }; - 8649EF4E1C68288800C1B65C /* LMUDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LMUDelegate.h; sourceTree = ""; }; - 864C8A291BF9B9BD00D87B1A /* ddc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ddc.c; sourceTree = SOURCE_ROOT; }; - 864C8A2A1BF9B9BD00D87B1A /* ddc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ddc.h; sourceTree = SOURCE_ROOT; }; - 8670E94B1BC44EB800402DE5 /* Menu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Menu.xib; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C0391E741E6E81EC00AF4839 /* MainMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MainMenuController.h; path = Menu/MainMenuController.h; sourceTree = ""; }; + C0391E751E6E81EC00AF4839 /* MainMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MainMenuController.m; path = Menu/MainMenuController.m; sourceTree = ""; }; + C0391E761E6E81EC00AF4839 /* Menu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Menu.xib; path = Menu/Menu.xib; sourceTree = ""; }; + C0391E791E6E820200AF4839 /* Preferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Preferences.xib; path = Preferences/Preferences.xib; sourceTree = ""; }; + C0391E7A1E6E820200AF4839 /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Preferences/PreferencesController.h; sourceTree = ""; }; + C0391E7B1E6E820200AF4839 /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PreferencesController.m; path = Preferences/PreferencesController.m; sourceTree = ""; }; + C0391E7E1E6E820E00AF4839 /* LMUController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LMUController.h; path = LMU/LMUController.h; sourceTree = ""; }; + C0391E7F1E6E820E00AF4839 /* LMUController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LMUController.m; path = LMU/LMUController.m; sourceTree = ""; }; + C0391E801E6E820E00AF4839 /* LMUDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LMUDelegate.h; path = LMU/LMUDelegate.h; sourceTree = ""; }; + C0391E821E6E821E00AF4839 /* DDCControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DDCControls.h; path = DDCControls/DDCControls.h; sourceTree = ""; }; + C0391E831E6E821E00AF4839 /* DDCControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDCControls.m; path = DDCControls/DDCControls.m; sourceTree = ""; }; + C0391E841E6E821E00AF4839 /* Screen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Screen.h; path = DDCControls/Screen.h; sourceTree = ""; }; + C0391E851E6E821E00AF4839 /* Screen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Screen.m; path = DDCControls/Screen.m; sourceTree = ""; }; + C0391E881E6E823500AF4839 /* BrightnessMenulet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrightnessMenulet_Prefix.pch; path = "Supporting Files/BrightnessMenulet_Prefix.pch"; sourceTree = ""; }; + C0391E891E6E823500AF4839 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = ""; }; + C0391E8A1E6E823500AF4839 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = "Supporting Files/main.m"; sourceTree = ""; }; + C0391E8D1E6E824D00AF4839 /* brightness-sun-transparent-black.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "brightness-sun-transparent-black.icns"; path = "Resources/brightness-sun-transparent-black.icns"; sourceTree = ""; }; + C0391E8E1E6E824D00AF4839 /* icon-alt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-alt.png"; path = "Resources/icon-alt.png"; sourceTree = ""; }; + C0391E8F1E6E824D00AF4839 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = Resources/icon.png; sourceTree = ""; }; + C0391E931E6E841F00AF4839 /* DDC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = DDC.c; path = ddcctl/DDC.c; sourceTree = ""; }; + C0391E941E6E841F00AF4839 /* DDC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DDC.h; path = ddcctl/DDC.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -71,9 +71,9 @@ 0B8CF6C819E7172800F3FD6F /* Preferences */ = { isa = PBXGroup; children = ( - 0B4E1FED19E5FEBB0044BAFE /* PreferencesController.h */, - 0B4E1FEE19E5FEBB0044BAFE /* PreferencesController.m */, - 0B4E1FEB19E5FD4B0044BAFE /* Preferences.xib */, + C0391E791E6E820200AF4839 /* Preferences.xib */, + C0391E7A1E6E820200AF4839 /* PreferencesController.h */, + C0391E7B1E6E820200AF4839 /* PreferencesController.m */, ); name = Preferences; sourceTree = ""; @@ -81,9 +81,9 @@ 0B8CF6CC19E71BA400F3FD6F /* Menu */ = { isa = PBXGroup; children = ( - 7D2FF98111406B0100707C79 /* MainMenuController.h */, - 7D2FF98211406B0100707C79 /* MainMenuController.m */, - 8670E94B1BC44EB800402DE5 /* Menu.xib */, + C0391E761E6E81EC00AF4839 /* Menu.xib */, + C0391E741E6E81EC00AF4839 /* MainMenuController.h */, + C0391E751E6E81EC00AF4839 /* MainMenuController.m */, ); name = Menu; sourceTree = ""; @@ -91,10 +91,10 @@ 0BCFE67419C9F1B90094B561 /* DDCControls */ = { isa = PBXGroup; children = ( - 0BCFE67119C9F1B30094B561 /* DDCControls.h */, - 0BCFE67219C9F1B30094B561 /* DDCControls.m */, - 863E61691C5D33C600C2419C /* Screen.h */, - 863E616A1C5D33C600C2419C /* Screen.m */, + C0391E821E6E821E00AF4839 /* DDCControls.h */, + C0391E831E6E821E00AF4839 /* DDCControls.m */, + C0391E841E6E821E00AF4839 /* Screen.h */, + C0391E851E6E821E00AF4839 /* Screen.m */, ); name = DDCControls; sourceTree = ""; @@ -102,9 +102,9 @@ 0BCFE67519C9F1EC0094B561 /* Supporting Files */ = { isa = PBXGroup; children = ( - 8D1107310486CEB800E47090 /* Info.plist */, - 29B97316FDCFA39411CA2CEA /* main.m */, - 32CA4F630368D1EE00C91783 /* BrightnessMenulet_Prefix.pch */, + C0391E881E6E823500AF4839 /* BrightnessMenulet_Prefix.pch */, + C0391E891E6E823500AF4839 /* Info.plist */, + C0391E8A1E6E823500AF4839 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; @@ -155,9 +155,9 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 7D2FF98411406B2C00707C79 /* icon.png */, - 7D2FF98511406B2C00707C79 /* icon-alt.png */, - 7D2FFBA11140CC8700707C79 /* brightness-sun-transparent-black.icns */, + C0391E8D1E6E824D00AF4839 /* brightness-sun-transparent-black.icns */, + C0391E8E1E6E824D00AF4839 /* icon-alt.png */, + C0391E8F1E6E824D00AF4839 /* icon.png */, ); name = Resources; sourceTree = ""; @@ -165,31 +165,30 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - 79897D331664F808008C7D5C /* ddc */, + C0391E961E6E842300AF4839 /* DDC */, 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; - 79897D331664F808008C7D5C /* ddc */ = { + 863E61651C5C518D00C2419C /* LMU */ = { isa = PBXGroup; children = ( - 864C8A291BF9B9BD00D87B1A /* ddc.c */, - 864C8A2A1BF9B9BD00D87B1A /* ddc.h */, + C0391E7E1E6E820E00AF4839 /* LMUController.h */, + C0391E7F1E6E820E00AF4839 /* LMUController.m */, + C0391E801E6E820E00AF4839 /* LMUDelegate.h */, ); - name = ddc; - path = "../DDC-CI-Tools-for-OS-X/ddc"; + name = LMU; sourceTree = ""; }; - 863E61651C5C518D00C2419C /* LMU */ = { + C0391E961E6E842300AF4839 /* DDC */ = { isa = PBXGroup; children = ( - 863E61661C5C51DD00C2419C /* LMUController.h */, - 863E61671C5C51DD00C2419C /* LMUController.m */, - 8649EF4E1C68288800C1B65C /* LMUDelegate.h */, + C0391E931E6E841F00AF4839 /* DDC.c */, + C0391E941E6E841F00AF4839 /* DDC.h */, ); - name = LMU; + name = DDC; sourceTree = ""; }; /* End PBXGroup section */ @@ -219,7 +218,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1010; TargetAttributes = { 8D1107260486CEB800E47090 = { DevelopmentTeam = N6A2S4TCDQ; @@ -227,7 +226,7 @@ }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "BrightnessMenulet" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 8.0"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -247,11 +246,11 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7D2FF98611406B2C00707C79 /* icon.png in Resources */, - 7D2FF98711406B2C00707C79 /* icon-alt.png in Resources */, - 0B4E1FEC19E5FD4B0044BAFE /* Preferences.xib in Resources */, - 8670E94C1BC44EB800402DE5 /* Menu.xib in Resources */, - 7D2FFBA21140CC8700707C79 /* brightness-sun-transparent-black.icns in Resources */, + C0391E781E6E81EC00AF4839 /* Menu.xib in Resources */, + C0391E901E6E824D00AF4839 /* brightness-sun-transparent-black.icns in Resources */, + C0391E921E6E824D00AF4839 /* icon.png in Resources */, + C0391E7C1E6E820200AF4839 /* Preferences.xib in Resources */, + C0391E911E6E824D00AF4839 /* icon-alt.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -262,13 +261,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D11072D0486CEB800E47090 /* main.m in Sources */, - 7D2FF98311406B0100707C79 /* MainMenuController.m in Sources */, - 0B4E1FEF19E5FEBB0044BAFE /* PreferencesController.m in Sources */, - 863E616B1C5D33C600C2419C /* Screen.m in Sources */, - 864C8A2B1BF9B9BD00D87B1A /* ddc.c in Sources */, - 863E61681C5C51DD00C2419C /* LMUController.m in Sources */, - 0BCFE67319C9F1B40094B561 /* DDCControls.m in Sources */, + C0391E7D1E6E820200AF4839 /* PreferencesController.m in Sources */, + C0391E951E6E841F00AF4839 /* DDC.c in Sources */, + C0391E861E6E821E00AF4839 /* DDCControls.m in Sources */, + C0391E871E6E821E00AF4839 /* Screen.m in Sources */, + C0391E811E6E820E00AF4839 /* LMUController.m in Sources */, + C0391E771E6E81EC00AF4839 /* MainMenuController.m in Sources */, + C0391E8C1E6E823500AF4839 /* main.m in Sources */, 0B38B5E619E8EF9200D72911 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -279,63 +278,71 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = BrightnessMenulet_Prefix.pch; - "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = DEBUG; - INFOPLIST_FILE = Info.plist; + GCC_PREFIX_HEADER = "Supporting Files/BrightnessMenulet_Prefix.pch"; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_BUNDLE_IDENTIFIER = com.redpanda.BrightnessMenulet; PRODUCT_NAME = "Brightness Menulet"; PROVISIONING_PROFILE = ""; - SDKROOT = macosx; }; name = Debug; }; C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = BrightnessMenulet_Prefix.pch; - INFOPLIST_FILE = Info.plist; + GCC_PREFIX_HEADER = "Supporting Files/BrightnessMenulet_Prefix.pch"; + INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - MACOSX_DEPLOYMENT_TARGET = 10.8; - ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.redpanda.BrightnessMenulet; PRODUCT_NAME = "Brightness Menulet"; PROVISIONING_PROFILE = ""; - SDKROOT = macosx; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; PRODUCT_NAME = "Brightness Menulet"; SDKROOT = macosx; }; @@ -344,11 +351,38 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; - PREBINDING = NO; PRODUCT_NAME = "Brightness Menulet"; SDKROOT = macosx; }; diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/BrightnessMenulet.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to BrightnessMenulet.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/WorkspaceSettings.xcsettings b/BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 59% rename from BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/WorkspaceSettings.xcsettings rename to BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist index 659c876..18d9810 100644 --- a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/WorkspaceSettings.xcsettings +++ b/BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -2,9 +2,7 @@ - HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges - - SnapshotAutomaticallyBeforeSignificantChanges + IDEDidComputeMac32BitWarning diff --git a/BrightnessMenulet/.DS_Store b/BrightnessMenulet/.DS_Store deleted file mode 100644 index 7b6d0b5..0000000 Binary files a/BrightnessMenulet/.DS_Store and /dev/null differ diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/BrightnessMenulet.xccheckout b/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/BrightnessMenulet.xccheckout deleted file mode 100644 index de58e78..0000000 --- a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcshareddata/BrightnessMenulet.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - BB971E64-8549-4D1D-968E-DC0FDCE57ED4 - IDESourceControlProjectName - project - IDESourceControlProjectOriginsDictionary - - C833DA2D57FE098F5287379F9477B17B05731688 - https://github.com/Kalvin126/BrightnessMenulet.git - - IDESourceControlProjectPath - BrightnessMenulet.xcodeproj/project.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - C833DA2D57FE098F5287379F9477B17B05731688 - ../.. - - IDESourceControlProjectURL - https://github.com/Kalvin126/BrightnessMenulet.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - C833DA2D57FE098F5287379F9477B17B05731688 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - C833DA2D57FE098F5287379F9477B17B05731688 - IDESourceControlWCCName - BrightnessMenulet - - - - diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/UserInterfaceState.xcuserstate b/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 7d557e9..0000000 Binary files a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvin126.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvinloc.xcuserdatad/UserInterfaceState.xcuserstate b/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvinloc.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 286fbe8..0000000 Binary files a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/kalvinloc.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/narada.xcuserdatad/UserInterfaceState.xcuserstate b/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/narada.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100755 index be1fac8..0000000 Binary files a/BrightnessMenulet/BrightnessMenulet.xcodeproj/project.xcworkspace/xcuserdata/narada.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/BrightnessMenulet/Brightness_Menulet.zip b/BrightnessMenulet/Brightness_Menulet.zip deleted file mode 100644 index 307f1f6..0000000 Binary files a/BrightnessMenulet/Brightness_Menulet.zip and /dev/null differ diff --git a/BrightnessMenulet/ddc.c b/BrightnessMenulet/ddc.c deleted file mode 100755 index b9f136b..0000000 --- a/BrightnessMenulet/ddc.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * ddc.c - * ddc - * - * Created by Jonathan Taylor on 07/10/2009. - * Copyright 2009 __MyCompanyName__. All rights reserved. - * - */ - -#include -#include -#include "ddc.h" - -IOI2CConnectRef display_connection(CGDirectDisplayID display_id) { - kern_return_t kr; - io_service_t framebuffer, interface; - IOOptionBits bus; - IOItemCount busCount; - - //printf("Querying for displayid: %d\n", display_id); - framebuffer = CGDisplayIOServicePort(display_id); // fixme! - CGDisplayIOServicePort deprecated - - io_string_t path; - kr = IORegistryEntryGetPath(framebuffer, kIOServicePlane, path); - if(KERN_SUCCESS != kr) // display path find failed - return nil; - - kr = IOFBGetI2CInterfaceCount( framebuffer, &busCount ); - assert(kIOReturnSuccess == kr); - - for(bus = 0; bus < busCount; bus++){ - IOI2CConnectRef connect; - - kr = IOFBCopyI2CInterfaceForBus(framebuffer, bus, &interface); - if(kIOReturnSuccess != kr) - continue; - - kr = IOI2CInterfaceOpen(interface, kNilOptions, &connect); - - IOObjectRelease(interface); - assert(kIOReturnSuccess == kr); - if(kIOReturnSuccess != kr) - continue; - - return connect; - } - - return nil; -} - -int ddc_write(CGDirectDisplayID display_id, struct DDCWriteCommand* p_write) { - UInt8 data[128]; - IOI2CRequest request; - kern_return_t kr; - - IOI2CConnectRef connect = display_connection(display_id); - if(!connect) - return 0; - - bzero(&request, sizeof(request)); - - request.commFlags = 0; - request.sendAddress = 0x6e; - request.sendTransactionType = kIOI2CSimpleTransactionType; - request.sendBuffer = (vm_address_t) &data[0]; - request.sendBytes = 7; - - data[0] = 0x51; - data[1] = 0x84; - data[2] = 0x03; - data[3] = (*p_write).control_id; - data[4] = 0x1; - data[5] = (*p_write).new_value; - data[6] = 0x6E ^ data[0] ^ data[1] ^ data[2] ^ data[3] ^ data[4] ^ data[5]; - - request.replyTransactionType = kIOI2CNoTransactionType; - request.replyBytes = 0; - - kr = IOI2CSendRequest(connect, kNilOptions, &request); - IOI2CInterfaceClose(connect, kNilOptions); - - assert(kIOReturnSuccess == kr); - if(kIOReturnSuccess != request.result) - return 0; - - return 1; -} - -int ddc_read(CGDirectDisplayID display_id, struct DDCReadCommand* p_read) { - UInt8 data[128]; - IOI2CRequest request; - kern_return_t kr; - UInt8 reply_data[11]; - - IOI2CConnectRef connect = display_connection(display_id); - if(!connect) - return 0; - - for (int i=0; i<60; i++) { - bzero( &request, sizeof(request)); - - request.commFlags = 0; - request.sendAddress = 0x6E; - request.sendTransactionType = kIOI2CDDCciReplyTransactionType; - request.sendBuffer = (vm_address_t) &data[0]; - request.sendBytes = 5; - - data[0] = 0x51; - data[1] = 0x82; - data[2] = 0x01; // We want to read this time - data[3] = (*p_read).control_id; - - data[4] = 0x6E ^ data[0] ^ data[1] ^ data[2] ^ data[3]; - - request.replyAddress = 0x6f; - request.replyTransactionType = kIOI2CDDCciReplyTransactionType; - - request.replyBuffer = (vm_address_t) &reply_data[0] ; - request.replyBytes = sizeof(reply_data); - request.minReplyDelay = 10; - - int calculated_checksum; - - bzero( &reply_data[0], request.replyBytes); - - kr = IOI2CSendRequest( connect, kNilOptions, &request ); - - calculated_checksum = 0x6f ^ 0x51 ^ reply_data[1] ^ reply_data[2] ^ reply_data[3] ^ reply_data[4]^ reply_data[5]^ reply_data[6]^ reply_data[7]^ reply_data[8]^ reply_data[9]; - - if ((reply_data[10] == calculated_checksum) && reply_data[4] == data[3] ) { - #ifdef DEBUG - printf("ddc_read: Took %d retries for succesful read\n", i); - #endif - - break; - } - //fprintf(stderr, "READ ERROR\n"); - - } - - IOI2CInterfaceClose(connect, kNilOptions); - - p_read->response.max_value = reply_data[7]; - p_read->response.current_value = reply_data[9]; - - if(kIOReturnSuccess == kr && kIOReturnSuccess == request.result) { - p_read->response.valid = true; - } - else { - p_read->response.valid = false; - - #ifdef DEBUG - printf("ddc_read: error read\n"); - #endif - - return 0; - } - - return 1; -} - -void EDIDRead(CGDirectDisplayID display_id, struct EDID* edid) { - kern_return_t kr; - IOI2CConnectRef connect; - IOI2CRequest request; - UInt8 data[128]; - - if(!(connect = display_connection(display_id))) - return; - - bzero( &request, sizeof(request) ); - - request.commFlags = 0; - request.sendAddress = 0xA0; - request.sendTransactionType = kIOI2CSimpleTransactionType; - request.sendBuffer = (vm_address_t)&data[0]; - request.sendBytes = 0x01; - data[0] = 0x00; - - request.replyAddress = 0xA1; - request.replyTransactionType = kIOI2CSimpleTransactionType; - request.replyBuffer = (vm_address_t)&data[0]; - request.replyBytes = sizeof(data); - request.minReplyDelay = 10; - bzero( &data[0], request.replyBytes ); - - do { - kr = IOI2CSendRequest(connect, kNilOptions, &request); - } while( kIOReturnSuccess != kr ); - - if(kIOReturnSuccess != request.result) - return; - - if(edid) memcpy(edid, &data, 128); - - UInt32 i = 0; - UInt8 sum = 0; - while(i < request.replyBytes) { - if(i % 128 == 0) { - if(sum)break; - sum = 0; - } - sum += data[i++]; - } - - IOI2CInterfaceClose(connect, kNilOptions); -} - diff --git a/BrightnessMenulet/ddc.h b/BrightnessMenulet/ddc.h deleted file mode 100755 index 48074f5..0000000 --- a/BrightnessMenulet/ddc.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * ddc.h - * ddc - * - * Created by Jonathan Taylor on 07/10/2009. - * Copyright 2009 __MyCompanyName__. All rights reserved. - * - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#define RESET 0x04 -#define RESET_BRIGHTNESS_AND_CONTRAST 0x05 -#define RESET_GEOMETRY 0x06 -#define RESET_COLOR 0x08 -#define BRIGHTNESS 0x10 //OK -#define CONTRAST 0x12 //OK -#define RED_GAIN 0x16 -#define GREEN_GAIN 0x18 -#define BLUE_GAIN 0x1A -#define AUTO_SIZE_CENTER 0x1E -#define WIDTH 0x22 -#define HEIGHT 0x32 -#define VERTICAL_POS 0x30 -#define HORIZONTAL_POS 0x20 -#define PINCUSHION_AMP 0x24 -#define PINCUSHION_PHASE 0x42 -#define KEYSTONE_BALANCE 0x40 -#define PINCUSHION_BALANCE 0x26 -#define TOP_PINCUSHION_AMP 0x46 -#define TOP_PINCUSHION_BALANCE 0x48 -#define BOTTOM_PINCUSHION_AMP 0x4A -#define BOTTOM_PINCUSHION_BALANCE 0x4C -#define VERTICAL_LINEARITY 0x3A -#define VERTICAL_LINEARITY_BALANCE 0x3C -#define HORIZONTAL_STATIC_CONVERGENCE 0x28 -#define VERTICAL_STATIC_CONVERGENCE 0x28 -#define MOIRE_CANCEL 0x56 -#define INPUT_SOURCE 0x60 -#define AUDIO_SPEAKER_VOLUME 0x62 -#define RED_BLACK_LEVEL 0x6C -#define GREEN_BLACK_LEVEL 0x6E -#define BLUE_BLACK_LEVEL 0x70 - -#define SETTINGS 0xB0 //unsure on this one -#define ON_SCREEN_DISPLAY 0xCA -#define OSD_LANGUAGE 0xCC -#define DPMS 0xD6 -#define MAGIC_BRIGHT 0xDC //unsure -#define VCP_VERSION 0xDF -#define COLOR_PRESET 0xE0 -#define POWER_CONTROL 0xE1 - -#define TOP_LEFT_SCREEN_PURITY 0xE8 -#define TOP_RIGHT_SCREEN_PURITY 0xE9 -#define BOTTOM_LEFT_SCREEN_PURITY 0xE8 -#define BOTTOM_RIGHT_SCREEN_PURITY 0xEB - -struct DDCWriteCommand { - UInt8 control_id; - UInt8 new_value; -}; - -struct DDCReadResponse { - bool valid; - - UInt8 max_value; - UInt8 current_value; -}; - -struct DDCReadCommand { - UInt8 control_id; - size_t reply_bytes; - unsigned char* reply_buffer; - struct DDCReadResponse response; -}; - -// EDID struct credits to https://github.com/kfix/ddcctl -struct EDID { - UInt64 header : 64; - UInt8 : 1; - UInt16 eisaid :15; - UInt16 productcode : 16; - UInt32 serial : 32; - UInt8 week : 8; - UInt8 year : 8; - UInt8 versionmajor : 8; - UInt8 versionminor : 8; - UInt8 digitalinput : 1; - union inputbitmap { - struct digitalinput { - UInt8 : 6; - UInt8 dfp : 1; - } digital; - struct analoginput { - UInt8 synclevels : 2; - UInt8 pedestal : 1; - UInt8 separate : 1; - UInt8 composite : 1; - UInt8 green : 1; - UInt8 serrated : 1; - } analog; - }; - UInt8 maxh : 8; - UInt8 maxv : 8; - UInt8 gamma : 8; - UInt8 standby : 1; - UInt8 suspend : 1; - UInt8 activeoff : 1; - UInt8 displaytype: 2; - UInt8 srgb : 1; - UInt8 preferredtiming : 1; - UInt8 gtf : 1; - UInt8 redxlsb : 2; - UInt8 redylsb : 2; - UInt8 greenxlsb : 2; - UInt8 greenylsb : 2; - UInt8 bluexlsb : 2; - UInt8 blueylsb : 2; - UInt8 whitexlsb : 2; - UInt8 whiteylsb : 2; - UInt8 redxmsb : 8; - UInt8 redymsb : 8; - UInt8 greenxmsb : 8; - UInt8 greenymsb : 8; - UInt8 bluexmsb : 8; - UInt8 blueymsb : 8; - UInt8 whitexmsb : 8; - UInt8 whiteymsb : 8; - UInt8 t720x400a70 : 1; - UInt8 t720x400a88 : 1; - UInt8 t640x480a60 : 1; - UInt8 t640x480a67 : 1; - UInt8 t640x480a72 : 1; - UInt8 t640x480a75 : 1; - UInt8 t800x600a56 : 1; - UInt8 t800x600a60 : 1; - UInt8 t800x600a72 : 1; - UInt8 t800x600a75 : 1; - UInt8 t832x624a75 : 1; - UInt8 t1024x768a87 : 1; - UInt8 t1024x768a60 : 1; - UInt8 t1024x768a72 : 1; - UInt8 t1024x768a75 : 1; - UInt8 t1280x1024a75 : 1; - UInt8 t1152x870a75 : 1; - UInt8 othermodes : 7; - struct timing { - UInt8 xresolution : 8; - UInt8 ratio : 2; - UInt8 vertical : 6; - } timing1; - struct timing timing2; - struct timing timing3; - struct timing timing4; - struct timing timing5; - struct timing timing6; - struct timing timing7; - struct timing timing8; - union descriptor { - struct timingdetail { - UInt16 clock : 16; - UInt8 hactivelsb : 8; - UInt8 hblankinglsb : 8; - UInt8 hactivemsb : 4; - UInt8 hblankingmsb : 4; - UInt8 vactivelsb : 8; - UInt8 vblankinglsb : 8; - UInt8 vactivemsb : 4; - UInt8 vblankingmsb : 4; - UInt8 hsyncoffsetlsb : 8; - UInt8 hsyncpulselsb : 8; - UInt8 vsyncoffsetlsb : 4; - UInt8 vsyncpulselsb : 4; - UInt8 hsyncoffsetmsb : 2; - UInt8 hsyncpulsemsb : 2; - UInt8 vsyncoffsetmsb : 2; - UInt8 vsyncpulsemsb : 2; - UInt8 hsizelsb : 8; - UInt8 vsizelsb : 8; - UInt8 hsizemsb : 4; - UInt8 vsizemsb : 4; - UInt8 hborder : 8; - UInt8 vborder : 8; - UInt8 interlaced : 1; - UInt8 stereo : 2; - UInt8 synctype : 2; - union sync { - struct analogsync { - UInt8 serrated : 1; - UInt8 syncall : 1; - } analog; - struct digitalsync { - UInt8 vsync : 1; - UInt8 hsync : 1; - } digital; - }; - UInt8 twowaystereo : 1; - } timing; - struct text { - UInt32 : 24; - UInt8 type : 8; - UInt8 : 8; - char data[13]; - } text; - struct __attribute__ ((packed)) rangelimits { - UInt64 header : 40; - UInt8 minvfield : 8; - UInt8 minhfield : 8; - UInt8 minhline : 8; - UInt8 minvline : 8; - UInt8 maxclock : 8; - UInt8 extended : 8; - UInt8 : 8; - UInt8 startfreq : 8; - UInt8 cvalue : 8; - UInt16 mvalue : 16; - UInt8 kvalue : 8; - UInt8 jvalue : 8; - } range; - struct __attribute__ ((packed)) whitepoint { - UInt64 header : 40; - UInt8 index : 8; - UInt8 : 4; - UInt8 whitexlsb : 2; - UInt8 whiteylsb : 2; - UInt8 whitexmsb : 8; - UInt8 whiteymsb : 8; - UInt8 gamma : 8; - UInt8 index2 : 8; - UInt8 : 4; - UInt8 whitexlsb2 : 2; - UInt8 whiteylsb2 : 2; - UInt8 whitexmsb2 : 8; - UInt8 whiteymsb2 : 8; - UInt8 gamma2 : 8; - UInt32 : 24; - } whitepoint; - } descriptor1; - union descriptor descriptor2; - union descriptor descriptor3; - union descriptor descriptor4; - UInt8 extensions : 8; - UInt8 checksum : 8; -}; - -int ddc_write(CGDirectDisplayID display_id, struct DDCWriteCommand * p_write); -int ddc_read(CGDirectDisplayID display_id, struct DDCReadCommand * p_read); -void EDIDRead(CGDirectDisplayID display_id, struct EDID *edid); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/BrightnessMenulet/version.plist b/BrightnessMenulet/version.plist deleted file mode 100755 index 5611992..0000000 --- a/BrightnessMenulet/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 3 - CFBundleVersion - 1.0 - ProductBuildVersion - 9M2729 - ProjectName - DevToolsWizardTemplates - SourceVersion - 11600000 - - diff --git a/BrightnessMenulet/DDCControls.h b/DDCControls/DDCControls.h similarity index 84% rename from BrightnessMenulet/DDCControls.h rename to DDCControls/DDCControls.h index 6b67b6b..8e4bbe3 100644 --- a/BrightnessMenulet/DDCControls.h +++ b/DDCControls/DDCControls.h @@ -7,7 +7,7 @@ // #import -#import "ddc.h" +#import "DDC.h" #import "Screen.h" @@ -19,7 +19,7 @@ + (DDCControls*)singleton; - (NSString*)EDIDString:(char*) string; -- (struct DDCReadResponse)readDisplay:(CGDirectDisplayID)display_id controlValue:(int)control; +- (struct DDCReadCommand)readDisplay:(CGDirectDisplayID)display_id controlValue:(int)control; - (void)changeDisplay:(CGDirectDisplayID)display_id control:(int)control withValue:(int)value; - (void)refreshScreens; diff --git a/BrightnessMenulet/DDCControls.m b/DDCControls/DDCControls.m similarity index 55% rename from BrightnessMenulet/DDCControls.m rename to DDCControls/DDCControls.m index 8048e6f..143dbcd 100644 --- a/BrightnessMenulet/DDCControls.m +++ b/DDCControls/DDCControls.m @@ -10,7 +10,7 @@ @implementation DDCControls -+ (DDCControls*)singleton{ ++ (DDCControls*)singleton { static dispatch_once_t pred = 0; static DDCControls* shared; dispatch_once(&pred, ^{ @@ -20,63 +20,67 @@ + (DDCControls*)singleton{ return shared; } -// // EDID credits to https://github.com/kfix/ddcctl -- (NSString*)EDIDString:(char*) string { - NSString* temp = [[NSString alloc] initWithBytes:string length:13 encoding:NSASCIIStringEncoding]; - - return ([temp rangeOfString:@"\n"].location != NSNotFound) - ? [[temp componentsSeparatedByString:@"\n"] objectAtIndex:0] - : temp; +// EDID credits to https://github.com/kfix/ddcctl +- (NSString*)EDIDString:(char*)string { + NSString *temp = [[NSString alloc] initWithBytes:string length:13 encoding:NSASCIIStringEncoding]; + return ([temp rangeOfString:@"\n"].location != NSNotFound) ? [[temp componentsSeparatedByString:@"\n"] objectAtIndex:0] : temp; } -- (struct DDCReadResponse)readDisplay:(CGDirectDisplayID)display_id controlValue:(int)control{ - struct DDCReadCommand read_command = (struct DDCReadCommand){.control_id = control}; +- (struct DDCReadCommand)readDisplay:(CGDirectDisplayID)display_id controlValue:(int)control { + struct DDCReadCommand read_command = (struct DDCReadCommand) { .control_id = control }; - if(ddc_read(display_id, &read_command) != 1) + if (!DDCRead(display_id, &read_command)) { +#ifdef DEBUG NSLog(@"readDisplay:%u controlValue: failed need to retry...", display_id); +#endif + } - return read_command.response; + return read_command; } -- (void)changeDisplay:(CGDirectDisplayID)display_id control:(int)control withValue:(int)value{ - struct DDCWriteCommand write_command = (struct DDCWriteCommand){.control_id = control, .new_value = value}; +- (void)changeDisplay:(CGDirectDisplayID)display_id control:(int)control withValue:(int)value { + struct DDCWriteCommand write_command = (struct DDCWriteCommand) { .control_id = control, .new_value = value }; - if(ddc_write(display_id, &write_command) != 1) + if (!DDCWrite(display_id, &write_command)) { +#ifdef DEBUG NSLog(@"writeDisplay:%u withValue: failed need to retry...", display_id); +#endif + } } - (void)refreshScreens { NSLog(@"DDCControls: Refreshing Screens"); NSMutableArray* newScreens = [NSMutableArray array]; - for(NSScreen* screen in [NSScreen screens]) { + for (NSScreen* screen in [NSScreen screens]) { // Must call unsignedIntValue to get val NSNumber* screenNumber = screen.deviceDescription[@"NSScreenNumber"]; // Fetch Monitor info via EDID struct EDID edid = {}; - EDIDRead([screenNumber unsignedIntegerValue], &edid); - NSString* name; NSString* serial; - for (NSValue *value in @[[NSValue valueWithPointer:&edid.descriptor1], [NSValue valueWithPointer:&edid.descriptor2], [NSValue valueWithPointer:&edid.descriptor3], [NSValue valueWithPointer:&edid.descriptor4]]) { - union descriptor *des = value.pointerValue; - switch (des->text.type) { - case 0xFF: - serial = [self EDIDString:des->text.data]; - break; - case 0xFC: - name = [self EDIDString:des->text.data]; - break; + + if (EDIDTest([screenNumber unsignedIntValue], &edid)) { + for (union descriptor *des = edid.descriptors; des < edid.descriptors + sizeof(edid.descriptors); des++) { + switch (des->text.type) { + case 0xFF: + serial = [self EDIDString:des->text.data]; + break; + case 0xFC: + name = [self EDIDString:des->text.data]; + break; + } } } // don't want to manage invalid screen or integrated LCD - if(!name || [name isEqualToString:@"Color LCD"] || [name isEqualToString:@"iMac"]) continue; + if (!name || [name isEqualToString:@"Color LCD"] || [name isEqualToString:@"iMac"]) + continue; // Build screen instance NSLog(@"DDCControls: Found %@ - %@", name, screenNumber); - Screen* screen = [[Screen alloc] initWithModel:name screenID:[screenNumber unsignedIntegerValue] serial:serial]; + Screen* screen = [[Screen alloc] initWithModel:name screenID:[screenNumber unsignedIntValue] serial:serial]; [screen refreshValues]; [newScreens addObject:screen]; @@ -84,7 +88,7 @@ - (void)refreshScreens { _screens = [newScreens copy]; - if([newScreens count] == 0) + if ([newScreens count] == 0) NSLog(@"DDCControls: No screens found"); } @@ -93,7 +97,7 @@ - (void)refreshScreenValues{ } - (Screen*)screenForDisplayName:(NSString*)name { - for(Screen* screen in _screens) + for (Screen* screen in _screens) if ([screen.model isEqualToString:name]) return screen; @@ -101,7 +105,7 @@ - (Screen*)screenForDisplayName:(NSString*)name { } - (Screen*)screenForDisplayID:(CGDirectDisplayID)display_id { - for(Screen* screen in _screens) + for (Screen* screen in _screens) if (screen.screenNumber == display_id) return screen; diff --git a/BrightnessMenulet/Screen.h b/DDCControls/Screen.h similarity index 98% rename from BrightnessMenulet/Screen.h rename to DDCControls/Screen.h index 47f43f3..6b5d48d 100644 --- a/BrightnessMenulet/Screen.h +++ b/DDCControls/Screen.h @@ -7,7 +7,7 @@ // #import -#import "ddc.h" +#import "DDC.h" @interface Screen : NSObject diff --git a/BrightnessMenulet/Screen.m b/DDCControls/Screen.m similarity index 73% rename from BrightnessMenulet/Screen.m rename to DDCControls/Screen.m index 899ca5a..0acb726 100644 --- a/BrightnessMenulet/Screen.m +++ b/DDCControls/Screen.m @@ -25,9 +25,9 @@ @interface Screen () @implementation Screen - (instancetype)initWithModel:(NSString*)model screenID:(CGDirectDisplayID)screenID serial:(NSString*)serial { - if((self = [super init])){ + if ((self = [super init])) { _model = [model copy]; - self.screenNumber = screenID; + _screenNumber = screenID; _serial = [serial copy]; _brightnessOutlets = [NSMutableArray array]; @@ -38,10 +38,10 @@ - (instancetype)initWithModel:(NSString*)model screenID:(CGDirectDisplayID)scree } - (void)refreshValues { - struct DDCReadResponse cBrightness = [controls readDisplay:self.screenNumber controlValue:BRIGHTNESS]; - struct DDCReadResponse cContrast = [controls readDisplay:self.screenNumber controlValue:CONTRAST]; + struct DDCReadCommand cBrightness = [controls readDisplay:self.screenNumber controlValue:BRIGHTNESS]; + struct DDCReadCommand cContrast = [controls readDisplay:self.screenNumber controlValue:CONTRAST]; - if (!cBrightness.valid && !cContrast.valid) + if (!cBrightness.success && !cContrast.success) return; self.currentBrightness = cBrightness.current_value; @@ -57,20 +57,22 @@ - (void)refreshValues { } - (void)ddcReadOut { - for(int i=0x00; i<=255; i++){ - struct DDCReadResponse response = [controls readDisplay:self.screenNumber controlValue:i]; + for (int i=0x00; i<=255; i++) { + struct DDCReadCommand response = [controls readDisplay:self.screenNumber controlValue:i]; NSLog(@"VCP: %x - %d / %d \n", i, response.current_value, response.max_value); } } - (void)setBrightness:(NSInteger)brightness { - if(brightness > self.maxBrightness) + if (brightness > self.maxBrightness) brightness = self.maxBrightness; - [controls changeDisplay:self.screenNumber control:BRIGHTNESS withValue: brightness]; + [controls changeDisplay:self.screenNumber control:BRIGHTNESS withValue:(int)brightness]; self.currentBrightness = brightness; +#ifdef DEBUG NSLog(@"Screen: %@ - %ud Brightness changed to %ld", _model, self.screenNumber, (long)self.currentBrightness); +#endif } - (void)setBrightnessWithPercentage:(NSInteger)percentage byOutlet:(NSView*)outlet { @@ -78,13 +80,13 @@ - (void)setBrightnessWithPercentage:(NSInteger)percentage byOutlet:(NSView*)outl } - (void)setBrightness:(NSInteger)brightness byOutlet:(NSView*)outlet { - if(brightness == self.currentBrightness) + if (brightness == self.currentBrightness) return; else [self setBrightness:brightness]; NSMutableArray* dirtyOutlets = [_brightnessOutlets mutableCopy]; - if(outlet) + if (outlet) [dirtyOutlets removeObject:outlet]; [self updateBrightnessOutlets:dirtyOutlets]; @@ -92,23 +94,25 @@ - (void)setBrightness:(NSInteger)brightness byOutlet:(NSView*)outlet { - (void)updateBrightnessOutlets:(NSArray*)outlets { dispatch_async(dispatch_get_main_queue(), ^{ - for(id outlet in outlets){ - if(![outlet isKindOfClass:[NSTextField class]]) - [outlet setMaxValue:_maxBrightness]; + for (id outlet in outlets) { + if (![outlet isKindOfClass:[NSTextField class]]) + [outlet setMaxValue:self.maxBrightness]; - [outlet setIntegerValue:_currentBrightness]; + [outlet setIntegerValue:self.currentBrightness]; } }); } - (void)setContrast:(NSInteger)contrast { - if(contrast > self.maxContrast) + if (contrast > self.maxContrast) contrast = self.maxContrast; - [controls changeDisplay:self.screenNumber control:CONTRAST withValue: contrast]; + [controls changeDisplay:self.screenNumber control:CONTRAST withValue:(int)contrast]; self.currentContrast = contrast; +#ifdef DEBUG NSLog(@"Screen: %@ - %ud Contrast changed to %ld", _model, self.screenNumber, (long)self.currentContrast); +#endif } - (void)setContrastWithPercentage:(NSInteger)percentage byOutlet:(NSView*)outlet { @@ -116,13 +120,13 @@ - (void)setContrastWithPercentage:(NSInteger)percentage byOutlet:(NSView*)outlet } - (void)setContrast:(NSInteger)contrast byOutlet:(NSView*)outlet { - if(contrast == self.currentContrast) + if (contrast == self.currentContrast) return; else [self setContrast:contrast]; NSMutableArray* dirtyOutlets = [_contrastOutlets mutableCopy]; - if(outlet) + if (outlet) [dirtyOutlets removeObject:outlet]; [self updateContrastOutlets:dirtyOutlets]; @@ -130,11 +134,11 @@ - (void)setContrast:(NSInteger)contrast byOutlet:(NSView*)outlet { - (void)updateContrastOutlets:(NSArray*)outlets { dispatch_async(dispatch_get_main_queue(), ^{ - for(id outlet in outlets){ - if(![outlet isKindOfClass:[NSTextField class]]) - [outlet setMaxValue:_maxContrast]; + for (id outlet in outlets) { + if (![outlet isKindOfClass:[NSTextField class]]) + [outlet setMaxValue:self.maxContrast]; - [outlet setIntegerValue:_currentContrast]; + [outlet setIntegerValue:self.currentContrast]; } }); } diff --git a/BrightnessMenulet/LMUController.h b/LMU/LMUController.h similarity index 100% rename from BrightnessMenulet/LMUController.h rename to LMU/LMUController.h diff --git a/BrightnessMenulet/LMUController.m b/LMU/LMUController.m similarity index 85% rename from BrightnessMenulet/LMUController.m rename to LMU/LMUController.m index 72e11f8..01dc186 100644 --- a/BrightnessMenulet/LMUController.m +++ b/LMU/LMUController.m @@ -32,7 +32,7 @@ + (LMUController*)singleton{ } - (instancetype)init { - if((self = [super init])){ + if ((self = [super init])) { _lmuDataPort = 0; [self getLMUDataPort]; @@ -49,11 +49,11 @@ - (io_connect_t)getLMUDataPort { kern_return_t kr; io_service_t serviceObject; - if(_lmuDataPort) return _lmuDataPort; + if (_lmuDataPort) return _lmuDataPort; serviceObject = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleLMUController")); - if(!serviceObject){ + if (!serviceObject) { NSLog(@"LMUController: Failed to find LMU\n"); return 0; } @@ -62,7 +62,7 @@ - (io_connect_t)getLMUDataPort { kr = IOServiceOpen(serviceObject, mach_task_self(), 0, &_lmuDataPort); IOObjectRelease(serviceObject); - if(kr != KERN_SUCCESS){ + if (kr != KERN_SUCCESS) { NSLog(@"LMUController: Failed to open LMU IOService object"); return 0; } @@ -77,7 +77,7 @@ - (void)closeLMUPort { - (void)startMonitoring { // Check if timer already exists of if any screens exist - if(_callbackTimer && ([controls.screens count] == 0)) return; + if (_callbackTimer && ([controls.screens count] == 0)) return; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; @@ -105,10 +105,8 @@ - (void)stopMonitoring { - (NSInteger)percentForSensorValue:(double)sensorVal { // log10(x+1) scale (Weber-Fechner Law) NSInteger percent = log10(sensorVal + 1) * 10; - // lower percentage with p = 100 - x - percent -= (100 - percent); - if(percent < 0) + if (percent < 0) percent = 0; return percent; @@ -122,7 +120,7 @@ - (void)updateTimerCallBack { // 0 = Sensor Reading kr = IOConnectCallScalarMethod(_lmuDataPort, 0, inputValues, inputCount, outputValues, &outputCount); - if(kr != KERN_SUCCESS){ + if (kr != KERN_SUCCESS) { //printf("error getting light sensor values\n"); return; } @@ -131,7 +129,7 @@ - (void)updateTimerCallBack { double avgSensorValue = ((double)(outputValues[0] + outputValues[1]))/2; // Check if fetched sensor value is over max. If so, lid must be closed - if(avgSensorValue > max){ + if (avgSensorValue > max) { NSLog(@"LMUController: No sensor found or Lid closed"); //[self stopMonitoring]; return; @@ -140,24 +138,24 @@ - (void)updateTimerCallBack { NSInteger percent = [self percentForSensorValue:avgSensorValue]; // Add percent to history queue - if(_percentHistory.count == 4) + if (_percentHistory.count == 4) [_percentHistory removeObjectAtIndex:0]; [_percentHistory addObject:[NSNumber numberWithInteger:percent]]; BOOL needsUpdate = NO; - if(_percentHistory.count == 4){ + if (_percentHistory.count == 4) { NSInteger stableReadingCount = 0; - for(int i=1; i<4; i++) - if([_percentHistory[i] integerValue] == percent) + for (int i=1; i<4; i++) + if ([_percentHistory[i] integerValue] == percent) stableReadingCount++; - if(stableReadingCount == 3) needsUpdate = YES; - }else + if (stableReadingCount == 3) needsUpdate = YES; + } else needsUpdate = YES; - if(needsUpdate) - for(Screen* screen in controls.screens) + if (needsUpdate) + for (Screen* screen in controls.screens) [screen setBrightnessWithPercentage:percent byOutlet:nil]; } diff --git a/BrightnessMenulet/LMUDelegate.h b/LMU/LMUDelegate.h similarity index 100% rename from BrightnessMenulet/LMUDelegate.h rename to LMU/LMUDelegate.h diff --git a/BrightnessMenulet/MainMenuController.h b/Menu/MainMenuController.h similarity index 100% rename from BrightnessMenulet/MainMenuController.h rename to Menu/MainMenuController.h diff --git a/BrightnessMenulet/MainMenuController.m b/Menu/MainMenuController.m similarity index 89% rename from BrightnessMenulet/MainMenuController.m rename to Menu/MainMenuController.m index ab94d1a..25b664c 100755 --- a/BrightnessMenulet/MainMenuController.m +++ b/Menu/MainMenuController.m @@ -32,23 +32,23 @@ - (void)refreshMenuScreens { } - (void)setupDisplayLabels { - while(!(self.itemArray[0].isSeparatorItem)) // Remove all current display menu items + while (!(self.itemArray[0].isSeparatorItem)) // Remove all current display menu items [self removeItemAtIndex:0]; - if([controls.screens count] == 0){ + if ([controls.screens count] == 0) { // No screen connected, so disable outlets NSMenuItem* noDispItem = [[NSMenuItem alloc] init]; noDispItem.title = @"No displays found"; [self insertItem:noDispItem atIndex:0]; - if(lmuCon.monitoring) + if (lmuCon.monitoring) [lmuCon stopMonitoring]; return; } // add new outlets for screens - for(Screen* screen in controls.screens){ + for (Screen* screen in controls.screens) { NSString* title = [NSString stringWithFormat:@"%@", screen.model]; NSMenuItem* scrDesc = [[NSMenuItem alloc] init]; scrDesc.title = title; @@ -83,24 +83,24 @@ - (void)setupDisplayLabels { } - (IBAction)toggledAutoBrightness:(NSMenuItem*)sender { - if(sender.state == NSOffState){ + if (sender.state == NSOffState) { [sender setState:NSOnState]; [lmuCon startMonitoring]; - }else{ + } else { [sender setState:NSOffState]; [lmuCon stopMonitoring]; } } - (IBAction)preferences:(id)sender { - if(!_preferencesController) + if (!_preferencesController) _preferencesController = [[PreferencesController alloc] init]; [_preferencesController showWindow]; } - (void)sliderUpdate:(NSSlider*)slider { - [[controls screenForDisplayID:slider.tag] setBrightness:[slider integerValue] byOutlet:slider]; + [[controls screenForDisplayID:(int)slider.tag] setBrightness:[slider integerValue] byOutlet:slider]; } - (IBAction)quit:(id)sender { diff --git a/BrightnessMenulet/Menu.xib b/Menu/Menu.xib similarity index 100% rename from BrightnessMenulet/Menu.xib rename to Menu/Menu.xib diff --git a/BrightnessMenulet/Preferences.xib b/Preferences/Preferences.xib similarity index 100% rename from BrightnessMenulet/Preferences.xib rename to Preferences/Preferences.xib diff --git a/BrightnessMenulet/PreferencesController.h b/Preferences/PreferencesController.h similarity index 100% rename from BrightnessMenulet/PreferencesController.h rename to Preferences/PreferencesController.h diff --git a/BrightnessMenulet/PreferencesController.m b/Preferences/PreferencesController.m similarity index 87% rename from BrightnessMenulet/PreferencesController.m rename to Preferences/PreferencesController.m index 68d37ed..8942b17 100644 --- a/BrightnessMenulet/PreferencesController.m +++ b/Preferences/PreferencesController.m @@ -43,8 +43,7 @@ @implementation PreferencesController - (void)showWindow { // Must support atleast OSX 10.8 because of loadNibNamed:owner:topLevelObjects - if(!_preferenceWindow){ - NSLog(@"PreferencesController: Pref Window alloc"); + if (!_preferenceWindow) { [[NSBundle mainBundle] loadNibNamed:@"Preferences" owner:self topLevelObjects:nil]; _preferenceWindow.delegate = self; @@ -69,10 +68,10 @@ - (void)showWindow { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; float updateInterval = [defaults floatForKey:@"LMUUpdateInterval"]; - if(updateInterval <= 0) + if (updateInterval <= 0) updateInterval = 0.1; - for(id outlet in _updateIntervalOutlets) + for (id outlet in _updateIntervalOutlets) [outlet setFloatValue:updateInterval]; } @@ -93,22 +92,22 @@ - (void)showWindow { - (void)updateBrightnessControls { NSInteger currentBrightness = _currentScreen.currentBrightness; - for(id brightnessOutlet in _brightnessOutlets){ - if(![brightnessOutlet isKindOfClass:[NSTextField class]]) + for (id brightnessOutlet in _brightnessOutlets) { + if (![brightnessOutlet isKindOfClass:[NSTextField class]]) [brightnessOutlet setMaxValue:_currentScreen.maxBrightness]; - [brightnessOutlet setIntValue:currentBrightness]; + [brightnessOutlet setIntegerValue:currentBrightness]; } } - (void)updateContrastControls { NSInteger currentContrast = _currentScreen.currentContrast; - for(id contrastOutlet in _contrastOutlets){ - if(![contrastOutlet isKindOfClass:[NSTextField class]]) + for (id contrastOutlet in _contrastOutlets) { + if (![contrastOutlet isKindOfClass:[NSTextField class]]) [contrastOutlet setMaxValue:_currentScreen.maxContrast]; - [contrastOutlet setIntValue:currentContrast]; + [contrastOutlet setIntegerValue:currentContrast]; } } @@ -120,7 +119,7 @@ - (void)refreshScreenPopUpList { [controls refreshScreenValues]; - if([controls.screens count] == 0){ + if ([controls.screens count] == 0) { // no screens so disable outlets [_displayPopUpButton setEnabled:NO]; @@ -132,11 +131,11 @@ - (void)refreshScreenPopUpList { } // Add new screens - for(Screen* screen in controls.screens) + for (Screen* screen in controls.screens) [_displayPopUpButton addItemWithTitle:screen.model]; - if(!_brightCStepper.enabled) - for(id outlet in [_brightnessOutlets arrayByAddingObjectsFromArray:_contrastOutlets]) + if (!_brightCStepper.enabled) + for (id outlet in [_brightnessOutlets arrayByAddingObjectsFromArray:_contrastOutlets]) [outlet setEnabled:YES]; [_displayPopUpButton selectItemAtIndex:0]; @@ -184,7 +183,7 @@ - (IBAction)brightnessOutletValueChanged:(id)sender{ NSMutableArray* dirtyOutlets = [_brightnessOutlets mutableCopy]; [dirtyOutlets removeObject:sender]; - for(id outlet in dirtyOutlets) + for (id outlet in dirtyOutlets) [outlet setIntegerValue:[sender integerValue]]; } @@ -194,7 +193,7 @@ - (IBAction)contrastOutletValueChanged:(id)sender{ NSMutableArray* dirtyOutlets = [_contrastOutlets mutableCopy]; [dirtyOutlets removeObject:sender]; - for(id outlet in dirtyOutlets) + for (id outlet in dirtyOutlets) [outlet setIntegerValue:[sender integerValue]]; } @@ -210,9 +209,9 @@ - (IBAction)updateIntOutletValueChanged:(id)sender { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; float value = [sender floatValue]; - if(value > _updateIntervalSlider.maxValue) + if (value > _updateIntervalSlider.maxValue) value = _updateIntervalSlider.maxValue; - else if(value <= 0) + else if (value <= 0) value = 0.1; [defaults setFloat:value forKey:@"LMUUpdateInterval"]; @@ -220,7 +219,7 @@ - (IBAction)updateIntOutletValueChanged:(id)sender { NSMutableArray* dirtyOutlets = [_updateIntervalOutlets mutableCopy]; [dirtyOutlets removeObject:sender]; - for(id outlet in dirtyOutlets) + for (id outlet in dirtyOutlets) [outlet setFloatValue:value]; } @@ -233,12 +232,10 @@ - (void)windowWillClose:(NSNotification *)notification { _preferenceWindow = nil; // RestartLMU Controller to apply any interval changes - if(lmuCon.monitoring) { + if (lmuCon.monitoring) { [lmuCon stopMonitoring]; [lmuCon startMonitoring]; } - - NSLog(@"PreferencesController: preferenceWindow Dealloc"); } @end diff --git a/README.rst b/README.rst index 65fc2fd..a9bd46a 100644 --- a/README.rst +++ b/README.rst @@ -3,61 +3,24 @@ Brightness Menulet Allows you to control monitor brigthness via menu in status bar. -This tool works on OSX 10.8+. In 10.8+, I2C tools are not able to detect monitor buses for communication. -The main API calls for DDC communication is deprecated so this project could be obselete if Apple -completely removes CGDisplayIOServicePort. If you have tested your monitor(s) with this tool, please -let me know wether it worked or not so I can add monitor models here. Preference's Debug button logs to the -console VCP codes and their values on the selected monitor. - -Download app build: `BrightnessMenulet.zip`_. +Download latest app build in the releases tab. .. _BrightnessMenulet.zip: - https://raw.github.com/kalvin126/BrightnessMenulet/master/BrightnessMenulet/Brightness_Menulet.zip - -.. image:: https://raw.github.com/kalvin126/BrightnessMenulet/master/BrightnessMenulet/screenshot.png - -Monitors: -....................... -+------------------+---------------+ -| Working | Non-Working | -+==================+===============+ -| Dell U2014h | Dell P2715Q | -+------------------+---------------+ -| Dell U2414h | Philips 4065UC| -+------------------+---------------+ -| Dell U2415h | Dell P2412H | -+------------------+---------------+ -| Dell U2515h | Dell U2412M | -+------------------+---------------+ -| Dell U2715h | | -+------------------+---------------+ -| Dell U2713HM | | -+------------------+---------------+ -| Dell P2415Q | | -+------------------+---------------+ -| Dell S2216M | | -+------------------+---------------+ -| Samsung SA 350 | | -+------------------+---------------+ -| BenQ G2410HD | | -+------------------+---------------+ -| Viseo 230Ws | | -+------------------+---------------+ - -If you have tested your monitor(s) with this tool, please let me know whether or not it work and I will update this table. + https://raw.github.com/kalvin126/BrightnessMenulet/master/Resources/Brightness_Menulet.zip +.. image:: https://raw.github.com/kalvin126/BrightnessMenulet/master/Resources/screenshot.png Features: ............ -- Automatic Brightness using built in light sensor (Modify LMUController’s percentageForSensorValue: to your liking) -- Multi-Monitor support (no limit to amount of monitors)! -- Compatible with OSX 10.8+ +- Automatic Brightness using built in light sensor +- Multi-Monitor support (no limit to amount of monitors!) +- *Runnable* with OSX 10.8+ (Mileage will vary per monitor/GPU combination) +- Logs VCP codes to console Roadmap: ........ -- Support for other monitor makes (Currently only tested on Dell and certian HP displays) - Time based settings - Add keyboard bindings @@ -67,7 +30,7 @@ Credits: - `Alec Jacobson`_ - `original Brightness Menulet app`_ creator - Jon Taylor - `DDC/CI bindings`_ - Victor Miroshnikov - copy&paste&debug job -- `Joey Korkames`_: EDID Reading +- `Joey Korkames`_: DDC / ddcctl .. _DDC/CI bindings: https://github.com/jontaylor/DDC-CI-Tools-for-OS-X diff --git a/BrightnessMenulet/brightness-sun-transparent-black.icns b/Resources/brightness-sun-transparent-black.icns similarity index 100% rename from BrightnessMenulet/brightness-sun-transparent-black.icns rename to Resources/brightness-sun-transparent-black.icns diff --git a/BrightnessMenulet/icon-alt.png b/Resources/icon-alt.png similarity index 100% rename from BrightnessMenulet/icon-alt.png rename to Resources/icon-alt.png diff --git a/BrightnessMenulet/icon.png b/Resources/icon.png similarity index 100% rename from BrightnessMenulet/icon.png rename to Resources/icon.png diff --git a/BrightnessMenulet/mccsV3.pdf b/Resources/mccsV3.pdf similarity index 100% rename from BrightnessMenulet/mccsV3.pdf rename to Resources/mccsV3.pdf diff --git a/BrightnessMenulet/screenshot.png b/Resources/screenshot.png similarity index 100% rename from BrightnessMenulet/screenshot.png rename to Resources/screenshot.png diff --git a/BrightnessMenulet/BrightnessMenulet_Prefix.pch b/Supporting Files/BrightnessMenulet_Prefix.pch similarity index 100% rename from BrightnessMenulet/BrightnessMenulet_Prefix.pch rename to Supporting Files/BrightnessMenulet_Prefix.pch diff --git a/BrightnessMenulet/Info.plist b/Supporting Files/Info.plist similarity index 100% rename from BrightnessMenulet/Info.plist rename to Supporting Files/Info.plist diff --git a/BrightnessMenulet/main.m b/Supporting Files/main.m similarity index 83% rename from BrightnessMenulet/main.m rename to Supporting Files/main.m index 473580d..c8fd264 100755 --- a/BrightnessMenulet/main.m +++ b/Supporting Files/main.m @@ -8,6 +8,6 @@ #import -int main(int argc, const char * argv[]){ +int main(int argc, const char * argv[]) { return NSApplicationMain(argc, argv); } diff --git a/ddcctl b/ddcctl new file mode 160000 index 0000000..3d38860 --- /dev/null +++ b/ddcctl @@ -0,0 +1 @@ +Subproject commit 3d38860d5b1de15199a42d9c5a34756738ca9b2a