From 8d63747965d8ecc687fb98b2a72353d02bce3dac Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 25 Jul 2007 09:08:04 +0000 Subject: [PATCH] changes for Wine compatibility --- .../juce_win32_Fonts.cpp | 18 +++++++++++++++--- .../juce_win32_PlatformUtils.cpp | 11 +++++++++++ .../juce_win32_Windowing.cpp | 8 ++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/build/win32/platform_specific_code/juce_win32_Fonts.cpp b/build/win32/platform_specific_code/juce_win32_Fonts.cpp index df00ea46ae..d351402638 100644 --- a/build/win32/platform_specific_code/juce_win32_Fonts.cpp +++ b/build/win32/platform_specific_code/juce_win32_Fonts.cpp @@ -239,13 +239,25 @@ const StringArray Font::findAllTypefaceNames() throw() return results; } +extern bool juce_IsRunningInWine() throw(); + void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw() { - defaultSans = "Verdana"; - defaultSerif = "Times"; - defaultFixed = "Lucida Console"; + if (juce_IsRunningInWine()) + { + // If we're running in Wine, then use fonts that might be available on Linux.. + defaultSans = "Bitstream Vera Sans"; + defaultSerif = "Bitstream Vera Serif"; + defaultFixed = "Bitstream Vera Sans Mono"; + } + else + { + defaultSans = "Verdana"; + defaultSerif = "Times"; + defaultFixed = "Lucida Console"; + } } //============================================================================== diff --git a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp index 30f4deb30c..05c34c86f1 100644 --- a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp +++ b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp @@ -300,6 +300,17 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath) } } +bool juce_IsRunningInWine() throw() +{ + HKEY key; + if (RegOpenKeyEx (HKEY_CURRENT_USER, _T("Software\\Wine"), 0, KEY_READ, &key) == ERROR_SUCCESS) + { + RegCloseKey (key); + return true; + } + + return false; +} //============================================================================== static void* currentModuleHandle = 0; diff --git a/build/win32/platform_specific_code/juce_win32_Windowing.cpp b/build/win32/platform_specific_code/juce_win32_Windowing.cpp index cd5d066116..2fa12ab5df 100644 --- a/build/win32/platform_specific_code/juce_win32_Windowing.cpp +++ b/build/win32/platform_specific_code/juce_win32_Windowing.cpp @@ -93,6 +93,7 @@ BEGIN_JUCE_NAMESPACE extern void juce_repeatLastProcessPriority() throw(); // in juce_win32_Threads.cpp extern void juce_CheckCurrentlyFocusedTopLevelWindow() throw(); // in juce_TopLevelWindow.cpp +extern bool juce_IsRunningInWine() throw(); const int juce_windowIsSemiTransparentFlag = (1 << 31); // also in component.cpp @@ -121,8 +122,11 @@ bool Desktop::canUseSemiTransparentWindows() throw() { if (updateLayeredWindow == 0) { - HMODULE user32Mod = GetModuleHandle (_T("user32.dll")); - updateLayeredWindow = (UpdateLayeredWinFunc) GetProcAddress (user32Mod, "UpdateLayeredWindow"); + if (! juce_IsRunningInWine()) + { + HMODULE user32Mod = GetModuleHandle (_T("user32.dll")); + updateLayeredWindow = (UpdateLayeredWinFunc) GetProcAddress (user32Mod, "UpdateLayeredWindow"); + } } return updateLayeredWindow != 0;