changeset 404:e561b7542b7b default tip

*: fix build on mac os x
author Paper <paper@tflc.us>
date Mon, 19 Jan 2026 20:50:40 -0500
parents df4a027623d0
children
files dep/animone/include/animone/types.h dep/animone/src/win/quartz.cc include/core/filesystem.h include/library/library.h src/core/date.cc src/core/filesystem.cc
diffstat 6 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dep/animone/include/animone/types.h	Mon Nov 10 15:51:45 2025 -0500
+++ b/dep/animone/include/animone/types.h	Mon Jan 19 20:50:40 2026 -0500
@@ -30,7 +30,7 @@
 /* different window systems have different sized IDs */
 union ANIMONE_API wid_t {
 	std::uintptr_t win32; // XXX this ought to be a `void *`
-	std::int64_t quartz; // FIXME is this correct?
+	std::uint32_t quartz;
 	std::uint32_t x11;
 };
 
--- a/dep/animone/src/win/quartz.cc	Mon Nov 10 15:51:45 2025 -0500
+++ b/dep/animone/src/win/quartz.cc	Mon Jan 19 20:50:40 2026 -0500
@@ -106,7 +106,7 @@
 	return true;
 }
 
-static bool GetWindowTitleAccessibility(unsigned int wid, pid_t pid, std::string& result) {
+static bool GetWindowTitleAccessibility(CGWindowID wid, pid_t pid, std::string& result) {
 	CGRect bounds = {0};
 	{
 		const CGWindowID wids[1] = {wid};
@@ -190,7 +190,7 @@
 	return false;
 }
 
-static bool GetWindowTitle(unsigned int wid, pid_t pid, std::string& result) {
+static bool GetWindowTitle(CGWindowID wid, pid_t pid, std::string& result) {
 	/* try using CoreGraphics (only usable on old versions of OS X) */
 	if ((CGSDefaultConnectionForThread && CGSCopyWindowProperty) || GetCoreGraphicsPrivateSymbols()) {
 		CFPtr<CFStringRef> title;
@@ -268,14 +268,14 @@
 		proc.platform = ExecutablePlatform::Xnu;
 		CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerPID"), proc.pid);
 		if (!CFDictionaryGetValue(window, CFSTR("kCGWindowOwnerName"), proc.comm))
-			fd::GetProcessName(proc.pid, proc.comm);
+			GetProcessName(proc.pid, proc.comm);
 
 		Window win;
 		win.platform = WindowPlatform::Quartz;
 		CFDictionaryGetValue(window, CFSTR("kCGWindowNumber"), win.id.quartz);
 
 		GetProcessBundleIdentifier(proc.pid, win.class_name);
-		GetWindowTitle(win.id, proc.pid, win.text);
+		GetWindowTitle(win.id.quartz, proc.pid, win.text);
 
 		if (!window_proc(proc, win)) {
 			CFRelease(windows);
--- a/include/core/filesystem.h	Mon Nov 10 15:51:45 2025 -0500
+++ b/include/core/filesystem.h	Mon Jan 19 20:50:40 2026 -0500
@@ -3,6 +3,7 @@
 #include <filesystem>
 #include <functional>
 #include <string>
+#include <unordered_map>
 
 namespace Filesystem {
 
@@ -13,6 +14,15 @@
 std::filesystem::path GetTorrentsPath();     // (dotpath)/torrents/...
 std::filesystem::path GetAnimePostersPath(); // (dotpath)/anime/posters/
 
+struct PathHash {
+	auto operator()(const std::filesystem::path &p) const noexcept {
+		return std::filesystem::hash_value(p);
+	}
+};
+
+template<typename T>
+using PathMap = std::unordered_map<std::filesystem::path, T, PathHash>;
+
 /* ------------------------------------------------------------------------ */
 /* Filesystem watcher interface. This is implemented differently on
  * different platforms :) */
--- a/include/library/library.h	Mon Nov 10 15:51:45 2025 -0500
+++ b/include/library/library.h	Mon Jan 19 20:50:40 2026 -0500
@@ -32,7 +32,7 @@
 private:
 	void Refresh(std::optional<int> find_id);
 
-	std::unordered_map<std::filesystem::path, std::unique_ptr<Filesystem::IWatcher>> watchers_;
+	Filesystem::PathMap<std::unique_ptr<Filesystem::IWatcher>> watchers_;
 
 	/* ID we're looking for */
 	std::optional<int> find_id_;
--- a/src/core/date.cc	Mon Nov 10 15:51:45 2025 -0500
+++ b/src/core/date.cc	Mon Jan 19 20:50:40 2026 -0500
@@ -6,6 +6,7 @@
 #include <QDebug>
 
 #include <algorithm>
+#include <sstream>
 #include <cstdio>
 
 /* An implementation of AniList's "fuzzy date" */
--- a/src/core/filesystem.cc	Mon Nov 10 15:51:45 2025 -0500
+++ b/src/core/filesystem.cc	Mon Jan 19 20:50:40 2026 -0500
@@ -5,6 +5,7 @@
 #include <QStandardPaths>
 
 #include <filesystem>
+#include <unordered_map>
 
 #ifdef WIN32
 # include <windows.h>
@@ -100,7 +101,7 @@
 resort to old-fashioned recursion.  --paper
 */
 static void IterateDirectory(const std::filesystem::path &path, bool recursive,
-                             std::function<void(const std::filesystem::path &path)> func)
+                             const std::function<void(const std::filesystem::path &path)> &func)
 {
 	std::error_code ec;
 	static const std::filesystem::directory_iterator end;
@@ -180,7 +181,7 @@
 	}
 
 	/* unordered hashmap, path[found] */
-	std::unordered_map<std::filesystem::path, bool> paths_;
+	PathMap<bool> paths_;
 	bool recursive_;
 };