From b83fcd7d5f2cb2c4a8047792b4246854c1c1bd88 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 10 Dec 2012 16:48:38 +0000 Subject: [PATCH] win32 compatibility tweaks. --- modules/juce_core/native/juce_win32_ComSmartPtr.h | 4 ++-- modules/juce_core/native/juce_win32_Registry.cpp | 2 +- modules/juce_core/native/juce_win32_SystemStats.cpp | 12 +++++++++++- modules/juce_core/system/juce_TargetPlatform.h | 9 ++++----- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/juce_core/native/juce_win32_ComSmartPtr.h b/modules/juce_core/native/juce_win32_ComSmartPtr.h index 48bc91d7c6..5ab921528a 100644 --- a/modules/juce_core/native/juce_win32_ComSmartPtr.h +++ b/modules/juce_core/native/juce_win32_ComSmartPtr.h @@ -131,12 +131,12 @@ public: JUCE_COMRESULT QueryInterface (REFIID refId, void** result) { #if ! JUCE_MINGW - if (refId == __uuidof (ComClass)) { AddRef(); *result = dynamic_cast (this); return S_OK; } + if (refId == __uuidof (ComClass)) { this->AddRef(); *result = dynamic_cast (this); return S_OK; } #else jassertfalse; // need to find a mingw equivalent of __uuidof to make this possible #endif - if (refId == IID_IUnknown) { AddRef(); *result = dynamic_cast (this); return S_OK; } + if (refId == IID_IUnknown) { this->AddRef(); *result = dynamic_cast (this); return S_OK; } *result = 0; return E_NOINTERFACE; diff --git a/modules/juce_core/native/juce_win32_Registry.cpp b/modules/juce_core/native/juce_win32_Registry.cpp index fd4589e50b..2a2a37ec09 100644 --- a/modules/juce_core/native/juce_win32_Registry.cpp +++ b/modules/juce_core/native/juce_win32_Registry.cpp @@ -131,7 +131,7 @@ String WindowsRegistry::getValue (const String& regValuePath, const String& defa String WindowsRegistry::getValueWow64 (const String& regValuePath, const String& defaultValue) { - return RegistryKeyWrapper::getValue (regValuePath, defaultValue, KEY_WOW64_64KEY); + return RegistryKeyWrapper::getValue (regValuePath, defaultValue, 0x100 /*KEY_WOW64_64KEY*/); } bool WindowsRegistry::setValue (const String& regValuePath, const String& value) diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 97bcba941a..bf847a37f5 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -403,4 +403,14 @@ static String getLocaleValue (LCID locale, LCTYPE key, const char* defaultValue) String SystemStats::getUserLanguage() { return getLocaleValue (LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, "en"); } String SystemStats::getUserRegion() { return getLocaleValue (LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, "US"); } -String SystemStats::getDisplayLanguage() { return getLocaleValue (MAKELCID (GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SISO639LANGNAME, "en"); } + +String SystemStats::getDisplayLanguage() +{ + DynamicLibrary dll ("kernel32.dll"); + JUCE_LOAD_WINAPI_FUNCTION (dll, GetUserDefaultUILanguage, getUserDefaultUILanguage, LANGID, (void)) + + if (getUserDefaultUILanguage != nullptr) + return getLocaleValue (MAKELCID (getUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SISO639LANGNAME, "en"); + + return "en"; +} diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index d5211c2e05..2cb4e3d726 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -166,7 +166,10 @@ //============================================================================== // Compiler type macros. -#ifdef __GNUC__ +#ifdef __clang__ + #define JUCE_CLANG 1 + #define JUCE_GCC 1 +#elif defined (__GNUC__) #define JUCE_GCC 1 #elif defined (_MSC_VER) #define JUCE_MSVC 1 @@ -190,8 +193,4 @@ #error unknown compiler #endif -#ifdef __clang__ - #define JUCE_CLANG 1 -#endif - #endif // __JUCE_TARGETPLATFORM_JUCEHEADER__