diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index fa8d858a69..ec54aea3b9 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -38892,10 +38892,6 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_MessageManager.cpp ***/ BEGIN_JUCE_NAMESPACE -// platform-specific functions.. -bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); -bool juce_postMessageToSystemQueue (Message* message); - MessageManager* MessageManager::instance = 0; static const int quitMessageId = 0xfffff321; @@ -38937,7 +38933,7 @@ MessageManager* MessageManager::getInstance() throw() void MessageManager::postMessageToQueue (Message* const message) { - if (quitMessagePosted || ! juce_postMessageToSystemQueue (message)) + if (quitMessagePosted || ! postMessageToSystemQueue (message)) Message::Ptr deleter (message); // (this will delete messages that were just created with a 0 ref count) } @@ -39003,7 +38999,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) { JUCE_TRY { - if (! juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0)) + if (! dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0)) { const int msToWait = (int) (endTime - Time::currentTimeMillis()); @@ -42945,8 +42941,6 @@ void Desktop::resetTimer() lastFakeMouseMove = getMousePosition(); } -extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars); - void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars) { if (kioskModeComponent != componentToUse) @@ -42956,7 +42950,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow if (kioskModeComponent != 0) { - juce_setKioskComponent (kioskModeComponent, false, allowMenusAndBars); + setKioskComponent (kioskModeComponent, false, allowMenusAndBars); kioskModeComponent->setBounds (kioskComponentOriginalBounds); } @@ -42970,7 +42964,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow kioskComponentOriginalBounds = kioskModeComponent->getBounds(); - juce_setKioskComponent (kioskModeComponent, true, allowMenusAndBars); + setKioskComponent (kioskModeComponent, true, allowMenusAndBars); } } } @@ -77888,7 +77882,7 @@ const StringArray ComponentPeer::getAvailableRenderingEngines() return s; } -int ComponentPeer::getCurrentRenderingEngine() throw() +int ComponentPeer::getCurrentRenderingEngine() const { return 0; } @@ -244504,7 +244498,9 @@ static const unsigned int specialId = WM_APP + 0x4400; static const unsigned int broadcastId = WM_APP + 0x4403; static const unsigned int specialCallbackId = WM_APP + 0x4402; -static const TCHAR* const messageWindowName = _T("JUCEWindow"); +static const TCHAR* const messageWindowName = _T("JUCEWindow"); +static ATOM messageWindowClassAtom = 0; +static LPCTSTR getMessageWindowClassName() throw() { return (LPCTSTR) MAKELONG (messageWindowClassAtom, 0); } HWND juce_messageWindowHandle = 0; @@ -244615,7 +244611,7 @@ static bool isEventBlockedByModalComps (MSG& m) return false; } -bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) { MSG m; @@ -244656,7 +244652,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages return true; } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { message->incReferenceCount(); return PostMessage (juce_messageWindowHandle, specialId, 0, (LPARAM) message) != 0; @@ -244683,18 +244679,18 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call } } -static BOOL CALLBACK BroadcastEnumWindowProc (HWND hwnd, LPARAM lParam) +static BOOL CALLBACK broadcastEnumWindowProc (HWND hwnd, LPARAM lParam) { if (hwnd != juce_messageWindowHandle) - reinterpret_cast *> (lParam)->add ((void*) hwnd); + reinterpret_cast *> (lParam)->add (hwnd); return TRUE; } void MessageManager::broadcastMessage (const String& value) { - Array windows; - EnumWindows (&BroadcastEnumWindowProc, (LPARAM) &windows); + Array windows; + EnumWindows (&broadcastEnumWindowProc, (LPARAM) &windows); const String localCopy (value); @@ -244705,7 +244701,7 @@ void MessageManager::broadcastMessage (const String& value) for (int i = windows.size(); --i >= 0;) { - HWND hwnd = (HWND) windows.getUnchecked(i); + HWND hwnd = windows.getUnchecked(i); TCHAR windowName [64]; // no need to read longer strings than this GetWindowText (hwnd, windowName, 64); @@ -244722,48 +244718,39 @@ void MessageManager::broadcastMessage (const String& value) } } -static const String getMessageWindowClassName() +void MessageManager::doPlatformSpecificInitialisation() { + OleInitialize (0); + // this name has to be different for each app/dll instance because otherwise // poor old Win32 can get a bit confused (even despite it not being a process-global // window class). - static int number = 0; - if (number == 0) - number = 0x7fffffff & (int) Time::getHighResolutionTicks(); - - return "JUCEcs_" + String (number); -} - -void MessageManager::doPlatformSpecificInitialisation() -{ - OleInitialize (0); + String className ("JUCEcs_"); + className << (int) (Time::getHighResolutionTicks() & 0x7fffffff); - const String className (getMessageWindowClassName()); - - HMODULE hmod = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle(); + HMODULE moduleHandle = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle(); WNDCLASSEX wc; zerostruct (wc); - wc.cbSize = sizeof (wc); wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; wc.cbWndExtra = 4; - wc.hInstance = hmod; + wc.hInstance = moduleHandle; wc.lpszClassName = className.toWideCharPointer(); - RegisterClassEx (&wc); + messageWindowClassAtom = RegisterClassEx (&wc); + jassert (messageWindowClassAtom != 0); - juce_messageWindowHandle = CreateWindow (wc.lpszClassName, - messageWindowName, - 0, 0, 0, 0, 0, 0, 0, - hmod, 0); + juce_messageWindowHandle = CreateWindow (getMessageWindowClassName(), messageWindowName, + 0, 0, 0, 0, 0, 0, 0, moduleHandle, 0); + jassert (juce_messageWindowHandle != 0); } void MessageManager::doPlatformSpecificShutdown() { DestroyWindow (juce_messageWindowHandle); - UnregisterClass (getMessageWindowClassName().toWideCharPointer(), 0); + UnregisterClass (getMessageWindowClassName(), 0); OleUninitialize(); } @@ -246996,9 +246983,9 @@ private: HWND hwnd, parentToAddTo; ScopedPointer shadower; RenderingEngineType currentRenderingEngine; - #if JUCE_DIRECT2D + #if JUCE_DIRECT2D ScopedPointer direct2DContext; - #endif + #endif bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing; BorderSize windowBorder; HICON currentWindowIcon; @@ -247009,9 +246996,7 @@ private: class TemporaryImage : public Timer { public: - TemporaryImage() {} - ~TemporaryImage() {} const Image& getImage (const bool transparent, const int w, const int h) { @@ -247042,49 +247027,50 @@ private: { public: WindowClassHolder() - : windowClassName ("JUCE_") { - // this name has to be different for each app/dll instance because otherwise - // poor old Win32 can get a bit confused (even despite it not being a process-global - // window class). + // this name has to be different for each app/dll instance because otherwise poor old Win32 can + // get a bit confused (even despite it not being a process-global window class). + String windowClassName ("JUCE_"); windowClassName << (int) (Time::currentTimeMillis() & 0x7fffffff); HINSTANCE moduleHandle = (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(); - TCHAR moduleFile [1024]; - moduleFile[0] = 0; + TCHAR moduleFile [1024] = { 0 }; GetModuleFileName (moduleHandle, moduleFile, 1024); WORD iconNum = 0; WNDCLASSEX wcex; + zerostruct (wcex); wcex.cbSize = sizeof (wcex); wcex.style = CS_OWNDC; wcex.lpfnWndProc = (WNDPROC) windowProc; wcex.lpszClassName = windowClassName.toWideCharPointer(); - wcex.cbClsExtra = 0; wcex.cbWndExtra = 32; wcex.hInstance = moduleHandle; wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); iconNum = 1; wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); - wcex.hCursor = 0; - wcex.hbrBackground = 0; - wcex.lpszMenuName = 0; - RegisterClassEx (&wcex); + atom = RegisterClassEx (&wcex); + jassert (atom != 0); } ~WindowClassHolder() { if (ComponentPeer::getNumPeers() == 0) - UnregisterClass (windowClassName.toWideCharPointer(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); + UnregisterClass (getWindowClassName(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); clearSingletonInstance(); } - String windowClassName; + LPCTSTR getWindowClassName() const throw() { return (LPCTSTR) MAKELONG (atom, 0); } juce_DeclareSingleton_SingleThreaded_Minimal (WindowClassHolder); + + private: + ATOM atom; + + JUCE_DECLARE_NON_COPYABLE (WindowClassHolder); }; static void* createWindowCallback (void* userData) @@ -247138,12 +247124,12 @@ private: if ((styleFlags & windowIgnoresMouseClicks) != 0) exstyle |= WS_EX_TRANSPARENT; - if ((styleFlags & windowIsSemiTransparent) != 0 - && Desktop::canUseSemiTransparentWindows()) + if ((styleFlags & windowIsSemiTransparent) != 0 && Desktop::canUseSemiTransparentWindows()) exstyle |= WS_EX_LAYERED; - hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName.toWideCharPointer(), L"", type, 0, 0, 0, 0, - parentToAddTo, 0, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); + hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->getWindowClassName(), + L"", type, 0, 0, 0, 0, parentToAddTo, 0, + (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); #if JUCE_DIRECT2D setCurrentRenderingEngine (1); @@ -247411,10 +247397,7 @@ private: return s; } - int getCurrentRenderingEngine() throw() - { - return currentRenderingEngine; - } + int getCurrentRenderingEngine() const { return currentRenderingEngine; } #if JUCE_DIRECT2D void updateDirect2DContext() @@ -248438,8 +248421,6 @@ public: timerCallback(); } - ~ScreenSaverDefeater() {} - void timerCallback() { if (Process::isForegroundProcess()) @@ -248494,7 +248475,7 @@ bool Desktop::isScreenSaverEnabled() throw() } */ -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) { if (enableOrDisable) kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false)); @@ -260831,7 +260812,7 @@ void MessageManager::doPlatformSpecificShutdown() } } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { if (LinuxErrorHandling::errorOccurred) return false; @@ -260887,7 +260868,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* func } // this function expects that it will NEVER be called simultaneously for two concurrent threads -bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) { while (! LinuxErrorHandling::errorOccurred) { @@ -264063,7 +264044,7 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() return LinuxComponentPeer::currentModifiers; } -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { if (enableOrDisable) kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false)); @@ -272114,8 +272095,9 @@ void UIViewComponentPeer::redirectMovedOrResized() handleMovedOrResized(); } -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { + // TODO } class AsyncRepaintMessage : public CallbackMessage @@ -272368,7 +272350,7 @@ void MessageManager::doPlatformSpecificShutdown() deleteAndZero (dispatcher); } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { if (dispatcher != 0) dispatcher->messageQueue.post (message); @@ -276152,7 +276134,7 @@ public: void toBehind (ComponentPeer* other); void setIcon (const Image& newIcon); const StringArray getAvailableRenderingEngines(); - int getCurrentRenderingEngine() throw(); + int getCurrentRenderingEngine() const; void setCurrentRenderingEngine (int index); /* When you use multiple DLLs which share similarly-named obj-c classes - like @@ -277614,7 +277596,7 @@ const StringArray NSViewComponentPeer::getAvailableRenderingEngines() return s; } -int NSViewComponentPeer::getCurrentRenderingEngine() throw() +int NSViewComponentPeer::getCurrentRenderingEngine() const { return usingCoreGraphics ? 1 : 0; } @@ -277660,7 +277642,7 @@ void Desktop::createMouseInputSources() mouseSources.add (new MouseInputSource (0, true)); } -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 if (enableOrDisable) @@ -281075,7 +281057,7 @@ void MessageManager::doPlatformSpecificShutdown() } } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { juceAppDelegate->redirector->postMessage (message); return true; @@ -285777,7 +285759,7 @@ InputStream* URL::createNativeStream (const String& address, bool isPost, const void MessageManager::doPlatformSpecificInitialisation() {} void MessageManager::doPlatformSpecificShutdown() {} -bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) { Logger::outputDebugString ("*** Modal loops are not possible in Android!! Exiting..."); exit (1); @@ -285785,7 +285767,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages return true; } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { message->incReferenceCount(); getEnv()->CallVoidMethod (android.activity, android.postMessage, (jlong) (pointer_sized_uint) message); @@ -287193,8 +287175,8 @@ public: return s; } -#if USE_ANDROID_CANVAS - int getCurrentRenderingEngine() throw() + #if USE_ANDROID_CANVAS + int getCurrentRenderingEngine() const { return usingAndroidGraphics ? 1 : 0; } @@ -287207,7 +287189,7 @@ public: component->repaint(); } } -#endif + #endif static AndroidComponentPeer* findPeerForJavaView (jobject viewToFind) { @@ -287389,8 +287371,9 @@ bool Desktop::isScreenSaverEnabled() return true; } -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { + // TODO } void Desktop::getCurrentMonitorPositions (Array >& monitorCoords, const bool clipToWorkArea) @@ -287414,19 +287397,9 @@ const Image juce_createIconForFile (const File& file) return Image::null; } -void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) -{ - return 0; -} - -void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) -{ -} - -void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorType type) -{ - return 0; -} +void* MouseCursor::createMouseCursorFromImage (const Image&, int, int) { return 0; } +void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorType) { return 0; } +void MouseCursor::deleteMouseCursor (void* const /*cursorHandle*/, const bool /*isStandard*/) {} void MouseCursor::showInWindow (ComponentPeer*) const {} void MouseCursor::showInAllWindows() const {} diff --git a/juce_amalgamated.h b/juce_amalgamated.h index fae54c3a49..1e4bce8d37 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 50 +#define JUCE_BUILDNUMBER 51 /** Current Juce version number. @@ -33422,6 +33422,8 @@ private: void removeDesktopComponent (Component* c); void componentBroughtToFront (Component* c); + static void setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars); + void triggerFocusCallback(); void handleAsyncUpdate(); @@ -48064,16 +48066,16 @@ private: bool quitMessagePosted, quitMessageReceived; Thread::ThreadID messageThreadId; - static void* exitModalLoopCallback (void*); + friend class MessageManagerLock; + Thread::ThreadID volatile threadWithLock; + CriticalSection lockingLock; void postMessageToQueue (Message* message); - + static bool postMessageToSystemQueue (Message*); + static void* exitModalLoopCallback (void*); static void doPlatformSpecificInitialisation(); static void doPlatformSpecificShutdown(); - - friend class MessageManagerLock; - Thread::ThreadID volatile threadWithLock; - CriticalSection lockingLock; + static bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager); }; @@ -63879,7 +63881,7 @@ public: static bool isValidPeer (const ComponentPeer* peer) throw(); virtual const StringArray getAvailableRenderingEngines(); - virtual int getCurrentRenderingEngine() throw(); + virtual int getCurrentRenderingEngine() const; virtual void setCurrentRenderingEngine (int index); protected: diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index a4fd96476d..686d4373da 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 50 +#define JUCE_BUILDNUMBER 51 /** Current Juce version number. diff --git a/src/events/juce_MessageManager.cpp b/src/events/juce_MessageManager.cpp index f811e41e58..c86f51543c 100644 --- a/src/events/juce_MessageManager.cpp +++ b/src/events/juce_MessageManager.cpp @@ -35,12 +35,6 @@ BEGIN_JUCE_NAMESPACE #include "../threads/juce_ScopedLock.h" #include "../core/juce_Time.h" - -//============================================================================== -// platform-specific functions.. -bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); -bool juce_postMessageToSystemQueue (Message* message); - //============================================================================== MessageManager* MessageManager::instance = 0; @@ -83,7 +77,7 @@ MessageManager* MessageManager::getInstance() throw() void MessageManager::postMessageToQueue (Message* const message) { - if (quitMessagePosted || ! juce_postMessageToSystemQueue (message)) + if (quitMessagePosted || ! postMessageToSystemQueue (message)) Message::Ptr deleter (message); // (this will delete messages that were just created with a 0 ref count) } @@ -152,7 +146,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) { JUCE_TRY { - if (! juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0)) + if (! dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0)) { const int msToWait = (int) (endTime - Time::currentTimeMillis()); diff --git a/src/events/juce_MessageManager.h b/src/events/juce_MessageManager.h index fb1e9ed04c..bef69eaae4 100644 --- a/src/events/juce_MessageManager.h +++ b/src/events/juce_MessageManager.h @@ -181,16 +181,16 @@ private: bool quitMessagePosted, quitMessageReceived; Thread::ThreadID messageThreadId; - static void* exitModalLoopCallback (void*); + friend class MessageManagerLock; + Thread::ThreadID volatile threadWithLock; + CriticalSection lockingLock; void postMessageToQueue (Message* message); - + static bool postMessageToSystemQueue (Message*); + static void* exitModalLoopCallback (void*); static void doPlatformSpecificInitialisation(); static void doPlatformSpecificShutdown(); - - friend class MessageManagerLock; - Thread::ThreadID volatile threadWithLock; - CriticalSection lockingLock; + static bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager); }; diff --git a/src/gui/components/juce_Desktop.cpp b/src/gui/components/juce_Desktop.cpp index 6ebf5ccf2a..4d3d013cbf 100644 --- a/src/gui/components/juce_Desktop.cpp +++ b/src/gui/components/juce_Desktop.cpp @@ -378,8 +378,6 @@ void Desktop::resetTimer() } //============================================================================== -extern void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars); - void Desktop::setKioskModeComponent (Component* componentToUse, const bool allowMenusAndBars) { if (kioskModeComponent != componentToUse) @@ -389,7 +387,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow if (kioskModeComponent != 0) { - juce_setKioskComponent (kioskModeComponent, false, allowMenusAndBars); + setKioskComponent (kioskModeComponent, false, allowMenusAndBars); kioskModeComponent->setBounds (kioskComponentOriginalBounds); } @@ -403,7 +401,7 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow kioskComponentOriginalBounds = kioskModeComponent->getBounds(); - juce_setKioskComponent (kioskModeComponent, true, allowMenusAndBars); + setKioskComponent (kioskModeComponent, true, allowMenusAndBars); } } } diff --git a/src/gui/components/juce_Desktop.h b/src/gui/components/juce_Desktop.h index dc1b442a66..8c46a65a98 100644 --- a/src/gui/components/juce_Desktop.h +++ b/src/gui/components/juce_Desktop.h @@ -383,6 +383,8 @@ private: void removeDesktopComponent (Component* c); void componentBroughtToFront (Component* c); + static void setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars); + void triggerFocusCallback(); void handleAsyncUpdate(); diff --git a/src/gui/components/windows/juce_ComponentPeer.cpp b/src/gui/components/windows/juce_ComponentPeer.cpp index 3b399a8f0a..83b931175a 100644 --- a/src/gui/components/windows/juce_ComponentPeer.cpp +++ b/src/gui/components/windows/juce_ComponentPeer.cpp @@ -565,7 +565,7 @@ const StringArray ComponentPeer::getAvailableRenderingEngines() return s; } -int ComponentPeer::getCurrentRenderingEngine() throw() +int ComponentPeer::getCurrentRenderingEngine() const { return 0; } diff --git a/src/gui/components/windows/juce_ComponentPeer.h b/src/gui/components/windows/juce_ComponentPeer.h index 5430e1d7b5..d1f7b9c336 100644 --- a/src/gui/components/windows/juce_ComponentPeer.h +++ b/src/gui/components/windows/juce_ComponentPeer.h @@ -353,7 +353,7 @@ public: //============================================================================== virtual const StringArray getAvailableRenderingEngines(); - virtual int getCurrentRenderingEngine() throw(); + virtual int getCurrentRenderingEngine() const; virtual void setCurrentRenderingEngine (int index); protected: diff --git a/src/native/android/juce_android_Messaging.cpp b/src/native/android/juce_android_Messaging.cpp index f6be095fa1..76693268fd 100644 --- a/src/native/android/juce_android_Messaging.cpp +++ b/src/native/android/juce_android_Messaging.cpp @@ -33,7 +33,7 @@ void MessageManager::doPlatformSpecificInitialisation() {} void MessageManager::doPlatformSpecificShutdown() {} //============================================================================== -bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) { Logger::outputDebugString ("*** Modal loops are not possible in Android!! Exiting..."); exit (1); @@ -42,7 +42,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages } //============================================================================== -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { message->incReferenceCount(); getEnv()->CallVoidMethod (android.activity, android.postMessage, (jlong) (pointer_sized_uint) message); diff --git a/src/native/android/juce_android_Windowing.cpp b/src/native/android/juce_android_Windowing.cpp index e07b818988..760a81993b 100644 --- a/src/native/android/juce_android_Windowing.cpp +++ b/src/native/android/juce_android_Windowing.cpp @@ -405,8 +405,8 @@ public: return s; } -#if USE_ANDROID_CANVAS - int getCurrentRenderingEngine() throw() + #if USE_ANDROID_CANVAS + int getCurrentRenderingEngine() const { return usingAndroidGraphics ? 1 : 0; } @@ -419,7 +419,7 @@ public: component->repaint(); } } -#endif + #endif //============================================================================== static AndroidComponentPeer* findPeerForJavaView (jobject viewToFind) @@ -612,8 +612,9 @@ bool Desktop::isScreenSaverEnabled() } //============================================================================== -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { + // TODO } //============================================================================== @@ -640,19 +641,9 @@ const Image juce_createIconForFile (const File& file) } //============================================================================== -void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) -{ - return 0; -} - -void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) -{ -} - -void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorType type) -{ - return 0; -} +void* MouseCursor::createMouseCursorFromImage (const Image&, int, int) { return 0; } +void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorType) { return 0; } +void MouseCursor::deleteMouseCursor (void* const /*cursorHandle*/, const bool /*isStandard*/) {} //============================================================================== void MouseCursor::showInWindow (ComponentPeer*) const {} diff --git a/src/native/linux/juce_linux_Messaging.cpp b/src/native/linux/juce_linux_Messaging.cpp index dedfa516af..bd709b33c9 100644 --- a/src/native/linux/juce_linux_Messaging.cpp +++ b/src/native/linux/juce_linux_Messaging.cpp @@ -381,7 +381,7 @@ void MessageManager::doPlatformSpecificShutdown() } } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { if (LinuxErrorHandling::errorOccurred) return false; @@ -439,7 +439,7 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* func } // this function expects that it will NEVER be called simultaneously for two concurrent threads -bool juce_dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) { while (! LinuxErrorHandling::errorOccurred) { diff --git a/src/native/linux/juce_linux_Windowing.cpp b/src/native/linux/juce_linux_Windowing.cpp index d56d970085..9039a89791 100644 --- a/src/native/linux/juce_linux_Windowing.cpp +++ b/src/native/linux/juce_linux_Windowing.cpp @@ -2648,7 +2648,7 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() //============================================================================== -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { if (enableOrDisable) kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false)); diff --git a/src/native/mac/juce_ios_MessageManager.mm b/src/native/mac/juce_ios_MessageManager.mm index 0b43e37643..c601b94453 100644 --- a/src/native/mac/juce_ios_MessageManager.mm +++ b/src/native/mac/juce_ios_MessageManager.mm @@ -138,7 +138,7 @@ void MessageManager::doPlatformSpecificShutdown() deleteAndZero (dispatcher); } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { if (dispatcher != 0) dispatcher->messageQueue.post (message); diff --git a/src/native/mac/juce_ios_UIViewComponentPeer.mm b/src/native/mac/juce_ios_UIViewComponentPeer.mm index 03682e1927..bd8b7908df 100644 --- a/src/native/mac/juce_ios_UIViewComponentPeer.mm +++ b/src/native/mac/juce_ios_UIViewComponentPeer.mm @@ -916,8 +916,9 @@ void UIViewComponentPeer::redirectMovedOrResized() } //============================================================================== -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { + // TODO } //============================================================================== diff --git a/src/native/mac/juce_mac_MessageManager.mm b/src/native/mac/juce_mac_MessageManager.mm index 813bb30c64..35149a5edf 100644 --- a/src/native/mac/juce_mac_MessageManager.mm +++ b/src/native/mac/juce_mac_MessageManager.mm @@ -469,7 +469,7 @@ void MessageManager::doPlatformSpecificShutdown() } } -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { juceAppDelegate->redirector->postMessage (message); return true; diff --git a/src/native/mac/juce_mac_NSViewComponentPeer.mm b/src/native/mac/juce_mac_NSViewComponentPeer.mm index b5e2283abc..abe317eb63 100644 --- a/src/native/mac/juce_mac_NSViewComponentPeer.mm +++ b/src/native/mac/juce_mac_NSViewComponentPeer.mm @@ -172,7 +172,7 @@ public: void toBehind (ComponentPeer* other); void setIcon (const Image& newIcon); const StringArray getAvailableRenderingEngines(); - int getCurrentRenderingEngine() throw(); + int getCurrentRenderingEngine() const; void setCurrentRenderingEngine (int index); /* When you use multiple DLLs which share similarly-named obj-c classes - like @@ -1654,7 +1654,7 @@ const StringArray NSViewComponentPeer::getAvailableRenderingEngines() return s; } -int NSViewComponentPeer::getCurrentRenderingEngine() throw() +int NSViewComponentPeer::getCurrentRenderingEngine() const { return usingCoreGraphics ? 1 : 0; } @@ -1702,7 +1702,7 @@ void Desktop::createMouseInputSources() } //============================================================================== -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars) { #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 if (enableOrDisable) diff --git a/src/native/windows/juce_win32_Messaging.cpp b/src/native/windows/juce_win32_Messaging.cpp index 4a84125755..b1fd798de9 100644 --- a/src/native/windows/juce_win32_Messaging.cpp +++ b/src/native/windows/juce_win32_Messaging.cpp @@ -33,7 +33,9 @@ static const unsigned int specialId = WM_APP + 0x4400; static const unsigned int broadcastId = WM_APP + 0x4403; static const unsigned int specialCallbackId = WM_APP + 0x4402; -static const TCHAR* const messageWindowName = _T("JUCEWindow"); +static const TCHAR* const messageWindowName = _T("JUCEWindow"); +static ATOM messageWindowClassAtom = 0; +static LPCTSTR getMessageWindowClassName() throw() { return (LPCTSTR) MAKELONG (messageWindowClassAtom, 0); } HWND juce_messageWindowHandle = 0; @@ -146,7 +148,7 @@ static bool isEventBlockedByModalComps (MSG& m) return false; } -bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) { MSG m; @@ -188,7 +190,7 @@ bool juce_dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages } //============================================================================== -bool juce_postMessageToSystemQueue (Message* message) +bool MessageManager::postMessageToSystemQueue (Message* message) { message->incReferenceCount(); return PostMessage (juce_messageWindowHandle, specialId, 0, (LPARAM) message) != 0; @@ -217,18 +219,18 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call } //============================================================================== -static BOOL CALLBACK BroadcastEnumWindowProc (HWND hwnd, LPARAM lParam) +static BOOL CALLBACK broadcastEnumWindowProc (HWND hwnd, LPARAM lParam) { if (hwnd != juce_messageWindowHandle) - reinterpret_cast *> (lParam)->add ((void*) hwnd); + reinterpret_cast *> (lParam)->add (hwnd); return TRUE; } void MessageManager::broadcastMessage (const String& value) { - Array windows; - EnumWindows (&BroadcastEnumWindowProc, (LPARAM) &windows); + Array windows; + EnumWindows (&broadcastEnumWindowProc, (LPARAM) &windows); const String localCopy (value); @@ -239,7 +241,7 @@ void MessageManager::broadcastMessage (const String& value) for (int i = windows.size(); --i >= 0;) { - HWND hwnd = (HWND) windows.getUnchecked(i); + HWND hwnd = windows.getUnchecked(i); TCHAR windowName [64]; // no need to read longer strings than this GetWindowText (hwnd, windowName, 64); @@ -257,50 +259,40 @@ void MessageManager::broadcastMessage (const String& value) } //============================================================================== -static const String getMessageWindowClassName() +void MessageManager::doPlatformSpecificInitialisation() { + OleInitialize (0); + // this name has to be different for each app/dll instance because otherwise // poor old Win32 can get a bit confused (even despite it not being a process-global // window class). - static int number = 0; - if (number == 0) - number = 0x7fffffff & (int) Time::getHighResolutionTicks(); - - return "JUCEcs_" + String (number); -} - -void MessageManager::doPlatformSpecificInitialisation() -{ - OleInitialize (0); + String className ("JUCEcs_"); + className << (int) (Time::getHighResolutionTicks() & 0x7fffffff); - const String className (getMessageWindowClassName()); - - HMODULE hmod = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle(); + HMODULE moduleHandle = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle(); WNDCLASSEX wc; zerostruct (wc); - wc.cbSize = sizeof (wc); wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; wc.cbWndExtra = 4; - wc.hInstance = hmod; + wc.hInstance = moduleHandle; wc.lpszClassName = className.toWideCharPointer(); - RegisterClassEx (&wc); + messageWindowClassAtom = RegisterClassEx (&wc); + jassert (messageWindowClassAtom != 0); - juce_messageWindowHandle = CreateWindow (wc.lpszClassName, - messageWindowName, - 0, 0, 0, 0, 0, 0, 0, - hmod, 0); + juce_messageWindowHandle = CreateWindow (getMessageWindowClassName(), messageWindowName, + 0, 0, 0, 0, 0, 0, 0, moduleHandle, 0); + jassert (juce_messageWindowHandle != 0); } void MessageManager::doPlatformSpecificShutdown() { DestroyWindow (juce_messageWindowHandle); - UnregisterClass (getMessageWindowClassName().toWideCharPointer(), 0); + UnregisterClass (getMessageWindowClassName(), 0); OleUninitialize(); } - #endif diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index 46730ba414..3bb893ad41 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -1008,9 +1008,9 @@ private: HWND hwnd, parentToAddTo; ScopedPointer shadower; RenderingEngineType currentRenderingEngine; - #if JUCE_DIRECT2D + #if JUCE_DIRECT2D ScopedPointer direct2DContext; - #endif + #endif bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing; BorderSize windowBorder; HICON currentWindowIcon; @@ -1022,11 +1022,8 @@ private: class TemporaryImage : public Timer { public: - //============================================================================== TemporaryImage() {} - ~TemporaryImage() {} - //============================================================================== const Image& getImage (const bool transparent, const int w, const int h) { const Image::PixelFormat format = transparent ? Image::ARGB : Image::RGB; @@ -1038,7 +1035,6 @@ private: return image; } - //============================================================================== void timerCallback() { stopTimer(); @@ -1058,49 +1054,50 @@ private: { public: WindowClassHolder() - : windowClassName ("JUCE_") { - // this name has to be different for each app/dll instance because otherwise - // poor old Win32 can get a bit confused (even despite it not being a process-global - // window class). + // this name has to be different for each app/dll instance because otherwise poor old Win32 can + // get a bit confused (even despite it not being a process-global window class). + String windowClassName ("JUCE_"); windowClassName << (int) (Time::currentTimeMillis() & 0x7fffffff); HINSTANCE moduleHandle = (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(); - TCHAR moduleFile [1024]; - moduleFile[0] = 0; + TCHAR moduleFile [1024] = { 0 }; GetModuleFileName (moduleHandle, moduleFile, 1024); WORD iconNum = 0; WNDCLASSEX wcex; + zerostruct (wcex); wcex.cbSize = sizeof (wcex); wcex.style = CS_OWNDC; wcex.lpfnWndProc = (WNDPROC) windowProc; wcex.lpszClassName = windowClassName.toWideCharPointer(); - wcex.cbClsExtra = 0; wcex.cbWndExtra = 32; wcex.hInstance = moduleHandle; wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); iconNum = 1; wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum); - wcex.hCursor = 0; - wcex.hbrBackground = 0; - wcex.lpszMenuName = 0; - RegisterClassEx (&wcex); + atom = RegisterClassEx (&wcex); + jassert (atom != 0); } ~WindowClassHolder() { if (ComponentPeer::getNumPeers() == 0) - UnregisterClass (windowClassName.toWideCharPointer(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); + UnregisterClass (getWindowClassName(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); clearSingletonInstance(); } - String windowClassName; + LPCTSTR getWindowClassName() const throw() { return (LPCTSTR) MAKELONG (atom, 0); } juce_DeclareSingleton_SingleThreaded_Minimal (WindowClassHolder); + + private: + ATOM atom; + + JUCE_DECLARE_NON_COPYABLE (WindowClassHolder); }; //============================================================================== @@ -1155,12 +1152,12 @@ private: if ((styleFlags & windowIgnoresMouseClicks) != 0) exstyle |= WS_EX_TRANSPARENT; - if ((styleFlags & windowIsSemiTransparent) != 0 - && Desktop::canUseSemiTransparentWindows()) + if ((styleFlags & windowIsSemiTransparent) != 0 && Desktop::canUseSemiTransparentWindows()) exstyle |= WS_EX_LAYERED; - hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName.toWideCharPointer(), L"", type, 0, 0, 0, 0, - parentToAddTo, 0, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); + hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->getWindowClassName(), + L"", type, 0, 0, 0, 0, parentToAddTo, 0, + (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); #if JUCE_DIRECT2D setCurrentRenderingEngine (1); @@ -1431,10 +1428,7 @@ private: return s; } - int getCurrentRenderingEngine() throw() - { - return currentRenderingEngine; - } + int getCurrentRenderingEngine() const { return currentRenderingEngine; } #if JUCE_DIRECT2D void updateDirect2DContext() @@ -2477,8 +2471,6 @@ public: timerCallback(); } - ~ScreenSaverDefeater() {} - void timerCallback() { if (Process::isForegroundProcess()) @@ -2534,7 +2526,7 @@ bool Desktop::isScreenSaverEnabled() throw() */ //============================================================================== -void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) +void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /*allowMenusAndBars*/) { if (enableOrDisable) kioskModeComponent->setBounds (Desktop::getInstance().getMainMonitorArea (false));