[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/jsdialog vcl/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 22 12:04:39 UTC 2020


 include/vcl/window.hxx               |    3 +++
 vcl/inc/jsdialog/jsdialogbuilder.hxx |    1 +
 vcl/inc/window.h                     |    2 ++
 vcl/jsdialog/jsdialogbuilder.cxx     |    6 ++++++
 vcl/source/window/window.cxx         |   14 +++++++++++++-
 5 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 71ec214d7583f637fefcb5eca13c637cc6b38029
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Dec 17 10:45:13 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Dec 22 13:03:59 2020 +0100

    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 at collabora.com>

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();


More information about the Libreoffice-commits mailing list