|
|
|
@@ -797,7 +797,6 @@ public: |
|
|
|
void toBehind (ComponentPeer* other)
|
|
|
|
{
|
|
|
|
HWNDComponentPeer* const otherPeer = dynamic_cast <HWNDComponentPeer*> (other);
|
|
|
|
|
|
|
|
jassert (otherPeer != nullptr); // wrong type of window?
|
|
|
|
|
|
|
|
if (otherPeer != nullptr)
|
|
|
|
@@ -1163,14 +1162,10 @@ private: |
|
|
|
static bool isHWNDBlockedByModalComponents (HWND h)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if (Component* const c = Desktop::getInstance().getComponent (i))
|
|
|
|
if ((! c->isCurrentlyBlockedByAnotherModalComponent())
|
|
|
|
&& IsChild ((HWND) c->getWindowHandle(), h))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
@@ -1215,8 +1210,7 @@ private: |
|
|
|
case WM_SYSKEYDOWN:
|
|
|
|
if (isHWNDBlockedByModalComponents (m.hwnd))
|
|
|
|
{
|
|
|
|
Component* const modal = Component::getCurrentlyModalComponent (0);
|
|
|
|
if (modal != nullptr)
|
|
|
|
if (Component* const modal = Component::getCurrentlyModalComponent (0))
|
|
|
|
modal->inputAttemptWhenModal();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@@ -1351,9 +1345,7 @@ private: |
|
|
|
{
|
|
|
|
if (isUsingUpdateLayeredWindow())
|
|
|
|
{
|
|
|
|
HWND parentHwnd = GetParent (hwnd);
|
|
|
|
|
|
|
|
if (parentHwnd != 0)
|
|
|
|
if (HWND parentHwnd = GetParent (hwnd))
|
|
|
|
{
|
|
|
|
RECT parentRect;
|
|
|
|
GetWindowRect (parentHwnd, &parentRect);
|
|
|
|
@@ -1957,8 +1949,7 @@ private: |
|
|
|
|
|
|
|
void forwardMessageToParent (UINT message, WPARAM wParam, LPARAM lParam) const
|
|
|
|
{
|
|
|
|
HWND parentH = GetParent (hwnd);
|
|
|
|
if (parentH != 0)
|
|
|
|
if (HWND parentH = GetParent (hwnd))
|
|
|
|
PostMessage (parentH, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1995,11 +1986,11 @@ private: |
|
|
|
&& (styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable);
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT handleSizeConstraining (RECT* const r, const WPARAM wParam)
|
|
|
|
LRESULT handleSizeConstraining (RECT& r, const WPARAM wParam)
|
|
|
|
{
|
|
|
|
if (isConstrainedNativeWindow())
|
|
|
|
{
|
|
|
|
Rectangle<int> pos (rectangleFromRECT (*r));
|
|
|
|
Rectangle<int> pos (rectangleFromRECT (r));
|
|
|
|
|
|
|
|
constrainer->checkBounds (pos, windowBorder.addedTo (component.getBounds()),
|
|
|
|
Desktop::getInstance().getDisplays().getTotalBounds (true),
|
|
|
|
@@ -2007,23 +1998,23 @@ private: |
|
|
|
wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT || wParam == WMSZ_BOTTOMLEFT,
|
|
|
|
wParam == WMSZ_BOTTOM || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT,
|
|
|
|
wParam == WMSZ_RIGHT || wParam == WMSZ_TOPRIGHT || wParam == WMSZ_BOTTOMRIGHT);
|
|
|
|
r->left = pos.getX();
|
|
|
|
r->top = pos.getY();
|
|
|
|
r->right = pos.getRight();
|
|
|
|
r->bottom = pos.getBottom();
|
|
|
|
r.left = pos.getX();
|
|
|
|
r.top = pos.getY();
|
|
|
|
r.right = pos.getRight();
|
|
|
|
r.bottom = pos.getBottom();
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT handlePositionChanging (WINDOWPOS* const wp)
|
|
|
|
LRESULT handlePositionChanging (WINDOWPOS& wp)
|
|
|
|
{
|
|
|
|
if (isConstrainedNativeWindow())
|
|
|
|
{
|
|
|
|
if ((wp->flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE)
|
|
|
|
if ((wp.flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE)
|
|
|
|
&& ! Component::isMouseButtonDownAnywhere())
|
|
|
|
{
|
|
|
|
Rectangle<int> pos (wp->x, wp->y, wp->cx, wp->cy);
|
|
|
|
Rectangle<int> pos (wp.x, wp.y, wp.cx, wp.cy);
|
|
|
|
const Rectangle<int> current (windowBorder.addedTo (component.getBounds()));
|
|
|
|
|
|
|
|
constrainer->checkBounds (pos, current,
|
|
|
|
@@ -2032,13 +2023,18 @@ private: |
|
|
|
pos.getX() != current.getX() && pos.getRight() == current.getRight(),
|
|
|
|
pos.getY() == current.getY() && pos.getBottom() != current.getBottom(),
|
|
|
|
pos.getX() == current.getX() && pos.getRight() != current.getRight());
|
|
|
|
wp->x = pos.getX();
|
|
|
|
wp->y = pos.getY();
|
|
|
|
wp->cx = pos.getWidth();
|
|
|
|
wp->cy = pos.getHeight();
|
|
|
|
wp.x = pos.getX();
|
|
|
|
wp.y = pos.getY();
|
|
|
|
wp.cx = pos.getWidth();
|
|
|
|
wp.cy = pos.getHeight();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((wp.flags & SWP_SHOWWINDOW) != 0 && ! component.isVisible()))
|
|
|
|
component.setVisible (true);
|
|
|
|
else if (((wp.flags & SWP_HIDEWINDOW) != 0 && component.isVisible()))
|
|
|
|
component.setVisible (false);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2135,9 +2131,7 @@ private: |
|
|
|
public:
|
|
|
|
static LRESULT CALLBACK windowProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
HWNDComponentPeer* const peer = getOwnerOfWindow (h);
|
|
|
|
|
|
|
|
if (peer != nullptr)
|
|
|
|
if (HWNDComponentPeer* const peer = getOwnerOfWindow (h))
|
|
|
|
{
|
|
|
|
jassert (isValidPeer (peer));
|
|
|
|
return peer->peerWindowProc (h, message, wParam, lParam);
|
|
|
|
@@ -2162,9 +2156,7 @@ private: |
|
|
|
|
|
|
|
static Point<int> getCurrentMousePosGlobal() noexcept
|
|
|
|
{
|
|
|
|
const DWORD mp = GetMessagePos();
|
|
|
|
return Point<int> (GET_X_LPARAM (mp),
|
|
|
|
GET_Y_LPARAM (mp));
|
|
|
|
return getPointFromLParam (GetMessagePos());
|
|
|
|
}
|
|
|
|
|
|
|
|
Point<int> getCurrentMousePos() noexcept
|
|
|
|
@@ -2239,8 +2231,8 @@ private: |
|
|
|
return 0;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
case WM_SIZING: return handleSizeConstraining ((RECT*) lParam, wParam);
|
|
|
|
case WM_WINDOWPOSCHANGING: return handlePositionChanging ((WINDOWPOS*) lParam);
|
|
|
|
case WM_SIZING: return handleSizeConstraining (*(RECT*) lParam, wParam);
|
|
|
|
case WM_WINDOWPOSCHANGING: return handlePositionChanging (*(WINDOWPOS*) lParam);
|
|
|
|
|
|
|
|
case WM_WINDOWPOSCHANGED:
|
|
|
|
{
|
|
|
|
@@ -2350,9 +2342,9 @@ private: |
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_QUERYENDSESSION:
|
|
|
|
if (JUCEApplication::getInstance() != nullptr)
|
|
|
|
if (JUCEApplication* const app = JUCEApplication::getInstance())
|
|
|
|
{
|
|
|
|
JUCEApplication::getInstance()->systemRequestedQuit();
|
|
|
|
app->systemRequestedQuit();
|
|
|
|
return MessageManager::getInstance()->hasStopMessageBeenSent();
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
@@ -2468,9 +2460,7 @@ private: |
|
|
|
{
|
|
|
|
if (component.isCurrentlyBlockedByAnotherModalComponent())
|
|
|
|
{
|
|
|
|
Component* const current = Component::getCurrentlyModalComponent();
|
|
|
|
|
|
|
|
if (current != nullptr)
|
|
|
|
if (Component* const current = Component::getCurrentlyModalComponent())
|
|
|
|
current->inputAttemptWhenModal();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@@ -2494,8 +2484,7 @@ private: |
|
|
|
{
|
|
|
|
compositionInProgress = false;
|
|
|
|
|
|
|
|
HIMC hImc = ImmGetContext (hWnd);
|
|
|
|
if (hImc != 0)
|
|
|
|
if (HIMC hImc = ImmGetContext (hWnd))
|
|
|
|
{
|
|
|
|
ImmNotifyIME (hImc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
|
|
|
|
ImmReleaseContext (hWnd, hImc);
|
|
|
|
@@ -2506,9 +2495,8 @@ private: |
|
|
|
void handleStartComposition (ComponentPeer& owner)
|
|
|
|
{
|
|
|
|
reset();
|
|
|
|
TextInputTarget* const target = owner.findCurrentTextInputTarget();
|
|
|
|
|
|
|
|
if (target != nullptr)
|
|
|
|
if (TextInputTarget* const target = owner.findCurrentTextInputTarget())
|
|
|
|
target->insertTextAtCaret (String::empty);
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2517,9 +2505,7 @@ private: |
|
|
|
if (compositionInProgress)
|
|
|
|
{
|
|
|
|
// If this occurs, the user has cancelled the composition, so clear their changes..
|
|
|
|
TextInputTarget* const target = owner.findCurrentTextInputTarget();
|
|
|
|
|
|
|
|
if (target != nullptr)
|
|
|
|
if (TextInputTarget* const target = owner.findCurrentTextInputTarget())
|
|
|
|
{
|
|
|
|
target->setHighlightedRegion (compositionRange);
|
|
|
|
target->insertTextAtCaret (String::empty);
|
|
|
|
@@ -2529,9 +2515,7 @@ private: |
|
|
|
target->setTemporaryUnderlining (Array<Range<int> >());
|
|
|
|
}
|
|
|
|
|
|
|
|
HIMC hImc = ImmGetContext (hWnd);
|
|
|
|
|
|
|
|
if (hImc != 0)
|
|
|
|
if (HIMC hImc = ImmGetContext (hWnd))
|
|
|
|
{
|
|
|
|
ImmNotifyIME (hImc, NI_CLOSECANDIDATE, 0, 0);
|
|
|
|
ImmReleaseContext (hWnd, hImc);
|
|
|
|
@@ -2793,12 +2777,9 @@ bool Process::isForegroundProcess() |
|
|
|
fg = GetAncestor (fg, GA_ROOT);
|
|
|
|
|
|
|
|
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
|
|
|
|
{
|
|
|
|
HWNDComponentPeer* const wp = dynamic_cast <HWNDComponentPeer*> (ComponentPeer::getPeer (i));
|
|
|
|
|
|
|
|
if (wp != nullptr && wp->isInside (fg))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (HWNDComponentPeer* const wp = dynamic_cast <HWNDComponentPeer*> (ComponentPeer::getPeer (i)))
|
|
|
|
if (wp->isInside (fg))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
@@ -3015,13 +2996,9 @@ void SystemClipboard::copyTextToClipboard (const String& text) |
|
|
|
|
|
|
|
if (bytesNeeded > 0)
|
|
|
|
{
|
|
|
|
HGLOBAL bufH = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT, bytesNeeded + sizeof (WCHAR));
|
|
|
|
|
|
|
|
if (bufH != 0)
|
|
|
|
if (HGLOBAL bufH = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT, bytesNeeded + sizeof (WCHAR)))
|
|
|
|
{
|
|
|
|
WCHAR* const data = static_cast <WCHAR*> (GlobalLock (bufH));
|
|
|
|
|
|
|
|
if (data != nullptr)
|
|
|
|
if (WCHAR* const data = static_cast <WCHAR*> (GlobalLock (bufH)))
|
|
|
|
{
|
|
|
|
text.copyToUTF16 (data, (int) bytesNeeded);
|
|
|
|
GlobalUnlock (bufH);
|
|
|
|
@@ -3042,13 +3019,9 @@ String SystemClipboard::getTextFromClipboard() |
|
|
|
|
|
|
|
if (OpenClipboard (0) != 0)
|
|
|
|
{
|
|
|
|
HANDLE bufH = GetClipboardData (CF_UNICODETEXT);
|
|
|
|
|
|
|
|
if (bufH != 0)
|
|
|
|
if (HANDLE bufH = GetClipboardData (CF_UNICODETEXT))
|
|
|
|
{
|
|
|
|
const WCHAR* const data = (const WCHAR*) GlobalLock (bufH);
|
|
|
|
|
|
|
|
if (data != nullptr)
|
|
|
|
if (const WCHAR* const data = (const WCHAR*) GlobalLock (bufH))
|
|
|
|
{
|
|
|
|
result = String (data, (size_t) (GlobalSize (bufH) / sizeof (WCHAR)));
|
|
|
|
GlobalUnlock (bufH);
|
|
|
|
@@ -3074,9 +3047,7 @@ StringArray JUCE_CALLTYPE JUCEApplication::getCommandLineParameterArray() |
|
|
|
StringArray s;
|
|
|
|
|
|
|
|
int argc = 0;
|
|
|
|
LPWSTR* const argv = CommandLineToArgvW (GetCommandLineW(), &argc);
|
|
|
|
|
|
|
|
if (argv != nullptr)
|
|
|
|
if (LPWSTR* const argv = CommandLineToArgvW (GetCommandLineW(), &argc))
|
|
|
|
{
|
|
|
|
s = StringArray (argv + 1, argc - 1);
|
|
|
|
LocalFree (argv);
|
|
|
|
@@ -3148,9 +3119,7 @@ static HICON extractFileHICON (const File& file) |
|
|
|
Image juce_createIconForFile (const File& file)
|
|
|
|
{
|
|
|
|
Image image;
|
|
|
|
HICON icon = extractFileHICON (file);
|
|
|
|
|
|
|
|
if (icon != 0)
|
|
|
|
if (HICON icon = extractFileHICON (file))
|
|
|
|
{
|
|
|
|
image = IconConverters::createImageFromHICON (icon);
|
|
|
|
DestroyIcon (icon);
|
|
|
|
|