macOS fixes.

This commit is contained in:
byuu 2019-08-17 23:53:21 +09:00
parent 5ba538ee39
commit ab25877af4
2 changed files with 3 additions and 3 deletions

View File

@ -17,11 +17,11 @@
} }
-(void) textDidChange:(NSNotification*)n { -(void) textDidChange:(NSNotification*)n {
lineEdit->state.text = [[self stringValue] UTF8String];
lineEdit->doChange(); lineEdit->doChange();
} }
-(IBAction) activate:(id)sender { -(IBAction) activate:(id)sender {
lineEdit->state.text = [[self stringValue] UTF8String];
lineEdit->doActivate(); lineEdit->doActivate();
} }

View File

@ -329,12 +329,12 @@ auto Video::hasMonitors() -> vector<Monitor> {
auto dictionary = IODisplayCreateInfoDictionary(displayPort, 0); auto dictionary = IODisplayCreateInfoDictionary(displayPort, 0);
if(auto names = CFDictionaryGetValue(dictionary, CFSTR(kDisplayProductName))) { if(auto names = CFDictionaryGetValue(dictionary, CFSTR(kDisplayProductName))) {
auto languageKeys = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); auto languageKeys = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
CFDictionaryApplyFunction(names, MonitorKeyArrayCallback, (void*)languageKeys); CFDictionaryApplyFunction((CFDictionaryRef)names, MonitorKeyArrayCallback, (void*)languageKeys);
auto orderLanguageKeys = CFBundleCopyPreferredLocalizationsFromArray(languageKeys); auto orderLanguageKeys = CFBundleCopyPreferredLocalizationsFromArray(languageKeys);
CFRelease(languageKeys); CFRelease(languageKeys);
if(orderLanguageKeys && CFArrayGetCount(orderLanguageKeys)) { if(orderLanguageKeys && CFArrayGetCount(orderLanguageKeys)) {
auto languageKey = CFArrayGetValueAtIndex(orderLanguageKeys, 0); auto languageKey = CFArrayGetValueAtIndex(orderLanguageKeys, 0);
auto localName = CFDictionaryGetValue(names, languageKey); auto localName = CFDictionaryGetValue((CFDictionaryRef)names, languageKey);
monitor.name = {1 + monitors.size(), ": ", [(__bridge NSString*)localName UTF8String]}; monitor.name = {1 + monitors.size(), ": ", [(__bridge NSString*)localName UTF8String]};
CFRelease(localName); CFRelease(localName);
} }