X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fformatter.hpp;h=43b816eb1ef1fb453817bd850ac5f6aad6e56191;hb=9840c201de08419f5d940642974438917a44d849;hp=59f0feac22220f53dc00474edc9f5355694fe330;hpb=e9426dd61586757d23d7dddc85b3076f477e7f07;p=apitrace diff --git a/common/formatter.hpp b/common/formatter.hpp index 59f0fea..43b816e 100644 --- a/common/formatter.hpp +++ b/common/formatter.hpp @@ -88,7 +88,10 @@ protected: public: virtual Attribute *normal(void) const { return new AnsiAttribute("0m"); } virtual Attribute *bold(void) const { return new AnsiAttribute("1m"); } + /* Italic is not widely supported, or worse, implemented with a reverse */ +#if 0 virtual Attribute *italic(void) const { return new AnsiAttribute("3m"); } +#endif virtual Attribute *strike(void) const { return new AnsiAttribute("9m"); } virtual Attribute *color(Color c) const { static const char *color_escapes[] = { @@ -192,6 +195,18 @@ public: inline Formatter *defaultFormatter(bool color = true) { if (color) { #ifdef _WIN32 + // http://wiki.winehq.org/DeveloperFaq#detect-wine + static HMODULE hNtDll = NULL; + static bool bWine = false; + if (!hNtDll) { + hNtDll = LoadLibraryA("ntdll"); + if (hNtDll) { + bWine = GetProcAddress(hNtDll, "wine_get_version") != NULL; + } + } + if (bWine) { + return new AnsiFormatter; + } return new WindowsFormatter; #else return new AnsiFormatter;