Mercurial > minori
comparison dep/animone/src/win/quartz.cc @ 404:e561b7542b7b
*: fix build on mac os x
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 19 Jan 2026 20:50:40 -0500 |
| parents | adb79bdde329 |
| children |
comparison
equal
deleted
inserted
replaced
| 403:df4a027623d0 | 404:e561b7542b7b |
|---|---|
| 104 return false; | 104 return false; |
| 105 | 105 |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 static bool GetWindowTitleAccessibility(unsigned int wid, pid_t pid, std::string& result) { | 109 static bool GetWindowTitleAccessibility(CGWindowID wid, pid_t pid, std::string& result) { |
| 110 CGRect bounds = {0}; | 110 CGRect bounds = {0}; |
| 111 { | 111 { |
| 112 const CGWindowID wids[1] = {wid}; | 112 const CGWindowID wids[1] = {wid}; |
| 113 CFPtr<CFArrayRef> arr(CFArrayCreate(kCFAllocatorDefault, (CFTypeRef*)wids, 1, NULL)); | 113 CFPtr<CFArrayRef> arr(CFArrayCreate(kCFAllocatorDefault, (CFTypeRef*)wids, 1, NULL)); |
| 114 CFPtr<CFArrayRef> dicts(CGWindowListCreateDescriptionFromArray(arr.get())); | 114 CFPtr<CFArrayRef> dicts(CGWindowListCreateDescriptionFromArray(arr.get())); |
| 188 } | 188 } |
| 189 | 189 |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 static bool GetWindowTitle(unsigned int wid, pid_t pid, std::string& result) { | 193 static bool GetWindowTitle(CGWindowID wid, pid_t pid, std::string& result) { |
| 194 /* try using CoreGraphics (only usable on old versions of OS X) */ | 194 /* try using CoreGraphics (only usable on old versions of OS X) */ |
| 195 if ((CGSDefaultConnectionForThread && CGSCopyWindowProperty) || GetCoreGraphicsPrivateSymbols()) { | 195 if ((CGSDefaultConnectionForThread && CGSCopyWindowProperty) || GetCoreGraphicsPrivateSymbols()) { |
| 196 CFPtr<CFStringRef> title; | 196 CFPtr<CFStringRef> title; |
| 197 { | 197 { |
| 198 CFStringRef t = nullptr; | 198 CFStringRef t = nullptr; |
| 266 | 266 |
| 267 Process proc; | 267 Process proc; |
| 268 proc.platform = ExecutablePlatform::Xnu; | 268 proc.platform = ExecutablePlatform::Xnu; |
| 269 CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerPID"), proc.pid); | 269 CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerPID"), proc.pid); |
| 270 if (!CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerName"), proc.comm)) | 270 if (!CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerName"), proc.comm)) |
| 271 fd::GetProcessName(proc.pid, proc.comm); | 271 GetProcessName(proc.pid, proc.comm); |
| 272 | 272 |
| 273 Window win; | 273 Window win; |
| 274 win.platform = WindowPlatform::Quartz; | 274 win.platform = WindowPlatform::Quartz; |
| 275 CFDictionaryGetValue(window, CFSTR("kCGWindowNumber"), win.id.quartz); | 275 CFDictionaryGetValue(window, CFSTR("kCGWindowNumber"), win.id.quartz); |
| 276 | 276 |
| 277 GetProcessBundleIdentifier(proc.pid, win.class_name); | 277 GetProcessBundleIdentifier(proc.pid, win.class_name); |
| 278 GetWindowTitle(win.id, proc.pid, win.text); | 278 GetWindowTitle(win.id.quartz, proc.pid, win.text); |
| 279 | 279 |
| 280 if (!window_proc(proc, win)) { | 280 if (!window_proc(proc, win)) { |
| 281 CFRelease(windows); | 281 CFRelease(windows); |
| 282 return false; | 282 return false; |
| 283 } | 283 } |
