1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

WASAPI device list change fix. Changed Treeview to allow drag-and-drop onto its background. Minor clean-ups.

This commit is contained in:
Julian Storer 2011-06-23 19:42:44 +01:00
parent 59f78f4cbe
commit ecefeaa91e
21 changed files with 480 additions and 410 deletions

View file

@ -125,7 +125,7 @@ struct MessageDispatchSystem
MessageQueue messageQueue;
};
static MessageDispatchSystem* dispatcher = nullptr;
static ScopedPointer<MessageDispatchSystem> dispatcher;
void MessageManager::doPlatformSpecificInitialisation()
{
@ -135,7 +135,7 @@ void MessageManager::doPlatformSpecificInitialisation()
void MessageManager::doPlatformSpecificShutdown()
{
deleteAndZero (dispatcher);
dispatcher = nullptr;
}
bool MessageManager::postMessageToSystemQueue (Message* message)

View file

@ -55,8 +55,6 @@ namespace ActiveXHelpers
//==============================================================================
class JuceOleInPlaceFrame : public ComBaseClassHelper <IOleInPlaceFrame>
{
HWND window;
public:
JuceOleInPlaceFrame (HWND window_) : window (window_) {}
@ -71,15 +69,15 @@ namespace ActiveXHelpers
HRESULT __stdcall RemoveMenus (HMENU) { return E_NOTIMPL; }
HRESULT __stdcall SetStatusText (LPCOLESTR) { return S_OK; }
HRESULT __stdcall EnableModeless (BOOL) { return S_OK; }
HRESULT __stdcall TranslateAccelerator(LPMSG, WORD) { return E_NOTIMPL; }
HRESULT __stdcall TranslateAccelerator (LPMSG, WORD) { return E_NOTIMPL; }
private:
HWND window;
};
//==============================================================================
class JuceIOleInPlaceSite : public ComBaseClassHelper <IOleInPlaceSite>
{
HWND window;
JuceOleInPlaceFrame* frame;
public:
JuceIOleInPlaceSite (HWND window_)
: window (window_),
@ -117,13 +115,15 @@ namespace ActiveXHelpers
HRESULT __stdcall DiscardUndoState() { return E_NOTIMPL; }
HRESULT __stdcall DeactivateAndUndo() { return E_NOTIMPL; }
HRESULT __stdcall OnPosRectChange (LPCRECT) { return S_OK; }
private:
HWND window;
JuceOleInPlaceFrame* frame;
};
//==============================================================================
class JuceIOleClientSite : public ComBaseClassHelper <IOleClientSite>
{
JuceIOleInPlaceSite* inplaceSite;
public:
JuceIOleClientSite (HWND window)
: inplaceSite (new JuceIOleInPlaceSite (window))
@ -152,12 +152,15 @@ namespace ActiveXHelpers
HRESULT __stdcall ShowObject() { return S_OK; }
HRESULT __stdcall OnShowWindow (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall RequestNewObjectLayout() { return E_NOTIMPL; }
private:
JuceIOleInPlaceSite* inplaceSite;
};
//==============================================================================
static Array<ActiveXControlComponent*> activeXComps;
static HWND getHWND (const ActiveXControlComponent* const component)
HWND getHWND (const ActiveXControlComponent* const component)
{
HWND hwnd = 0;
@ -173,7 +176,7 @@ namespace ActiveXHelpers
return hwnd;
}
static void offerActiveXMouseEventToPeer (ComponentPeer* const peer, HWND hwnd, UINT message, LPARAM lParam)
void offerActiveXMouseEventToPeer (ComponentPeer* const peer, HWND hwnd, UINT message, LPARAM lParam)
{
RECT activeXRect, peerRect;
GetWindowRect (hwnd, &activeXRect);
@ -214,7 +217,7 @@ public:
controlHWND (0),
storage (new ActiveXHelpers::JuceIStorage()),
clientSite (new ActiveXHelpers::JuceIOleClientSite (hwnd)),
control (0)
control (nullptr)
{
}
@ -309,6 +312,7 @@ public:
IOleObject* control;
};
//==============================================================================
ActiveXControlComponent::ActiveXControlComponent()
: originalWndProc (0),
mouseEventsAllowed (true)

View file

@ -56,7 +56,7 @@ public:
if (FAILED (hr))
return;
hr = graphBuilder.QueryInterface (IID_IMediaControl, mediaControl);
hr = graphBuilder.QueryInterface (mediaControl);
if (FAILED (hr))
return;
@ -95,7 +95,7 @@ public:
if (FAILED (hr))
return;
hr = sampleGrabberBase.QueryInterface (IID_ISampleGrabber, sampleGrabber);
hr = sampleGrabberBase.QueryInterface (sampleGrabber);
if (FAILED (hr))
return;
@ -196,7 +196,7 @@ public:
if (getPin (filter, PINDIR_OUTPUT, pin))
{
ComSmartPtr <IAMPushSource> pushSource;
HRESULT hr = pin.QueryInterface (IID_IAMPushSource, pushSource);
HRESULT hr = pin.QueryInterface (pushSource);
if (pushSource != nullptr)
{
@ -269,7 +269,7 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IFileSinkFilter> fileSink;
hr = asfWriter.QueryInterface (IID_IFileSinkFilter, fileSink);
hr = asfWriter.QueryInterface (fileSink);
if (SUCCEEDED (hr))
{
@ -282,7 +282,7 @@ public:
if (SUCCEEDED (hr))
{
ComSmartPtr <IConfigAsfWriter> asfConfig;
hr = asfWriter.QueryInterface (IID_IConfigAsfWriter, asfConfig);
hr = asfWriter.QueryInterface (asfConfig);
asfConfig->SetIndexMode (true);
ComSmartPtr <IWMProfileManager> profileManager;
hr = WMCreateProfileManager (profileManager.resetAndGetPointerAddress());

View file

@ -69,13 +69,13 @@ namespace DirectShowHelpers
hr = graphBuilder->AddFilter (baseFilter, L"VMR-7");
if (SUCCEEDED (hr))
hr = baseFilter.QueryInterface (IID_IVMRFilterConfig, filterConfig);
hr = baseFilter.QueryInterface (filterConfig);
if (SUCCEEDED (hr))
hr = filterConfig->SetRenderingMode (VMRMode_Windowless);
if (SUCCEEDED (hr))
hr = baseFilter.QueryInterface (IID_IVMRWindowlessControl, windowlessControl);
hr = baseFilter.QueryInterface (windowlessControl);
if (SUCCEEDED (hr))
hr = windowlessControl->SetVideoClippingWindow (hwnd);
@ -141,7 +141,7 @@ namespace DirectShowHelpers
hr = graphBuilder->AddFilter (baseFilter, L"EVR");
if (SUCCEEDED (hr))
hr = baseFilter.QueryInterface (IID_IMFGetService, getService);
hr = baseFilter.QueryInterface (getService);
if (SUCCEEDED (hr))
hr = getService->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl,
@ -292,10 +292,10 @@ public:
HRESULT hr = graphBuilder.CoCreateInstance (CLSID_FilterGraph);
// basic playback interfaces
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (IID_IMediaControl, mediaControl);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (IID_IMediaPosition, mediaPosition);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (IID_IMediaEventEx, mediaEvent);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (IID_IBasicAudio, basicAudio);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (mediaControl);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (mediaPosition);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (mediaEvent);
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (basicAudio);
// video renderer interface
if (SUCCEEDED (hr))

View file

@ -598,7 +598,7 @@ File File::getLinkedTarget() const
if (SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)))
{
ComSmartPtr <IPersistFile> persistFile;
if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile)))
if (SUCCEEDED (shellLink.QueryInterface (persistFile)))
{
if (SUCCEEDED (persistFile->Load (p.toWideCharPointer(), STGM_READ))
&& SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI)))

View file

@ -71,122 +71,165 @@ private:
//==============================================================================
static const unsigned int specialId = WM_APP + 0x4400;
static const unsigned int broadcastId = WM_APP + 0x4403;
static const unsigned int specialCallbackId = WM_APP + 0x4402;
HWND juce_messageWindowHandle = 0; // (this is referred to by other parts of the codebase)
static const TCHAR messageWindowName[] = _T("JUCEWindow");
static ScopedPointer<HiddenMessageWindow> messageWindow;
//==============================================================================
class JuceWindowIdentifier
{
public:
static bool isJUCEWindow (HWND hwnd) noexcept
{
return GetWindowLong (hwnd, GWLP_USERDATA) == improbableWindowNumber;
}
HWND juce_messageWindowHandle = 0;
static void setAsJUCEWindow (HWND hwnd, bool isJuceWindow) noexcept
{
SetWindowLongPtr (hwnd, GWLP_USERDATA, isJuceWindow ? improbableWindowNumber : 0);
}
extern long improbableWindowNumber; // defined in windowing.cpp
private:
enum { improbableWindowNumber = 0xf965aa01 };
};
//==============================================================================
static LRESULT CALLBACK juce_MessageWndProc (HWND h,
const UINT message,
const WPARAM wParam,
const LPARAM lParam) noexcept
namespace WindowsMessageHelpers
{
JUCE_TRY
const unsigned int specialId = WM_APP + 0x4400;
const unsigned int broadcastId = WM_APP + 0x4403;
const unsigned int specialCallbackId = WM_APP + 0x4402;
const TCHAR messageWindowName[] = _T("JUCEWindow");
ScopedPointer<HiddenMessageWindow> messageWindow;
//==============================================================================
LRESULT CALLBACK messageWndProc (HWND h, const UINT message, const WPARAM wParam, const LPARAM lParam) noexcept
{
if (h == juce_messageWindowHandle)
JUCE_TRY
{
if (message == specialCallbackId)
if (h == juce_messageWindowHandle)
{
MessageCallbackFunction* const func = (MessageCallbackFunction*) wParam;
return (LRESULT) (*func) ((void*) lParam);
}
else if (message == specialId)
{
// these are trapped early in the dispatch call, but must also be checked
// here in case there are windows modal dialog boxes doing their own
// dispatch loop and not calling our version
if (message == specialCallbackId)
{
MessageCallbackFunction* const func = (MessageCallbackFunction*) wParam;
return (LRESULT) (*func) ((void*) lParam);
}
else if (message == specialId)
{
// these are trapped early in the dispatch call, but must also be checked
// here in case there are windows modal dialog boxes doing their own
// dispatch loop and not calling our version
Message* const message = reinterpret_cast <Message*> (lParam);
MessageManager::getInstance()->deliverMessage (message);
message->decReferenceCount();
return 0;
}
else if (message == broadcastId)
{
const ScopedPointer <String> messageString ((String*) lParam);
MessageManager::getInstance()->deliverBroadcastMessage (*messageString);
return 0;
}
else if (message == WM_COPYDATA && ((const COPYDATASTRUCT*) lParam)->dwData == broadcastId)
{
const COPYDATASTRUCT* data = (COPYDATASTRUCT*) lParam;
Message* const message = reinterpret_cast <Message*> (lParam);
MessageManager::getInstance()->deliverMessage (message);
message->decReferenceCount();
return 0;
}
else if (message == broadcastId)
{
const ScopedPointer <String> messageString ((String*) lParam);
MessageManager::getInstance()->deliverBroadcastMessage (*messageString);
return 0;
}
else if (message == WM_COPYDATA && ((const COPYDATASTRUCT*) lParam)->dwData == broadcastId)
{
const COPYDATASTRUCT* data = (COPYDATASTRUCT*) lParam;
const String messageString (CharPointer_UTF32 ((const CharPointer_UTF32::CharType*) data->lpData),
data->cbData / sizeof (CharPointer_UTF32::CharType));
const String messageString (CharPointer_UTF32 ((const CharPointer_UTF32::CharType*) data->lpData),
data->cbData / sizeof (CharPointer_UTF32::CharType));
PostMessage (juce_messageWindowHandle, broadcastId, 0, (LPARAM) new String (messageString));
return 0;
PostMessage (juce_messageWindowHandle, broadcastId, 0, (LPARAM) new String (messageString));
return 0;
}
}
}
JUCE_CATCH_EXCEPTION
return DefWindowProc (h, message, wParam, lParam);
}
JUCE_CATCH_EXCEPTION
return DefWindowProc (h, message, wParam, lParam);
}
bool isHWNDBlockedByModalComponents (HWND h) noexcept
{
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
{
Component* const c = Desktop::getInstance().getComponent (i);
if (c != nullptr
&& (! c->isCurrentlyBlockedByAnotherModalComponent())
&& IsChild ((HWND) c->getWindowHandle(), h))
return false;
}
return true;
}
bool isEventBlockedByModalComps (MSG& m)
{
if (Component::getNumCurrentlyModalComponents() == 0 || JuceWindowIdentifier::isJUCEWindow (m.hwnd))
return false;
switch (m.message)
{
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
case 0x020A: /* WM_MOUSEWHEEL */
case 0x020E: /* WM_MOUSEHWHEEL */
case WM_KEYUP:
case WM_SYSKEYUP:
case WM_CHAR:
case WM_APPCOMMAND:
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
case WM_MOUSEACTIVATE:
case WM_NCMOUSEHOVER:
case WM_MOUSEHOVER:
return isHWNDBlockedByModalComponents (m.hwnd);
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
if (isHWNDBlockedByModalComponents (m.hwnd))
{
Component* const modal = Component::getCurrentlyModalComponent (0);
if (modal != nullptr)
modal->inputAttemptWhenModal();
return true;
}
break;
default:
break;
}
static bool isEventBlockedByModalComps (MSG& m)
{
if (Component::getNumCurrentlyModalComponents() == 0
|| GetWindowLong (m.hwnd, GWLP_USERDATA) == improbableWindowNumber)
return false;
switch (m.message)
{
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
case 0x020A: /* WM_MOUSEWHEEL */
case 0x020E: /* WM_MOUSEHWHEEL */
case WM_KEYUP:
case WM_SYSKEYUP:
case WM_CHAR:
case WM_APPCOMMAND:
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONUP:
case WM_MOUSEACTIVATE:
case WM_NCMOUSEHOVER:
case WM_MOUSEHOVER:
return true;
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
{
Component* const modal = Component::getCurrentlyModalComponent (0);
if (modal != nullptr)
modal->inputAttemptWhenModal();
return true;
}
default:
break;
}
return false;
BOOL CALLBACK broadcastEnumWindowProc (HWND hwnd, LPARAM lParam)
{
if (hwnd != juce_messageWindowHandle)
reinterpret_cast <Array<HWND>*> (lParam)->add (hwnd);
return TRUE;
}
}
//==============================================================================
bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages)
{
using namespace WindowsMessageHelpers;
MSG m;
if (returnIfNoPendingMessages && ! PeekMessage (&m, (HWND) 0, 0, 0, 0))
@ -205,16 +248,16 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPend
if (JUCEApplication::getInstance() != nullptr)
JUCEApplication::getInstance()->systemRequestedQuit();
}
else if (! isEventBlockedByModalComps (m))
else if (! WindowsMessageHelpers::isEventBlockedByModalComps (m))
{
if ((m.message == WM_LBUTTONDOWN || m.message == WM_RBUTTONDOWN)
&& GetWindowLong (m.hwnd, GWLP_USERDATA) != improbableWindowNumber)
&& ! JuceWindowIdentifier::isJUCEWindow (m.hwnd))
{
// if it's someone else's window being clicked on, and the focus is
// currently on a juce window, pass the kb focus over..
HWND currentFocus = GetFocus();
if (currentFocus == 0 || GetWindowLong (currentFocus, GWLP_USERDATA) == improbableWindowNumber)
if (currentFocus == 0 || JuceWindowIdentifier::isJUCEWindow (currentFocus))
SetFocus (m.hwnd);
}
@ -226,14 +269,12 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPend
return true;
}
//==============================================================================
bool MessageManager::postMessageToSystemQueue (Message* message)
{
message->incReferenceCount();
return PostMessage (juce_messageWindowHandle, specialId, 0, (LPARAM) message) != 0;
return PostMessage (juce_messageWindowHandle, WindowsMessageHelpers::specialId, 0, (LPARAM) message) != 0;
}
//==============================================================================
void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData)
{
@ -249,30 +290,21 @@ void* MessageManager::callFunctionOnMessageThread (MessageCallbackFunction* call
jassert (! MessageManager::getInstance()->currentThreadHasLockedMessageManager());
return (void*) SendMessage (juce_messageWindowHandle,
specialCallbackId,
WindowsMessageHelpers::specialCallbackId,
(WPARAM) callback,
(LPARAM) userData);
}
}
//==============================================================================
static BOOL CALLBACK broadcastEnumWindowProc (HWND hwnd, LPARAM lParam)
{
if (hwnd != juce_messageWindowHandle)
reinterpret_cast <Array<HWND>*> (lParam)->add (hwnd);
return TRUE;
}
void MessageManager::broadcastMessage (const String& value)
{
Array<HWND> windows;
EnumWindows (&broadcastEnumWindowProc, (LPARAM) &windows);
EnumWindows (&WindowsMessageHelpers::broadcastEnumWindowProc, (LPARAM) &windows);
const String localCopy (value);
COPYDATASTRUCT data;
data.dwData = broadcastId;
data.dwData = WindowsMessageHelpers::broadcastId;
data.cbData = (localCopy.length() + 1) * sizeof (CharPointer_UTF32::CharType);
data.lpData = (void*) localCopy.toUTF32().getAddress();
@ -284,7 +316,7 @@ void MessageManager::broadcastMessage (const String& value)
GetWindowText (hwnd, windowName, 64);
windowName [63] = 0;
if (String (windowName) == messageWindowName)
if (String (windowName) == WindowsMessageHelpers::messageWindowName)
{
DWORD_PTR result;
SendMessageTimeout (hwnd, WM_COPYDATA,
@ -300,13 +332,14 @@ void MessageManager::doPlatformSpecificInitialisation()
{
OleInitialize (0);
messageWindow = new HiddenMessageWindow (messageWindowName, (WNDPROC) juce_MessageWndProc);
using namespace WindowsMessageHelpers;
messageWindow = new HiddenMessageWindow (messageWindowName, (WNDPROC) messageWndProc);
juce_messageWindowHandle = messageWindow->getHWND();
}
void MessageManager::doPlatformSpecificShutdown()
{
messageWindow = nullptr;
WindowsMessageHelpers::messageWindow = nullptr;
OleUninitialize();
}

View file

@ -254,6 +254,12 @@ public:
return p->QueryInterface (classUUID, (void**) destObject.resetAndGetPointerAddress());
}
template <class OtherComClass>
HRESULT QueryInterface (ComSmartPtr<OtherComClass>& destObject) const
{
return this->QueryInterface (__uuidof (OtherComClass), destObject);
}
private:
ComClass* p;

View file

@ -35,12 +35,9 @@ namespace
{
HKEY rootKey = 0;
if (name.startsWithIgnoreCase ("HKEY_CURRENT_USER\\"))
rootKey = HKEY_CURRENT_USER;
else if (name.startsWithIgnoreCase ("HKEY_LOCAL_MACHINE\\"))
rootKey = HKEY_LOCAL_MACHINE;
else if (name.startsWithIgnoreCase ("HKEY_CLASSES_ROOT\\"))
rootKey = HKEY_CLASSES_ROOT;
if (name.startsWithIgnoreCase ("HKEY_CURRENT_USER\\")) rootKey = HKEY_CURRENT_USER;
else if (name.startsWithIgnoreCase ("HKEY_LOCAL_MACHINE\\")) rootKey = HKEY_LOCAL_MACHINE;
else if (name.startsWithIgnoreCase ("HKEY_CLASSES_ROOT\\")) rootKey = HKEY_CLASSES_ROOT;
if (rootKey != 0)
{
@ -186,10 +183,9 @@ bool juce_IsRunningInWine()
//==============================================================================
String JUCE_CALLTYPE PlatformUtilities::getCurrentCommandLineParams()
{
const String commandLine (GetCommandLineW());
return String (CharacterFunctions::findEndOfToken (commandLine.getCharPointer(),
String (" ").getCharPointer(),
String ("\"").getCharPointer())).trimStart();
return String (CharacterFunctions::findEndOfToken (CharPointer_UTF16 (GetCommandLineW()),
CharPointer_UTF16 (L" "),
CharPointer_UTF16 (L"\""))).trimStart();
}
//==============================================================================

View file

@ -99,7 +99,7 @@ void QuickTimeMovieComponent::createControlIfNeeded()
const IID qtInterfaceIID = __uuidof (IQTControl);
pimpl->qtControl = (IQTControl*) queryInterface (&qtInterfaceIID);
if (pimpl->qtControl != 0)
if (pimpl->qtControl != nullptr)
{
pimpl->qtControl->Release(); // it has one ref too many at this point

View file

@ -109,7 +109,7 @@ EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device)
{
EDataFlow flow = eRender;
ComSmartPtr <IMMEndpoint> endPoint;
if (check (device.QueryInterface (__uuidof (IMMEndpoint), endPoint)))
if (check (device.QueryInterface (endPoint)))
(void) check (endPoint->GetDataFlow (&flow));
return flow;
@ -1134,7 +1134,8 @@ private:
{
if (message == WM_DEVICECHANGE
&& (wParam == 0x8000 /*DBT_DEVICEARRIVAL*/
|| wParam == 0x8004 /*DBT_DEVICEREMOVECOMPLETE*/))
|| wParam == 0x8004 /*DBT_DEVICEREMOVECOMPLETE*/
|| wParam == 0x0007 /*DBT_DEVNODES_CHANGED*/))
{
((WASAPIAudioIODeviceType*) GetWindowLongPtr (h, GWLP_USERDATA))->handleDeviceChange();
}

View file

@ -415,10 +415,6 @@ namespace IconConverters
}
}
//==============================================================================
long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp
//==============================================================================
class Win32ComponentPeer : public ComponentPeer
{
@ -467,7 +463,7 @@ public:
// do this before the next bit to avoid messages arriving for this window
// before it's destroyed
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
JuceWindowIdentifier::setAsJUCEWindow (hwnd, false);
callFunctionIfNotLocked (&destroyWindowCallback, (void*) hwnd);
@ -820,7 +816,7 @@ public:
//==============================================================================
static Win32ComponentPeer* getOwnerOfWindow (HWND h) noexcept
{
if (h != 0 && GetWindowLongPtr (h, GWLP_USERDATA) == improbableWindowNumber)
if (h != 0 && JuceWindowIdentifier::isJUCEWindow (h))
return (Win32ComponentPeer*) (pointer_sized_int) GetWindowLongPtr (h, 8);
return nullptr;
@ -1140,7 +1136,7 @@ private:
{
SetWindowLongPtr (hwnd, 0, 0);
SetWindowLongPtr (hwnd, 8, (LONG_PTR) this);
SetWindowLongPtr (hwnd, GWLP_USERDATA, improbableWindowNumber);
JuceWindowIdentifier::setAsJUCEWindow (hwnd, true);
if (dropTarget == nullptr)
dropTarget = new JuceDropTarget (this);