summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-01-10 12:42:30 +0000
committerJan Holesovsky <kendy@collabora.com>2020-01-14 15:29:29 +0100
commit1ba5340970ccccb56e271f9e72935c9d7d2c54eb (patch)
treef20b810e8bc2c497dd7a79868df4b0f389a0344b
parent968f07ab7b47fe4f2724b4f7c9f037a0f4b376f3 (diff)
lok: avoid emission storms of un-necessary invalidations.
Common when constructing widgets with VclBuilder - which avoids the 'Show' detection Pranav introduced in 8de98e61fbc. This saves ~80% of the ~100k mostly bogus calls I get to: desktop::CallbackFlushHandler::processWindowEvent when opening and closing a few windows. Change-Id: Ie508d6e19274472b85543275aee33f078ddcbbb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86537 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--vcl/source/window/paint.cxx6
-rw-r--r--vcl/source/window/window2.cxx5
2 files changed, 8 insertions, 3 deletions
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 6fd447cbce70..7d031fcc1b2a 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1218,6 +1218,10 @@ void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive())
return;
+ Size aSize = GetSizePixel();
+ if (aSize.getWidth() <= 0 || aSize.getHeight() <= 0)
+ return;
+
if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
{
// In case we are routing the window, notify the client
@@ -1226,7 +1230,7 @@ void Window::LogicInvalidate(const tools::Rectangle* pRectangle)
aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString()));
else
{
- const tools::Rectangle aRect(Point(0, 0), GetSizePixel());
+ const tools::Rectangle aRect(Point(0, 0), aSize);
aPayload.push_back(std::make_pair(OString("rectangle"), aRect.toString()));
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 214226a9ae4f..7729f42db6b7 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1406,10 +1406,11 @@ void Window::queue_resize(StateChangedType eReason)
if (pBorderWindow)
pBorderWindow->Resize();
}
-
if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
- if (!pParent->IsInInitShow())
+ Size aSize = GetSizePixel();
+ if (aSize.getWidth() > 0 && aSize.getHeight() > 0 &&
+ !pParent->IsInInitShow())
LogicInvalidate(nullptr);
}
}