comparison dep/animia/src/win/quartz.cc @ 192:50108040d792

dep/animia/quartz: GetWindowBundleIdentifier -> GetProcessBundleIdentifier
author Paper <mrpapersonic@gmail.com>
date Thu, 07 Dec 2023 01:50:29 -0500
parents 0fc126d52de4
children c4ca035c565d
comparison
equal deleted inserted replaced
191:0fc126d52de4 192:50108040d792
39 39
40 // return [title UTF8String]; 40 // return [title UTF8String];
41 return osx::util::StringFromCFString(title, result); 41 return osx::util::StringFromCFString(title, result);
42 } 42 }
43 43
44 static bool GetWindowBundleIdentifier(pid_t pid, std::string& result) { 44 static bool GetProcessBundleIdentifier(pid_t pid, std::string& result) {
45 /* The Bundle ID is essentially OS X's solution to Windows' 45 /* The Bundle ID is essentially OS X's solution to Windows'
46 * "class name"; theoretically, it should be different for 46 * "class name"; theoretically, it should be different for
47 * each program, although it requires an app bundle. 47 * each program, although it requires an app bundle.
48 */ 48 */
49 49
96 { 96 {
97 CFNumberRef num = nullptr; 97 CFNumberRef num = nullptr;
98 if (CFDictionaryGetValueIfPresent(window, CFSTR("kCGWindowNumber"), reinterpret_cast<const void**>(&num)) && num) 98 if (CFDictionaryGetValueIfPresent(window, CFSTR("kCGWindowNumber"), reinterpret_cast<const void**>(&num)) && num)
99 osx::util::GetCFNumber(num, win.id); 99 osx::util::GetCFNumber(num, win.id);
100 } 100 }
101 if (!GetWindowBundleIdentifier(proc.pid, win.class_name)) { 101 if (!GetProcessBundleIdentifier(proc.pid, win.class_name)) {
102 // Fallback to the Quartz window name, which is unlikely to be filled, but it 102 // Fallback to the Quartz window name, which is unlikely to be filled, but it
103 // *could* be. 103 // *could* be.
104 CFStringRef str = nullptr; 104 CFStringRef str = nullptr;
105 if (CFDictionaryGetValueIfPresent(window, CFSTR("kCGWindowName"), reinterpret_cast<const void**>(&str)) && str) 105 if (CFDictionaryGetValueIfPresent(window, CFSTR("kCGWindowName"), reinterpret_cast<const void**>(&str)) && str)
106 osx::util::StringFromCFString(str, win.class_name); 106 osx::util::StringFromCFString(str, win.class_name);