[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 16 14:16:59 UTC 2019


 sc/source/ui/dbgui/sfiltdlg.cxx |   31 +++++++++++++------------------
 sc/source/ui/inc/filtdlg.hxx    |    7 ++-----
 2 files changed, 15 insertions(+), 23 deletions(-)

New commits:
commit 329baa7a796d9d7c16af8b10fc168820f10459ad
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Apr 17 18:22:46 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Sep 16 16:16:21 2019 +0200

    sc: Get rid of the Idle hack in the Special Filter Dialog.
    
    The problem is that with LOK, the creation of Idle here causes a
    deadlock when the dialog is being opened and its first paint is
    requested.
    
    No real idea what change now causes the problem (this used to work), but
    given that the use of the Idle is a hack in the first place, let's use
    the GetFocus/LoseFocus handlers instead, and act accordingly only when
    the focus of the interesting controls changes.
    
    Reviewed-on: https://gerrit.libreoffice.org/70917
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 9bb32c6629b068c18d1f7df63a86d1cab66856eb)
    
    Change-Id: Ib6c0267a064cb31438544e47fe3e0869b575ef7c
    Reviewed-on: https://gerrit.libreoffice.org/78785
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index 33010a009833..fa5266b8b89e 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <sfx2/dispatch.hxx>
-#include <vcl/idle.hxx>
 
 #include <uiitems.hxx>
 #include <rangenam.hxx>
@@ -89,14 +88,18 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc
         get(pExpander,"more");
 
     Init( rArgSet );
-    pEdFilterArea->GrabFocus();
 
-    // hack: control of RefInput
-    pIdle.reset( new Idle("Special Filter Dialog") );
-    // FIXME: this is an abomination
-    pIdle->SetPriority( TaskPriority::LOWEST );
-    pIdle->SetInvokeHandler( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) );
-    pIdle->Start();
+    Link<Control&, void> aLink = LINK(this, ScSpecialFilterDlg, RefInputControlHdl);
+    pEdCopyArea->SetGetFocusHdl(aLink);
+    pRbCopyArea->SetGetFocusHdl(aLink);
+    pEdFilterArea->SetGetFocusHdl(aLink);
+    pRbFilterArea->SetGetFocusHdl(aLink);
+    pEdCopyArea->SetLoseFocusHdl(aLink);
+    pRbCopyArea->SetLoseFocusHdl(aLink);
+    pEdFilterArea->SetLoseFocusHdl(aLink);
+    pRbFilterArea->SetLoseFocusHdl(aLink);
+
+    pEdFilterArea->GrabFocus();
 }
 
 ScSpecialFilterDlg::~ScSpecialFilterDlg()
@@ -115,10 +118,6 @@ void ScSpecialFilterDlg::dispose()
 
     pOutItem.reset();
 
-    // hack: control of RefInput
-    pIdle->Stop();
-    pIdle.reset();
-
     pLbFilterArea.clear();
     pEdFilterArea.clear();
     pRbFilterArea.clear();
@@ -393,11 +392,9 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void )
     }
 }
 
-IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
+IMPL_LINK_NOARG(ScSpecialFilterDlg, RefInputControlHdl, Control&, void)
 {
-    // every 50ms check whether RefInputMode is still true
-
-    if( (_pIdle == pIdle.get()) && IsActive() )
+    if (IsActive())
     {
         if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
         {
@@ -415,8 +412,6 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
             bRefInputMode = false;
         }
     }
-
-    pIdle->Start();
 }
 
 IMPL_LINK( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox&, rLb, void )
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 5a2ab1542c34..c82dcfa3fba1 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -204,9 +204,6 @@ private:
     VclPtr<formula::RefEdit>   pRefInputEdit;
     bool                bRefInputMode;
 
-    // Hack: RefInput control
-    std::unique_ptr<Idle> pIdle;
-
 private:
     void            Init( const SfxItemSet& rArgSet );
     ScQueryItem*    GetOutputItem( const ScQueryParam& rParam,
@@ -217,8 +214,8 @@ private:
     DECL_LINK( FilterAreaModHdl, Edit&, void );
     DECL_LINK( EndDlgHdl,  Button*, void );
 
-    // Hack: RefInput control
-    DECL_LINK( TimeOutHdl, Timer*, void );
+    // RefInput control
+    DECL_LINK( RefInputControlHdl, Control&, void );
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX


More information about the Libreoffice-commits mailing list