Mercurial > minori
changeset 271:f01b6e9c8fa2
dep/animone: make OS X code build
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 14 Apr 2024 22:28:50 -0400 |
parents | 0718f538c5f9 |
children | 5437009cb10e |
files | configure.ac dep/animone/src/win/quartz.cc m4/m4_ax_have_qt.m4 |
diffstat | 3 files changed, 16 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Apr 12 19:13:50 2024 -0400 +++ b/configure.ac Sun Apr 14 22:28:50 2024 -0400 @@ -13,7 +13,6 @@ AC_PROG_CC dnl Do we have a C++17 compiler -: ${CXXFLAGS=""} AC_PROG_CXX AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
--- a/dep/animone/src/win/quartz.cc Fri Apr 12 19:13:50 2024 -0400 +++ b/dep/animone/src/win/quartz.cc Sun Apr 14 22:28:50 2024 -0400 @@ -18,7 +18,13 @@ namespace animone::internal::quartz { template<typename T> -using CFPtr = std::unique_ptr<T, CFDecontructor<T>>; +struct CFDeconstructor { + using pointer = T; + void operator()(pointer t) const { ::CFRelease(t); }; +}; + +template<typename T> +using CFPtr = std::unique_ptr<T, CFDeconstructor<T>>; #if __LP64__ typedef long NSInteger; @@ -100,23 +106,17 @@ return true; } -template<typename T> -struct CFDeconstructor { - using pointer = T; - void operator()(pointer t) const { ::CFRelease(t); }; -}; - static bool GetWindowTitleAccessibility(unsigned int wid, pid_t pid, std::string& result) { CGRect bounds = {0}; { const CGWindowID wids[1] = {wid}; CFPtr<CFArrayRef> arr(CFArrayCreate(kCFAllocatorDefault, (CFTypeRef*)wids, 1, NULL)); - CFPtr<CFArrayRef> dicts(CGWindowListCreateDescriptionFromArray(arr)); + CFPtr<CFArrayRef> dicts(CGWindowListCreateDescriptionFromArray(arr.get())); if (!dicts.get() || CFArrayGetCount(dicts.get()) < 1) return false; - CFDictionaryRef dict = reinterpret_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(dicts, 0)); + CFDictionaryRef dict = reinterpret_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(dicts.get(), 0)); if (!dict) return false; @@ -151,7 +151,7 @@ if (AXUIElementCopyAttributeValue(window, kAXPositionAttribute, reinterpret_cast<CFTypeRef*>(&val)) == kAXErrorSuccess) { CGPoint point; - if (!AXValueGetValue(val, kAXValueTypeCGPoint, reinterpret_cast<CFTypeRef>(&point)) || + if (!AXValueGetValue(val, kAXValueCGPointType, reinterpret_cast<void*>(&point)) || (point.x != bounds.origin.x || point.y != bounds.origin.y)) { CFRelease(val); continue; @@ -166,7 +166,7 @@ if (AXUIElementCopyAttributeValue(window, kAXSizeAttribute, reinterpret_cast<CFTypeRef*>(&val)) == kAXErrorSuccess) { CGSize size; - if (!AXValueGetValue(val, kAXValueTypeCGSize, reinterpret_cast<CFTypeRef>(&size)) || + if (!AXValueGetValue(val, kAXValueCGSizeType, reinterpret_cast<void*>(&size)) || (size.width != bounds.size.width || size.height != bounds.size.height)) { CFRelease(val); continue; @@ -211,7 +211,7 @@ static bool GetProcessBundleIdentifierNew(pid_t pid, std::string& result) { /* 10.6 and higher */ const id app = - cls_send(objc_getClass("NSRunningApplication"), sel_getUid("runningApplicationWithProcessIdentifier:"), pid); + cls_send((Class)objc_getClass("NSRunningApplication"), sel_getUid("runningApplicationWithProcessIdentifier:"), pid); if (!app) return false; @@ -228,11 +228,11 @@ if (GetProcessForPID(pid, &psn)) return false; - CFPtr<CFDictionaryRef> info = ProcessInformationCopyDictionary(psn, kProcessDictionaryIncludeAllInformationMask); + CFPtr<CFDictionaryRef> info(ProcessInformationCopyDictionary(&psn, kProcessDictionaryIncludeAllInformationMask)); if (!info) return false; - CFStringRef value = reinterpret_cast<CFStringRef>(CFDictionaryGetValue(dict, CFSTR("CFBundleIdentifier"))); + CFStringRef value = reinterpret_cast<CFStringRef>(CFDictionaryGetValue(info.get(), CFSTR("CFBundleIdentifier"))); if (!value) return false; @@ -247,7 +247,7 @@ if (GetProcessBundleIdentifierNew(pid, result)) return true; - return GetProcessBundleIdentifierOld(); + return GetProcessBundleIdentifierOld(pid, result); } bool EnumerateWindows(window_proc_t window_proc) {
--- a/m4/m4_ax_have_qt.m4 Fri Apr 12 19:13:50 2024 -0400 +++ b/m4/m4_ax_have_qt.m4 Sun Apr 14 22:28:50 2024 -0400 @@ -77,7 +77,7 @@ if test "$ver" ">" "Qt version 4"; then have_qt=yes # This pro file dumps qmake's variables, but it only works on Qt 5 or later - am_have_qt_dir=`mktemp -d` + am_have_qt_dir=$(mktemp -d || mktemp -d -t tmp) am_have_qt_pro="$am_have_qt_dir/test.pro" am_have_qt_stash="$am_have_qt_dir/.qmake.stash" am_have_qt_makefile="$am_have_qt_dir/Makefile"