core: Add libc++ compatibility (#73)

src/renderer/AsyncResourceGatherer.cpp:98:22: error: no viable overloaded '+='
   98 |             progress += 1.0 / (preloads + 1.0);
      |             ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~
src/renderer/widgets/IWidget.cpp:41:44: error: no member named 'current_zone' in namespace 'std::chrono'
   41 |     const auto current_zone = std::chrono::current_zone();
      |                               ~~~~~~~~~~~~~^
This commit is contained in:
Jan Beich 2024-02-23 21:29:08 +00:00 committed by GitHub
parent 4c68780143
commit 8969351cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -95,7 +95,11 @@ void CAsyncResourceGatherer::gather() {
progress = 0; progress = 0;
for (auto& c : CWIDGETS) { for (auto& c : CWIDGETS) {
if (c.type == "background") { if (c.type == "background") {
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 180100
progress = progress + 1.0 / (preloads + 1.0);
#else
progress += 1.0 / (preloads + 1.0); progress += 1.0 / (preloads + 1.0);
#endif
std::string path = std::any_cast<Hyprlang::STRING>(c.values.at("path")); std::string path = std::any_cast<Hyprlang::STRING>(c.values.at("path"));

View file

@ -4,6 +4,16 @@
#include <chrono> #include <chrono>
#include <unistd.h> #include <unistd.h>
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 190100
#pragma comment(lib, "date-tz")
#include <date/tz.h>
namespace std {
namespace chrono {
using date::current_zone;
}
}
#endif
Vector2D IWidget::posFromHVAlign(const Vector2D& viewport, const Vector2D& size, const Vector2D& offset, const std::string& halign, const std::string& valign) { Vector2D IWidget::posFromHVAlign(const Vector2D& viewport, const Vector2D& size, const Vector2D& offset, const std::string& halign, const std::string& valign) {
Vector2D pos = offset; Vector2D pos = offset;
if (halign == "center") if (halign == "center")