1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Direct2D: Avoid continuous repainting when moving but not resizing windows

This commit is contained in:
reuk 2024-05-13 14:45:03 +01:00
parent be98c7eaea
commit 2ca5fdf18d
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
3 changed files with 16 additions and 35 deletions

View file

@ -401,14 +401,9 @@ public:
return {};
}
void startResizing()
void setResizing (bool x)
{
resizing = true;
}
void finishResizing()
{
resizing = false;
resizing = x;
}
void setSize (Rectangle<int> size)
@ -692,14 +687,9 @@ void Direct2DHwndContext::setWindowAlpha (float alpha)
pimpl->setTargetAlpha (alpha);
}
void Direct2DHwndContext::startResizing()
void Direct2DHwndContext::setResizing (bool x)
{
pimpl->startResizing();
}
void Direct2DHwndContext::finishResizing()
{
pimpl->finishResizing();
pimpl->setResizing (x);
}
void Direct2DHwndContext::setSize (int width, int height)

View file

@ -45,8 +45,7 @@ public:
void handleShowWindow();
void setWindowAlpha (float alpha);
void startResizing();
void finishResizing();
void setResizing (bool);
void setSize (int width, int height);
void updateSize();

View file

@ -1456,8 +1456,7 @@ struct RenderContext
virtual void dispatchDeferredRepaints() = 0;
virtual void performAnyPendingRepaintsNow() = 0;
virtual void onVBlank() = 0;
virtual void beginResize() = 0;
virtual void endResize() = 0;
virtual void setResizing (bool) = 0;
virtual void handleNcCalcSize (WPARAM wParam, LPARAM lParam) = 0;
virtual void handleShowWindow() = 0;
virtual std::optional<LRESULT> getNcHitTestResult() = 0;
@ -3676,20 +3675,19 @@ private:
break;
case WM_ENTERSIZEMOVE:
if (renderContext != nullptr)
renderContext->beginResize();
break;
case WM_EXITSIZEMOVE:
if (renderContext != nullptr)
renderContext->endResize();
renderContext->setResizing (false);
break;
//==============================================================================
case WM_SIZING: return handleSizeConstraining (*(RECT*) lParam, wParam);
case WM_SIZING:
if (renderContext != nullptr)
renderContext->setResizing (true);
return handleSizeConstraining (*(RECT*) lParam, wParam);
case WM_WINDOWPOSCHANGING: return handlePositionChanging (*(WINDOWPOS*) lParam);
case 0x2e0: /* WM_DPICHANGED */ return handleDPIChanging ((int) HIWORD (wParam), *(RECT*) lParam);
@ -4469,8 +4467,7 @@ public:
return {};
}
void beginResize() override {}
void endResize() override {}
void setResizing (bool) override {}
void handleNcCalcSize (WPARAM, LPARAM) override {}
void handleShowWindow() override {}
@ -4728,14 +4725,9 @@ public:
std::optional<LRESULT> getNcHitTestResult() override { return {}; }
void beginResize() override
void setResizing (bool x) override
{
direct2DContext->startResizing();
}
void endResize() override
{
direct2DContext->finishResizing();
direct2DContext->setResizing (x);
}
void handleNcCalcSize (WPARAM, LPARAM lParam) override