sc/source/ui/dbgui/sfiltdlg.cxx |   33 ++++++++++++++-------------------
 sc/source/ui/inc/filtdlg.hxx    |    7 ++-----
 2 files changed, 16 insertions(+), 24 deletions(-)

New commits:
commit 9bb32c6629b068c18d1f7df63a86d1cab66856eb
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Wed Apr 17 18:22:46 2019 +0200
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Thu Apr 18 13:52:40 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.
    
    Change-Id: Ib6c0267a064cb31438544e47fe3e0869b575ef7c
    Reviewed-on: https://gerrit.libreoffice.org/70917
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Tested-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index fe441db8bd16..2366af951e5e 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -57,8 +57,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, 
SfxChildWindow* pCW, vc
         pViewData       ( nullptr ),
         pDoc            ( nullptr ),
         pRefInputEdit   ( nullptr ),
-        bRefInputMode   ( false ),
-        pIdle          ( nullptr )
+        bRefInputMode   ( false )
 {
         get(pLbFilterArea,"lbfilterarea");
         get(pEdFilterArea,"edfilterarea");
@@ -83,14 +82,18 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, 
SfxChildWindow* pCW, vc
         get(pExpander,"more");
 
     Init( rArgSet );
-    pEdFilterArea->GrabFocus();
 
-    // hack: control of RefInput
-    pIdle = 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()
@@ -109,10 +112,6 @@ void ScSpecialFilterDlg::dispose()
 
     delete pOutItem;
 
-    // hack: control of RefInput
-    pIdle->Stop();
-    delete pIdle;
-
     pLbFilterArea.clear();
     pEdFilterArea.clear();
     pRbFilterArea.clear();
@@ -389,11 +388,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) && IsActive() )
+    if (IsActive())
     {
         if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
         {
@@ -411,8 +408,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 1505a0bec22f..829cb0b2c7fa 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -206,9 +206,6 @@ private:
     VclPtr<formula::RefEdit>   pRefInputEdit;
     bool                bRefInputMode;
 
-    // Hack: RefInput control
-    Idle*  pIdle;
-
 private:
     void            Init( const SfxItemSet& rArgSet );
     ScQueryItem*    GetOutputItem( const ScQueryParam& rParam,
@@ -219,8 +216,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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to