Browse Source

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

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
ed0ed361f0
19 changed files with 160 additions and 215 deletions
  1. +70
    -97
      juce_amalgamated.cpp
  2. +10
    -8
      juce_amalgamated.h
  3. +1
    -1
      src/core/juce_StandardHeader.h
  4. +2
    -8
      src/events/juce_MessageManager.cpp
  5. +6
    -6
      src/events/juce_MessageManager.h
  6. +2
    -4
      src/gui/components/juce_Desktop.cpp
  7. +2
    -0
      src/gui/components/juce_Desktop.h
  8. +1
    -1
      src/gui/components/windows/juce_ComponentPeer.cpp
  9. +1
    -1
      src/gui/components/windows/juce_ComponentPeer.h
  10. +2
    -2
      src/native/android/juce_android_Messaging.cpp
  11. +8
    -17
      src/native/android/juce_android_Windowing.cpp
  12. +2
    -2
      src/native/linux/juce_linux_Messaging.cpp
  13. +1
    -1
      src/native/linux/juce_linux_Windowing.cpp
  14. +1
    -1
      src/native/mac/juce_ios_MessageManager.mm
  15. +2
    -1
      src/native/mac/juce_ios_UIViewComponentPeer.mm
  16. +1
    -1
      src/native/mac/juce_mac_MessageManager.mm
  17. +3
    -3
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  18. +23
    -31
      src/native/windows/juce_win32_Messaging.cpp
  19. +22
    -30
      src/native/windows/juce_win32_Windowing.cpp

+ 70
- 97
juce_amalgamated.cpp 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()
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<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 {}


+ 10
- 8
juce_amalgamated.h 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,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:


+ 1
- 1
src/core/juce_StandardHeader.h 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.


+ 2
- 8
src/events/juce_MessageManager.cpp 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());


+ 6
- 6
src/events/juce_MessageManager.h View File

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


+ 2
- 4
src/gui/components/juce_Desktop.cpp 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);
}
}
}


+ 2
- 0
src/gui/components/juce_Desktop.h 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();


+ 1
- 1
src/gui/components/windows/juce_ComponentPeer.cpp View File

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


+ 1
- 1
src/gui/components/windows/juce_ComponentPeer.h 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:


+ 2
- 2
src/native/android/juce_android_Messaging.cpp 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);


+ 8
- 17
src/native/android/juce_android_Windowing.cpp 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 {}


+ 2
- 2
src/native/linux/juce_linux_Messaging.cpp 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)
{


+ 1
- 1
src/native/linux/juce_linux_Windowing.cpp 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));


+ 1
- 1
src/native/mac/juce_ios_MessageManager.mm 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);


+ 2
- 1
src/native/mac/juce_ios_UIViewComponentPeer.mm 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
}
//==============================================================================


+ 1
- 1
src/native/mac/juce_mac_MessageManager.mm 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;


+ 3
- 3
src/native/mac/juce_mac_NSViewComponentPeer.mm 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)


+ 23
- 31
src/native/windows/juce_win32_Messaging.cpp 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()
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

+ 22
- 30
src/native/windows/juce_win32_Windowing.cpp 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));


Loading…
Cancel
Save