diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp index 761288dc71..7d395e34a0 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.cpp @@ -316,7 +316,6 @@ private: std::optional compositionTree; RectangleList deferredRepaints; std::vector dirtyRectangles; - bool resizing = false; int64 lastFinishFrameTicks = 0; HWND hwnd = nullptr; @@ -377,7 +376,7 @@ private: RectangleList getPaintAreas() const override { // Does the entire buffer need to be filled? - if (swap.state == SwapChain::State::bufferAllocated || resizing) + if (swap.state == SwapChain::State::bufferAllocated) return swap.getSize(); return deferredRepaints; @@ -451,20 +450,10 @@ public: return {}; } - void setResizing (bool x) - { - resizing = x; - } - - bool getResizing() const - { - return resizing; - } - - void setSize (Rectangle size) + bool setSize (Rectangle size) { if (size == swap.getSize() || size.isEmpty()) - return; + return false; // Require the entire window to be repainted deferredRepaints = size; @@ -485,6 +474,8 @@ public: if (swapChainThread) swapChainThread->notify(); } + + return true; } void addDeferredRepaint (Rectangle deferredRepaint) @@ -496,12 +487,7 @@ public: SavedState* startFrame (float dpiScale) override { - if (resizing) - { - const auto size = getClientRect(); - setSize (size); - deferredRepaints = size; - } + setSize (getClientRect()); auto* savedState = Pimpl::startFrame (dpiScale); @@ -665,7 +651,6 @@ Direct2DHwndContext::Direct2DHwndContext (HWND windowHandle) #endif pimpl = std::make_unique (*this, windowHandle); - updateSize(); } Direct2DHwndContext::~Direct2DHwndContext() @@ -685,26 +670,6 @@ void Direct2DHwndContext::handleShowWindow() pimpl->handleShowWindow(); } -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 }); -} - -void Direct2DHwndContext::updateSize() -{ - pimpl->setSize (pimpl->getClientRect()); -} - void Direct2DHwndContext::addDeferredRepaint (Rectangle deferredRepaint) { pimpl->addDeferredRepaint (deferredRepaint); diff --git a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h index 760e8ba2be..70ac6196a5 100644 --- a/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h +++ b/modules/juce_graphics/native/juce_Direct2DHwndContext_windows.h @@ -43,11 +43,6 @@ public: void handleShowWindow(); - void setResizing (bool); - bool getResizing() const; - void setSize (int width, int height); - void updateSize(); - void addDeferredRepaint (Rectangle deferredRepaint); Image createSnapshot() const override; diff --git a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp index 1b512343f6..e0d8833a7e 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_windows.cpp +++ b/modules/juce_gui_basics/native/juce_Windowing_windows.cpp @@ -1410,10 +1410,7 @@ struct RenderContext virtual void dispatchDeferredRepaints() = 0; virtual void performAnyPendingRepaintsNow() = 0; virtual void onVBlank() = 0; - virtual void setResizing (bool) = 0; - virtual bool getResizing() const = 0; virtual void handleShowWindow() = 0; - virtual void setSize (int, int) = 0; /* Gets a snapshot of whatever the render context is currently showing. */ virtual Image createSnapshot() = 0; @@ -1552,16 +1549,6 @@ public: info.rcWindow.right - info.rcClient.right }; } - void updateBorderSize() - { - if (renderContext == nullptr) - return; - - RECT r; - GetClientRect (hwnd, &r); - renderContext->setSize (r.right - r.left, r.bottom - r.top); - } - void setBounds (const Rectangle& bounds, bool isNowFullScreen) override { // If we try to set new bounds while handling an existing position change, @@ -1574,13 +1561,6 @@ public: if (isNowFullScreen != isFullScreen()) setFullScreen (isNowFullScreen); - // 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); const auto borderSize = findPhysicalBorderSize(); @@ -1633,7 +1613,6 @@ public: if (hasResized && isValidPeer (this)) { - updateBorderSize(); repaintNowIfTransparent(); } } @@ -1758,8 +1737,6 @@ public: if (constrainer != nullptr) constrainer->resizeEnd(); } - - updateBorderSize(); } bool isFullScreen() const override @@ -2498,7 +2475,6 @@ private: scaleFactor = getScaleFactorForWindow (hwnd); setMessageFilter(); - updateBorderSize(); checkForPointerAPI(); // This is needed so that our plugin window gets notified of WM_SETTINGCHANGE messages @@ -2861,9 +2837,6 @@ private: constrainerIsResizing = false; } - if (renderContext != nullptr && renderContext->getResizing()) - renderContext->setResizing (false); - if (isDragging) doMouseUp (getCurrentMousePos(), (WPARAM) 0, false); } @@ -3393,8 +3366,6 @@ private: r = D2DUtilities::toRECT (modifiedPhysicalBounds); } - updateBorderSize(); - return TRUE; } @@ -3529,7 +3500,6 @@ private: return true; } - updateBorderSize(); handleMovedOrResized(); updateCurrentMonitorAndRefreshVBlankDispatcher(); @@ -4026,17 +3996,8 @@ private: break; - case WM_EXITSIZEMOVE: - if (renderContext != nullptr) - renderContext->setResizing (false); - - break; - //============================================================================== case WM_SIZING: - if (renderContext != nullptr) - renderContext->setResizing (true); - return handleSizeConstraining (*(RECT*) lParam, wParam); case WM_MOVING: @@ -4831,11 +4792,8 @@ public: : createSnapshotOfNormalWindow(); } - void setSize (int, int) override {} void onVBlank() override {} - void setResizing (bool x) override { resizing = x; } - bool getResizing() const override { return resizing; } void handleShowWindow() override {} private: @@ -5074,7 +5032,6 @@ private: HWNDComponentPeer& peer; TemporaryImage offscreenImageGenerator; RectangleList deferredRepaints; - bool resizing = false; }; class D2DRenderContext : public RenderContext @@ -5138,24 +5095,6 @@ public: handleDirect2DPaint(); } - void setResizing (bool x) override - { - direct2DContext->setResizing (x); - } - - bool getResizing() const override - { - return direct2DContext->getResizing(); - } - - void setSize (int w, int h) override - { - JUCE_TRACE_LOG_D2D_RESIZE (WM_NCCALCSIZE); - - if (peer.getComponent().isVisible()) - direct2DContext->setSize (w, h); - } - void handleShowWindow() override { direct2DContext->handleShowWindow(); @@ -5168,9 +5107,6 @@ private: virtual ~WrappedD2DHwndContextBase() = default; virtual void addDeferredRepaint (Rectangle area) = 0; virtual Image createSnapshot() const = 0; - virtual void setResizing (bool x) = 0; - virtual bool getResizing() const = 0; - virtual void setSize (int w, int h) = 0; virtual void handleShowWindow() = 0; virtual LowLevelGraphicsContext* startFrame (float dpiScale) = 0; virtual void endFrame() = 0; @@ -5208,21 +5144,6 @@ private: return ctx.createSnapshot(); } - void setResizing (bool x) override - { - ctx.setResizing (x); - } - - bool getResizing() const override - { - return ctx.getResizing(); - } - - void setSize (int w, int h) override - { - ctx.setSize (w, h); - } - void handleShowWindow() override { ctx.handleShowWindow(); @@ -5395,10 +5316,6 @@ private: return renderer.getImage(); } - void setResizing (bool x) override { resizing = x; } - bool getResizing() const override { return resizing; } - - void setSize (int, int) override {} void handleShowWindow() override {} LowLevelGraphicsContext* startFrame (float scale) override @@ -5490,7 +5407,6 @@ private: DxgiBitmapRenderer bitmapRenderer; RectangleList deferredRepaints; - bool resizing = false; }; void handleDirect2DPaint()