summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Northon2023-09-01 02:44:57 -0400
committerPatrick Northon2023-09-01 02:44:57 -0400
commit50e18c0142fdc17e7d862f448b92c96d19c1e448 (patch)
treeb120af845c6a2d683ea7fa008d5781f79f1467e9
parent68914e7934c86c41fc95c60032050e88580a0d90 (diff)
downloadaur-50e18c0142fdc17e7d862f448b92c96d19c1e448.tar.gz
Patch to fix some issues with monitor detection.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD14
-rw-r--r--ocio-system-monitor-mingw.patch111
3 files changed, 122 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d70e7bb6ba53..08a95c80d55f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = mingw-w64-opencolorio
pkgdesc = A color management framework for visual effects and animation (mingw-w64)
pkgver = 2.3.0
- pkgrel = 1
+ pkgrel = 2
url = https://opencolorio.org/
arch = any
license = BSD-3-Clause
@@ -21,6 +21,8 @@ pkgbase = mingw-w64-opencolorio
options = !buildflags
options = staticlibs
source = opencolorio-2.3.0.tar.gz::https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v2.3.0.tar.gz
+ source = ocio-system-monitor-mingw.patch
sha256sums = 32b7be676c110d849a77886d8a409159f0367309b2b2f5dae5aa0c38f42b445a
+ sha256sums = 73697fbd06b3f51cfd0a2df3579fc8579725b2a927edefa736fdb1fb2a361337
pkgname = mingw-w64-opencolorio
diff --git a/PKGBUILD b/PKGBUILD
index d1fe51c36b67..b035d17f3d71 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
_pkgname=opencolorio
pkgname=mingw-w64-${_pkgname}
pkgver=2.3.0
-pkgrel=1
+pkgrel=2
pkgdesc='A color management framework for visual effects and animation (mingw-w64)'
arch=(any)
url='https://opencolorio.org/'
@@ -22,8 +22,11 @@ depends=(
checkdepends=('mingw-w64-wine')
options=('!strip' '!buildflags' 'staticlibs')
_repo='OpenColorIO'
-source=("$_pkgname-$pkgver.tar.gz::https://github.com/AcademySoftwareFoundation/${_repo}/archive/v${pkgver}.tar.gz")
-sha256sums=('32b7be676c110d849a77886d8a409159f0367309b2b2f5dae5aa0c38f42b445a')
+source=(
+ "$_pkgname-$pkgver.tar.gz::https://github.com/AcademySoftwareFoundation/${_repo}/archive/v${pkgver}.tar.gz"
+ 'ocio-system-monitor-mingw.patch')
+sha256sums=('32b7be676c110d849a77886d8a409159f0367309b2b2f5dae5aa0c38f42b445a'
+ '73697fbd06b3f51cfd0a2df3579fc8579725b2a927edefa736fdb1fb2a361337')
_srcdir="${_repo}-${pkgver}"
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
@@ -39,14 +42,13 @@ prepare() {
sed -i 's/if(NOT WIN32)/if(NOT WIN32 OR MINGW)/' 'src/OpenColorIO/CMakeLists.txt'
sed -i 's/if(WIN32)/if(WIN32 AND NOT MINGW)/' 'src/OpenColorIO/CMakeLists.txt'
sed -i 's/_str/str/g;s/_l(/(/g;s/_l (/ (/g;s/, loc.local//g;s|static const Locale loc;|//static const Locale loc;|' 'src/utils/NumberUtils.h'
- sed -i 's/std::tstring/std::string/g;s/std::tostringstream/std::ostringstream/g' 'src/OpenColorIO/SystemMonitor_windows.cpp'
- sed -i 's/targetName.monitorFriendlyDeviceName : L""/Platform::Utf16ToUtf8(targetName.monitorFriendlyDeviceName) : ""/' 'src/OpenColorIO/SystemMonitor_windows.cpp'
- sed -i 's/Platform::Utf16ToUtf8(deviceName)/deviceName/' 'src/OpenColorIO/SystemMonitor_windows.cpp'
rm -f 'share/cmake/modules/Findyaml-cpp.cmake'
sed -i 's|${CMAKE_CURRENT_LIST_DIR}/share/cmake/modules/Findyaml-cpp.cmake||' 'CMakeLists.txt'
sed -i 's/#if _MSC_VER/#if _WIN32/' 'src/OpenColorIO/CPUInfo.cpp'
+
+ patch -p1 -i "${srcdir}/ocio-system-monitor-mingw.patch"
}
build() {
diff --git a/ocio-system-monitor-mingw.patch b/ocio-system-monitor-mingw.patch
new file mode 100644
index 000000000000..963c78518d29
--- /dev/null
+++ b/ocio-system-monitor-mingw.patch
@@ -0,0 +1,111 @@
+diff --git a/src/OpenColorIO/SystemMonitor_windows.cpp b/src/OpenColorIO/SystemMonitor_windows.cpp
+index 4b8d7158..63cf8565 100644
+--- a/src/OpenColorIO/SystemMonitor_windows.cpp
++++ b/src/OpenColorIO/SystemMonitor_windows.cpp
+@@ -11,6 +11,7 @@
+ #include <windows.h>
+
+ #include <Logging.h>
++#include <concepts>
+
+ #include "Platform.h"
+ #include "utils/StringUtils.h"
+@@ -21,9 +22,22 @@ namespace OCIO_NAMESPACE
+
+ static constexpr char ErrorMsg[] { "Problem obtaining monitor profile information from operating system." };
+
++static auto to_utf8_maybe(const std::string &s) { return s; }
++static auto to_utf8_maybe(const std::wstring &s) { return Platform::Utf16ToUtf8(s); }
++
++template <typename T_ = TCHAR>
++static std::basic_string<T_> to_tchar_maybe(const wchar_t *s)
++ requires std::same_as<T_, wchar_t>
++ { return s; }
++
++template <typename T_ = TCHAR>
++static std::basic_string<T_> to_tchar_maybe(const wchar_t *s)
++ requires (!std::same_as<T_, wchar_t>)
++ { return Platform::Utf16ToUtf8(s); }
++
+ // List all active display paths using QueryDisplayConfig and GetDisplayConfigBufferSizes.
+ // Get the data from each path using DisplayConfigGetDeviceInfo.
+-void getAllMonitorsWithQueryDisplayConfig(std::vector<std::tstring> & monitorsName)
++void getAllMonitorsWithQueryDisplayConfig(std::vector<std::basic_string<TCHAR>> & monitorsName)
+ {
+ // https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-displayconfig_path_info
+ std::vector<DISPLAYCONFIG_PATH_INFO> paths;
+@@ -75,7 +89,7 @@ void getAllMonitorsWithQueryDisplayConfig(std::vector<std::tstring> & monitorsNa
+ {
+ monitorsName.push_back(
+ (result == ERROR_SUCCESS && targetName.flags.friendlyNameFromEdid) ?
+- targetName.monitorFriendlyDeviceName : L""
++ to_tchar_maybe(targetName.monitorFriendlyDeviceName) : std::basic_string<TCHAR>{}
+ );
+ }
+ }
+@@ -99,7 +113,7 @@ void SystemMonitorsImpl::getAllMonitors()
+ {
+ m_monitors.clear();
+
+- std::vector<std::tstring> friendlyMonitorNames;
++ std::vector<std::basic_string<TCHAR>> friendlyMonitorNames;
+ getAllMonitorsWithQueryDisplayConfig(friendlyMonitorNames);
+
+ // Initialize the structure.
+@@ -112,7 +126,7 @@ void SystemMonitorsImpl::getAllMonitors()
+ // After the first call to EnumDisplayDevices, dispDevice.DeviceString is the adapter name.
+ while (EnumDisplayDevices(nullptr, dispNum, &dispDevice, 0))
+ {
+- const std::tstring deviceName = dispDevice.DeviceName;
++ const std::basic_string<TCHAR> deviceName = dispDevice.DeviceName;
+
+ // Only select active monitors.
+ // NOTE: Currently the two DISPLAY enums are equivalent, but we check both in case one may
+@@ -143,31 +157,31 @@ void SystemMonitorsImpl::getAllMonitors()
+
+ // Check if the distNum index exists in friendlyMonitorNames vector and check if
+ // there is a corresponding friendly name.
+- const std::tstring extra = friendlyNameExists ?
+- friendlyMonitorNames.at(dispNum) : std::tstring(dispDevice.DeviceString);
++ const std::basic_string<TCHAR> extra = friendlyNameExists ?
++ friendlyMonitorNames.at(dispNum) : std::basic_string<TCHAR>(dispDevice.DeviceString);
+
+- std::tstring strippedDeviceName = deviceName;
+- if(StringUtils::StartsWith(Platform::Utf16ToUtf8(deviceName), "\\\\.\\DISPLAY"))
++ std::basic_string<TCHAR> strippedDeviceName = deviceName;
++ if(StringUtils::StartsWith(to_utf8_maybe(deviceName), "\\\\.\\DISPLAY"))
+ {
+ // Remove the slashes.
+ std::string prefix = "\\\\.\\";
+ strippedDeviceName = deviceName.substr(prefix.length());
+ }
+
+- const std::tstring displayName = strippedDeviceName + TEXT(", ") + extra;
++ const std::basic_string<TCHAR> displayName = strippedDeviceName + TEXT(", ") + extra;
+
+ // Get the associated ICM profile path.
+ if (GetICMProfile(hDC, &pathLength, icmPath))
+ {
+ #ifdef _UNICODE
+- m_monitors.push_back({Platform::Utf16ToUtf8(displayName), Platform::Utf16ToUtf8(icmPath)});
++ m_monitors.push_back({to_utf8_maybe(displayName), to_utf8_maybe(icmPath)});
+ #else
+ m_monitors.push_back({displayName, icmPath});
+ #endif
+ }
+ else
+ {
+- std::tostringstream oss;
++ std::basic_ostringstream<TCHAR> oss;
+ oss << TEXT("Unable to access the ICM profile for the monitor '")
+ << displayName << TEXT("'.");
+
+@@ -178,7 +192,7 @@ void SystemMonitorsImpl::getAllMonitors()
+ }
+ else
+ {
+- std::tostringstream oss;
++ std::basic_ostringstream<TCHAR> oss;
+ oss << TEXT("Unable to access the monitor '") << deviceName << TEXT("'.");
+ LogDebugT(oss.str());
+ }