summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-12-17 10:45:13 -0400
committerHenry Castro <hcastro@collabora.com>2020-12-22 13:03:59 +0100
commit71ec214d7583f637fefcb5eca13c637cc6b38029 (patch)
treedd3a089e9eba938e5122511e0ff435ed900167e1
parente0e2e01c042346d15a543b6449336aae46e92507 (diff)
jsdialog: disable idle notify
After testing on client side, when showing the Macro Selector Dialog its receive 5 times the same data. So add an option to not use the idle notifier instead it will use the event 'WindowShow'. Change-Id: Ib5657f3c823fc6e998581b99052aaf578d0913e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107893 Tested-by: Jenkins Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--include/vcl/window.hxx3
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx1
-rw-r--r--vcl/inc/window.h2
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx6
-rw-r--r--vcl/source/window/window.cxx14
5 files changed, 25 insertions, 1 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index d4e96f93a45e..99a1043bb3d3 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1176,6 +1176,9 @@ public:
/// Find an existing Window based on the LOKWindowId.
static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
+ bool IsDisableIdleNotify();
+ void SetDisableIdleNotify(bool bValue);
+
/// check if LOK Window container is empty
static bool IsLOKWindowsEmpty();
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index d3c6e7b26d48..14090f43a0e4 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -49,6 +49,7 @@ public:
void Invoke() override;
void ForceUpdate();
void sendClose();
+ VclPtr<vcl::Window> getNotifierWindow() { return m_aNotifierWindow; }
private:
void send(std::unique_ptr<tools::JsonWriter> aJsonWriter);
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index a14852ca02c0..a6d46c41eeda 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -117,6 +117,8 @@ struct ImplWinData
sal_uInt16 mnIsTopWindow;
bool mbMouseOver; //< tracks mouse over for native widget paint effect
bool mbEnableNativeWidget; //< toggle native widget rendering
+ bool mbDisableIdleNotify;
+
::std::list< VclPtr<vcl::Window> >
maTopWindowChildren;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 795acc644274..11a84bc8bc64 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -107,6 +107,9 @@ void JSDialogNotifyIdle::sendClose() { send(generateCloseMessage()); }
void JSDialogSender::notifyDialogState(bool bForce)
{
+ if (mpIdleNotify->getNotifierWindow()->IsDisableIdleNotify())
+ return;
+
if (bForce)
mpIdleNotify->ForceUpdate();
mpIdleNotify->Start();
@@ -404,6 +407,9 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
RememberWidget("__DIALOG__", pRet.get());
+ if (id == "MacroSelectorDialog")
+ pDialog->SetDisableIdleNotify(true);
+
const vcl::ILibreOfficeKitNotifier* pNotifier = pDialog->GetLOKNotifier();
if (pNotifier && id != "MacroSelectorDialog")
{
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7bbc9924709d..719a5268c2f2 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -755,7 +755,8 @@ ImplWinData::ImplWinData() :
mnTrackFlags(ShowTrackFlags::NONE),
mnIsTopWindow(sal_uInt16(~0)), // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mbMouseOver(false),
- mbEnableNativeWidget(false)
+ mbEnableNativeWidget(false),
+ mbDisableIdleNotify(false)
{
}
@@ -3201,6 +3202,17 @@ VclPtr<Window> Window::FindLOKWindow(vcl::LOKWindowId nWindowId)
return VclPtr<Window>();
}
+bool Window::IsDisableIdleNotify()
+{
+ return ImplGetWinData()->mbDisableIdleNotify;
+}
+
+void Window::SetDisableIdleNotify(bool bValue)
+{
+ if (ImplGetWinData()->mbDisableIdleNotify != bValue)
+ ImplGetWinData()->mbDisableIdleNotify = bValue;
+}
+
bool Window::IsLOKWindowsEmpty()
{
return GetLOKWindowsMap().empty();