Mercurial > hg > svcore
comparison system/System.cpp @ 1883:e5d0ea9ac8f1
OK I give in, we are going to have to put this in a separate DLL so we can deploy a version on Win7 that doesn't have the WinRT dependency
author | Chris Cannam |
---|---|
date | Tue, 21 Jul 2020 13:59:14 +0100 |
parents | 00405d2cf0d1 |
children |
comparison
equal
deleted
inserted
replaced
1880:5671836cdac7 | 1883:e5d0ea9ac8f1 |
---|---|
23 #ifndef _WIN32 | 23 #ifndef _WIN32 |
24 #include <signal.h> | 24 #include <signal.h> |
25 #include <sys/statvfs.h> | 25 #include <sys/statvfs.h> |
26 #include <locale.h> | 26 #include <locale.h> |
27 #include <unistd.h> | 27 #include <unistd.h> |
28 #endif | |
29 | |
30 #ifndef AVOID_WINRT_DEPENDENCY | |
31 #ifdef _MSC_VER | |
32 #include <winrt/Windows.UI.ViewManagement.h> | |
33 #endif | |
34 #endif | 28 #endif |
35 | 29 |
36 #ifdef __APPLE__ | 30 #ifdef __APPLE__ |
37 #include <sys/param.h> | 31 #include <sys/param.h> |
38 #include <sys/sysctl.h> | 32 #include <sys/sysctl.h> |
338 } else { | 332 } else { |
339 setlocale(LC_ALL, startupLocale); | 333 setlocale(LC_ALL, startupLocale); |
340 } | 334 } |
341 } | 335 } |
342 | 336 |
343 bool | |
344 OSReportsDarkThemeActive() | |
345 { | |
346 #ifndef AVOID_WINRT_DEPENDENCY | |
347 #ifdef _MSC_VER | |
348 using namespace winrt::Windows::UI::ViewManagement; | |
349 UISettings settings; | |
350 auto background = settings.GetColorValue(UIColorType::Background); | |
351 if (int(background.R) + int(background.G) + int(background.B) < 384) { | |
352 return true; | |
353 } | |
354 #endif | |
355 #endif | |
356 return false; | |
357 } | |
358 | |
359 bool | |
360 OSQueryAccentColour(int &r, int &g, int &b) | |
361 { | |
362 SVCERR << "OSQueryAccentColour() called" << endl; | |
363 #ifndef AVOID_WINRT_DEPENDENCY | |
364 #ifdef _MSC_VER | |
365 using namespace winrt::Windows::UI::ViewManagement; | |
366 bool dark = OSReportsDarkThemeActive(); | |
367 UISettings settings; | |
368 auto accent = settings.GetColorValue | |
369 (dark ? UIColorType::AccentLight1 : UIColorType::Accent); | |
370 r = accent.R; | |
371 g = accent.G; | |
372 b = accent.B; | |
373 return true; | |
374 #endif | |
375 #endif | |
376 (void)r; | |
377 (void)g; | |
378 (void)b; | |
379 return false; | |
380 } | |
381 | |
382 double mod(double x, double y) { return x - (y * floor(x / y)); } | 337 double mod(double x, double y) { return x - (y * floor(x / y)); } |
383 float modf(float x, float y) { return x - (y * floorf(x / y)); } | 338 float modf(float x, float y) { return x - (y * floorf(x / y)); } |
384 | 339 |
385 double princarg(double a) { return mod(a + M_PI, -2 * M_PI) + M_PI; } | 340 double princarg(double a) { return mod(a + M_PI, -2 * M_PI) + M_PI; } |
386 float princargf(float a) { return float(princarg(a)); } | 341 float princargf(float a) { return float(princarg(a)); } |