Mercurial > minori
diff dep/animia/src/win/quartz.mm @ 156:cdf79282d647
dep/animia: add VERY early x11 window stuff
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 15 Nov 2023 18:04:04 -0500 |
parents | d2bbb5773616 |
children | 44c5e6dd9488 |
line wrap: on
line diff
--- a/dep/animia/src/win/quartz.mm Wed Nov 15 15:24:39 2023 -0500 +++ b/dep/animia/src/win/quartz.mm Wed Nov 15 18:04:04 2023 -0500 @@ -11,36 +11,32 @@ static bool IntegerFromNSNumber(NSNumber* num, T& result) { if (!num) return false; + result = [num intValue]; return true; } +static bool StringFromNSString(NSString* string, std::string& result) { + if (!string) + return false; + + result = [string UTF8String]; + return true; +} + static bool GetWindowTitle(unsigned int wid, std::string& result) { NSWindow* window = [NSApp windowWithWindowNumber: wid]; if (!window) return false; - NSString* title = [window title]; - if (!title) - return false; - - result = [title UTF8String]; - - return true; -} - -static bool StringFromNSString(NSString* string, std::string& result) { - if (!string) - return false; - result = [string UTF8String]; - return true; + return StringFromNSString([window title], result); } bool QuartzWinTools::EnumerateWindows(window_proc_t window_proc) { if (!window_proc) return false; - NSMutableArray* windows = (NSMutableArray*)CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID); + NSMutableArray* windows = reinterpret_cast<NSMutableArray*>(CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID)); if (!windows) return false;