| @@ -58,7 +58,7 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| #elif JUCE_WINDOWS | #elif JUCE_WINDOWS | ||||
| #if JUCE_WASAPI | #if JUCE_WASAPI | ||||
| #include <MMReg.h> | |||||
| #include <mmreg.h> | |||||
| #endif | #endif | ||||
| #if JUCE_ASIO | #if JUCE_ASIO | ||||
| @@ -96,11 +96,18 @@ bool check (HRESULT hr) | |||||
| } | } | ||||
| #if JUCE_MINGW | #if JUCE_MINGW | ||||
| #define JUCE_COMCLASS(name, guid) \ | #define JUCE_COMCLASS(name, guid) \ | ||||
| struct name; \ | struct name; \ | ||||
| template<> struct UUIDGetter<name> { static CLSID get() { return uuidFromString (guid); } }; \ | template<> struct UUIDGetter<name> { static CLSID get() { return uuidFromString (guid); } }; \ | ||||
| struct name | struct name | ||||
| #ifdef __uuidof | |||||
| #undef __uuidof | |||||
| #endif | |||||
| #define __uuidof(cls) UUIDGetter<cls>::get() | |||||
| struct PROPERTYKEY | struct PROPERTYKEY | ||||
| { | { | ||||
| GUID fmtid; | GUID fmtid; | ||||
| @@ -29,9 +29,23 @@ | |||||
| #ifndef JUCE_WIN32_COMSMARTPTR_H_INCLUDED | #ifndef JUCE_WIN32_COMSMARTPTR_H_INCLUDED | ||||
| #define JUCE_WIN32_COMSMARTPTR_H_INCLUDED | #define JUCE_WIN32_COMSMARTPTR_H_INCLUDED | ||||
| #if ! (defined (_MSC_VER) || defined (__uuidof)) | |||||
| #if JUCE_MINGW || (! (defined (_MSC_VER) || defined (__uuidof))) | |||||
| #ifdef __uuidof | |||||
| #undef __uuidof | |||||
| #endif | |||||
| template<typename Type> struct UUIDGetter { static CLSID get() { jassertfalse; return CLSID(); } }; | template<typename Type> struct UUIDGetter { static CLSID get() { jassertfalse; return CLSID(); } }; | ||||
| #define __uuidof(x) UUIDGetter<x>::get() | #define __uuidof(x) UUIDGetter<x>::get() | ||||
| template <> | |||||
| struct UUIDGetter<::IUnknown> | |||||
| { | |||||
| static CLSID get() | |||||
| { | |||||
| GUID g = { 0, 0, 0, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; | |||||
| return g; | |||||
| } | |||||
| }; | |||||
| #endif | #endif | ||||
| inline GUID uuidFromString (const char* const s) noexcept | inline GUID uuidFromString (const char* const s) noexcept | ||||
| @@ -135,7 +149,7 @@ protected: | |||||
| JUCE_COMRESULT QueryInterface (REFIID refId, void** result) | JUCE_COMRESULT QueryInterface (REFIID refId, void** result) | ||||
| { | { | ||||
| if (refId == IID_IUnknown) | |||||
| if (refId == __uuidof (IUnknown)) | |||||
| return castToType <IUnknown> (result); | return castToType <IUnknown> (result); | ||||
| *result = 0; | *result = 0; | ||||
| @@ -41,10 +41,28 @@ void Logger::outputDebugString (const String& text) | |||||
| #pragma intrinsic (__cpuid) | #pragma intrinsic (__cpuid) | ||||
| #pragma intrinsic (__rdtsc) | #pragma intrinsic (__rdtsc) | ||||
| #if JUCE_MINGW | |||||
| static void callCPUID (int result[4], uint32 type) | |||||
| { | |||||
| uint32 la = result[0], lb = result[1], lc = result[2], ld = result[3]; | |||||
| asm ("mov %%ebx, %%esi \n\t" | |||||
| "cpuid \n\t" | |||||
| "xchg %%esi, %%ebx" | |||||
| : "=a" (la), "=S" (lb), "=c" (lc), "=d" (ld) : "a" (type) | |||||
| #if JUCE_64BIT | |||||
| , "b" (lb), "c" (lc), "d" (ld) | |||||
| #endif | |||||
| ); | |||||
| result[0] = la; result[1] = lb; result[2] = lc; result[3] = ld; | |||||
| } | |||||
| #else | |||||
| static void callCPUID (int result[4], int infoType) | static void callCPUID (int result[4], int infoType) | ||||
| { | { | ||||
| __cpuid (result, infoType); | __cpuid (result, infoType); | ||||
| } | } | ||||
| #endif | |||||
| String SystemStats::getCpuVendor() | String SystemStats::getCpuVendor() | ||||
| { | { | ||||
| @@ -257,7 +257,7 @@ bool JUCEApplicationBase::initialiseApp() | |||||
| } | } | ||||
| #endif | #endif | ||||
| #if JUCE_WINDOWS && JUCE_STANDALONE_APPLICATION && ! defined (_CONSOLE) | |||||
| #if JUCE_WINDOWS && JUCE_STANDALONE_APPLICATION && (! defined (_CONSOLE)) && (! JUCE_MINGW) | |||||
| if (AttachConsole (ATTACH_PARENT_PROCESS) != 0) | if (AttachConsole (ATTACH_PARENT_PROCESS) != 0) | ||||
| { | { | ||||
| // if we've launched a GUI app from cmd.exe or PowerShell, we need this to enable printf etc. | // if we've launched a GUI app from cmd.exe or PowerShell, we need this to enable printf etc. | ||||
| @@ -24,6 +24,24 @@ | |||||
| extern int64 getMouseEventTime(); | extern int64 getMouseEventTime(); | ||||
| #if JUCE_MINGW | |||||
| #define JUCE_COMCLASS(name, guid) \ | |||||
| template<> struct UUIDGetter<::name> { static CLSID get() { return uuidFromString (guid); } }; | |||||
| #ifdef __uuidof | |||||
| #undef __uuidof | |||||
| #endif | |||||
| #define __uuidof(cls) UUIDGetter<::cls>::get() | |||||
| #else | |||||
| #define JUCE_COMCLASS(name, guid) | |||||
| #endif | |||||
| JUCE_COMCLASS (IOleObject, "00000112-0000-0000-C000-000000000046") | |||||
| JUCE_COMCLASS (IOleWindow, "00000114-0000-0000-C000-000000000046") | |||||
| JUCE_COMCLASS (IOleInPlaceSite, "00000119-0000-0000-C000-000000000046") | |||||
| namespace ActiveXHelpers | namespace ActiveXHelpers | ||||
| { | { | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -133,7 +151,7 @@ namespace ActiveXHelpers | |||||
| JUCE_COMRESULT QueryInterface (REFIID type, void** result) | JUCE_COMRESULT QueryInterface (REFIID type, void** result) | ||||
| { | { | ||||
| if (type == IID_IOleInPlaceSite) | |||||
| if (type == __uuidof (IOleInPlaceSite)) | |||||
| { | { | ||||
| inplaceSite->AddRef(); | inplaceSite->AddRef(); | ||||
| *result = static_cast<IOleInPlaceSite*> (inplaceSite); | *result = static_cast<IOleInPlaceSite*> (inplaceSite); | ||||
| @@ -160,7 +178,7 @@ namespace ActiveXHelpers | |||||
| HWND getHWND (const ActiveXControlComponent* const component) | HWND getHWND (const ActiveXControlComponent* const component) | ||||
| { | { | ||||
| HWND hwnd = 0; | HWND hwnd = 0; | ||||
| const IID iid = IID_IOleWindow; | |||||
| const IID iid = __uuidof(IOleWindow); | |||||
| if (IOleWindow* const window = (IOleWindow*) component->queryInterface (&iid)) | if (IOleWindow* const window = (IOleWindow*) component->queryInterface (&iid)) | ||||
| { | { | ||||
| @@ -340,7 +358,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID) | |||||
| ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this)); | ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this)); | ||||
| HRESULT hr; | HRESULT hr; | ||||
| if ((hr = OleCreate (*(const IID*) controlIID, IID_IOleObject, 1 /*OLERENDER_DRAW*/, 0, | |||||
| if ((hr = OleCreate (*(const IID*) controlIID, __uuidof (IOleObject), 1 /*OLERENDER_DRAW*/, 0, | |||||
| newControl->clientSite, newControl->storage, | newControl->clientSite, newControl->storage, | ||||
| (void**) &(newControl->control))) == S_OK) | (void**) &(newControl->control))) == S_OK) | ||||
| { | { | ||||
| @@ -22,6 +22,11 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| JUCE_COMCLASS (DWebBrowserEvents2, "34A715A0-6587-11D0-924A-0020AFC7AC4D") | |||||
| JUCE_COMCLASS (IConnectionPointContainer, "B196B284-BAB4-101A-B69C-00AA00341D07") | |||||
| JUCE_COMCLASS (IWebBrowser2, "D30C1661-CDAF-11D0-8A3E-00C04FC9E26E") | |||||
| JUCE_COMCLASS (WebBrowser, "8856F961-340A-11D0-A96B-00C04FD705A2") | |||||
| class WebBrowserComponent::Pimpl : public ActiveXControlComponent | class WebBrowserComponent::Pimpl : public ActiveXControlComponent | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -43,13 +48,18 @@ public: | |||||
| void createBrowser() | void createBrowser() | ||||
| { | { | ||||
| createControl (&CLSID_WebBrowser); | |||||
| browser = (IWebBrowser2*) queryInterface (&IID_IWebBrowser2); | |||||
| CLSID webCLSID = __uuidof (WebBrowser); | |||||
| createControl (&webCLSID); | |||||
| GUID iidWebBrowser2 = __uuidof (IWebBrowser2); | |||||
| GUID iidConnectionPointContainer = __uuidof (IConnectionPointContainer); | |||||
| browser = (IWebBrowser2*) queryInterface (&iidWebBrowser2); | |||||
| if (IConnectionPointContainer* connectionPointContainer | if (IConnectionPointContainer* connectionPointContainer | ||||
| = (IConnectionPointContainer*) queryInterface (&IID_IConnectionPointContainer)) | |||||
| = (IConnectionPointContainer*) queryInterface (&iidConnectionPointContainer)) | |||||
| { | { | ||||
| connectionPointContainer->FindConnectionPoint (DIID_DWebBrowserEvents2, &connectionPoint); | |||||
| connectionPointContainer->FindConnectionPoint (__uuidof (DWebBrowserEvents2), &connectionPoint); | |||||
| if (connectionPoint != nullptr) | if (connectionPoint != nullptr) | ||||
| { | { | ||||
| @@ -330,9 +340,12 @@ void WebBrowserComponent::visibilityChanged() | |||||
| void WebBrowserComponent::focusGained (FocusChangeType) | void WebBrowserComponent::focusGained (FocusChangeType) | ||||
| { | { | ||||
| if (IOleObject* oleObject = (IOleObject*) browser->queryInterface (&IID_IOleObject)) | |||||
| GUID iidOleObject = __uuidof (IOleObject); | |||||
| GUID iidOleWindow = __uuidof (IOleWindow); | |||||
| if (IOleObject* oleObject = (IOleObject*) browser->queryInterface (&iidOleObject)) | |||||
| { | { | ||||
| if (IOleWindow* oleWindow = (IOleWindow*) browser->queryInterface (&IID_IOleWindow)) | |||||
| if (IOleWindow* oleWindow = (IOleWindow*) browser->queryInterface (&iidOleWindow)) | |||||
| { | { | ||||
| IOleClientSite* oleClientSite = nullptr; | IOleClientSite* oleClientSite = nullptr; | ||||