1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

Cleaned up a couple of win32 window class methods. Some other minor clean-ups.

This commit is contained in:
Julian Storer 2011-03-13 17:03:08 +00:00
parent c15d414895
commit ed0ed361f0
19 changed files with 164 additions and 219 deletions

View file

@ -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 <Array<void*>*> (lParam)->add ((void*) hwnd);
reinterpret_cast <Array<HWND>*> (lParam)->add (hwnd);
return TRUE;
}
void MessageManager::broadcastMessage (const String& value)
{
Array<void*> windows;
EnumWindows (&BroadcastEnumWindowProc, (LPARAM) &windows);
Array<HWND> 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()
{
// 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);
const String className (getMessageWindowClassName());
// 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).
HMODULE hmod = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle();
String className ("JUCEcs_");
className << (int) (Time::getHighResolutionTicks() & 0x7fffffff);
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<DropShadower> shadower;
RenderingEngineType currentRenderingEngine;
#if JUCE_DIRECT2D
#if JUCE_DIRECT2D
ScopedPointer<Direct2DLowLevelGraphicsContext> direct2DContext;
#endif
#endif
bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing;
BorderSize<int> 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 <Rectangle<int> >& 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 {}

View file

@ -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,17 +48066,17 @@ private:
bool quitMessagePosted, quitMessageReceived;
Thread::ThreadID messageThreadId;
static void* exitModalLoopCallback (void*);
void postMessageToQueue (Message* message);
static void doPlatformSpecificInitialisation();
static void doPlatformSpecificShutdown();
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();
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:

View file

@ -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.

View file

@ -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());

View file

@ -181,17 +181,17 @@ private:
bool quitMessagePosted, quitMessageReceived;
Thread::ThreadID messageThreadId;
static void* exitModalLoopCallback (void*);
void postMessageToQueue (Message* message);
static void doPlatformSpecificInitialisation();
static void doPlatformSpecificShutdown();
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();
static bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager);
};

View file

@ -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);
}
}
}

View file

@ -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();

View file

@ -565,7 +565,7 @@ const StringArray ComponentPeer::getAvailableRenderingEngines()
return s;
}
int ComponentPeer::getCurrentRenderingEngine() throw()
int ComponentPeer::getCurrentRenderingEngine() const
{
return 0;
}

View file

@ -353,7 +353,7 @@ public:
//==============================================================================
virtual const StringArray getAvailableRenderingEngines();
virtual int getCurrentRenderingEngine() throw();
virtual int getCurrentRenderingEngine() const;
virtual void setCurrentRenderingEngine (int index);
protected:

View file

@ -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);

View file

@ -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 {}

View file

@ -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)
{

View file

@ -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));

View file

@ -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);

View file

@ -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
}
//==============================================================================

View file

@ -469,7 +469,7 @@ void MessageManager::doPlatformSpecificShutdown()
}
}
bool juce_postMessageToSystemQueue (Message* message)
bool MessageManager::postMessageToSystemQueue (Message* message)
{
juceAppDelegate->redirector->postMessage (message);
return true;

View file

@ -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)

View file

@ -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 <Array<void*>*> (lParam)->add ((void*) hwnd);
reinterpret_cast <Array<HWND>*> (lParam)->add (hwnd);
return TRUE;
}
void MessageManager::broadcastMessage (const String& value)
{
Array<void*> windows;
EnumWindows (&BroadcastEnumWindowProc, (LPARAM) &windows);
Array<HWND> 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()
{
// 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);
const String className (getMessageWindowClassName());
// 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).
HMODULE hmod = (HMODULE) PlatformUtilities::getCurrentModuleInstanceHandle();
String className ("JUCEcs_");
className << (int) (Time::getHighResolutionTicks() & 0x7fffffff);
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

View file

@ -1008,9 +1008,9 @@ private:
HWND hwnd, parentToAddTo;
ScopedPointer<DropShadower> shadower;
RenderingEngineType currentRenderingEngine;
#if JUCE_DIRECT2D
#if JUCE_DIRECT2D
ScopedPointer<Direct2DLowLevelGraphicsContext> direct2DContext;
#endif
#endif
bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing;
BorderSize<int> 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));