comparison dep/animone/src/win/quartz.cc @ 299:246017a7907a

dep/animone: clean up OS X code GetProcessName() really belongs in fd.cc after removing the stupid unnecessary LaunchServices code that was stolen from... some library :)
author Paper <paper@paper.us.eu.org>
date Mon, 13 May 2024 14:15:47 -0400
parents 5437009cb10e
children a7d4e5107531
comparison
equal deleted inserted replaced
298:dec4d3c9a909 299:246017a7907a
3 * 3 *
4 * This file does not require an Objective-C++ compiler, 4 * This file does not require an Objective-C++ compiler,
5 * but it *does* require an Objective-C runtime. 5 * but it *does* require an Objective-C runtime.
6 */ 6 */
7 #include "animone/win/quartz.h" 7 #include "animone/win/quartz.h"
8 #include "animone/fd.h"
8 #include "animone.h" 9 #include "animone.h"
9 #include "animone/util/osx.h"
10 10
11 #include <objc/message.h> 11 #include <objc/message.h>
12 #include <objc/runtime.h> 12 #include <objc/runtime.h>
13 13
14 #include <ApplicationServices/ApplicationServices.h> 14 #include <ApplicationServices/ApplicationServices.h>
266 266
267 Process proc; 267 Process proc;
268 { 268 {
269 CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerPID"), proc.pid); 269 CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerPID"), proc.pid);
270 if (!CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerName"), proc.name)) 270 if (!CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerName"), proc.name))
271 osx::util::GetProcessName(proc.pid, proc.name); 271 fd::GetProcessName(proc.pid, proc.name);
272 } 272 }
273 273
274 Window win; 274 Window win;
275 { 275 {
276 CFDictionaryGetValue(window, CFSTR("kCGWindowNumber"), win.id); 276 CFDictionaryGetValue(window, CFSTR("kCGWindowNumber"), win.id);
277 277
278 if (!GetProcessBundleIdentifier(proc.pid, win.class_name)) 278 if (!GetProcessBundleIdentifier(proc.pid, win.class_name))
279 // Fallback to the Quartz window name, which is unlikely to be filled, but it 279 /* XXX is this right? */
280 // *could* be.
281 CFDictionaryGetValue(window, CFSTR("kCGWindowName"), win.class_name); 280 CFDictionaryGetValue(window, CFSTR("kCGWindowName"), win.class_name);
282 281
283 GetWindowTitle(win.id, proc.pid, win.text); 282 GetWindowTitle(win.id, proc.pid, win.text);
284 } 283 }
285 284