comparison dep/animia/src/win/quartz.mm @ 163:44c5e6dd9488

dep/animia/osx: move GetProcessName to util/osx so we can use it in quartz
author Paper <mrpapersonic@gmail.com>
date Sat, 18 Nov 2023 00:47:40 -0500
parents cdf79282d647
children c413e475f496
comparison
equal deleted inserted replaced
162:61b76c7b656a 163:44c5e6dd9488
1 #include "animia/win/quartz.h" 1 #include "animia/win/quartz.h"
2 #include "animia.h" 2 #include "animia.h"
3 3
4 #include <Foundation/Foundation.h> 4 #import <Foundation/Foundation.h>
5 #include <CoreGraphics/CoreGraphics.h> 5 #import <CoreGraphics/CoreGraphics.h>
6 #include <AppKit/AppKit.h> 6 #import <AppKit/AppKit.h>
7 7
8 namespace animia::internal::quartz { 8 namespace animia::internal::quartz {
9 9
10 template<typename T> 10 template<typename T>
11 static bool IntegerFromNSNumber(NSNumber* num, T& result) { 11 static bool IntegerFromNSNumber(NSNumber* num, T& result) {
46 46
47 Process proc; 47 Process proc;
48 { 48 {
49 IntegerFromNSNumber([window objectForKey:@"kCGWindowOwnerPID"], proc.pid); 49 IntegerFromNSNumber([window objectForKey:@"kCGWindowOwnerPID"], proc.pid);
50 StringFromNSString([window objectForKey:@"kCGWindowOwnerName"], proc.name); 50 StringFromNSString([window objectForKey:@"kCGWindowOwnerName"], proc.name);
51 if (proc.name.empty())
52 osx::util::GetProcessName(proc.pid, proc.name);
51 } 53 }
52 54
53 Window win; 55 Window win;
54 { 56 {
55 IntegerFromNSNumber([window objectForKey:@"kCGWindowNumber"], win.id); 57 IntegerFromNSNumber([window objectForKey:@"kCGWindowNumber"], win.id);