diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp index a1276a4649..f195842caf 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp @@ -406,6 +406,11 @@ public: resizing = x; } + bool getResizing() const + { + return resizing; + } + void setSize (Rectangle size) { if (size == frameSize || size.isEmpty()) @@ -692,6 +697,11 @@ void Direct2DHwndContext::setResizing (bool x) pimpl->setResizing (x); } +bool Direct2DHwndContext::getResizing() const +{ + return pimpl->getResizing(); +} + void Direct2DHwndContext::setSize (int width, int height) { pimpl->setSize ({ width, height }); diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h index 6088378114..6b21d74a40 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h @@ -46,6 +46,7 @@ public: void setWindowAlpha (float alpha); void setResizing (bool); + bool getResizing() const; void setSize (int width, int height); void updateSize(); diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index 04fb177f9c..77d59816f5 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -1457,6 +1457,7 @@ struct RenderContext virtual void performAnyPendingRepaintsNow() = 0; virtual void onVBlank() = 0; virtual void setResizing (bool) = 0; + virtual bool getResizing() const = 0; virtual void handleNcCalcSize (WPARAM wParam, LPARAM lParam) = 0; virtual void handleShowWindow() = 0; @@ -1641,6 +1642,13 @@ public: if (inHandlePositionChanged) return; + // This is more of a guess than a certainty, but if we've captured the mouse and we're also + // updating the bounds, there's a good chance we're in a client-initiated resize. + // The resizing flag will be unset by WM_CAPTURECHANGED. + if (GetCapture() == hwnd) + if (renderContext != nullptr) + renderContext->setResizing (true); + const ScopedValueSetter scope (shouldIgnoreModalDismiss, true); fullScreen = isNowFullScreen; @@ -2811,6 +2819,9 @@ private: constrainerIsResizing = false; } + if (renderContext != nullptr && renderContext->getResizing()) + renderContext->setResizing (false); + if (isDragging) doMouseUp (getCurrentMousePos(), (WPARAM) 0); } @@ -4609,7 +4620,8 @@ public: void onVBlank() override {} - void setResizing (bool) override {} + void setResizing (bool x) override { resizing = x; } + bool getResizing() const override { return resizing; } void handleNcCalcSize (WPARAM, LPARAM) override {} void handleShowWindow() override {} @@ -4780,6 +4792,7 @@ private: TemporaryImage offscreenImageGenerator; RectangleList deferredRepaints; uint8 layeredWindowAlpha = 255; + bool resizing = false; }; class D2DContext : public RenderContext @@ -4870,6 +4883,11 @@ public: direct2DContext->setResizing (x); } + bool getResizing() const override + { + return direct2DContext->getResizing(); + } + void handleNcCalcSize (WPARAM, LPARAM lParam) override { JUCE_TRACE_LOG_D2D_RESIZE (WM_NCCALCSIZE);