[Libreoffice-commits] core.git: sc/source
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 19 09:24:03 UTC 2019
sc/source/ui/dbgui/sfiltdlg.cxx | 40 ++++++++++++++++++++++++----------------
sc/source/ui/inc/filtdlg.hxx | 9 ++++-----
2 files changed, 28 insertions(+), 21 deletions(-)
New commits:
commit c618b8eae79b8d87ad5002466ef59c5694d4cea0
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Apr 17 18:22:46 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Apr 19 11:23:08 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/70948
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index a32e776b6140..6bfed89324e5 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -89,14 +89,19 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, we
m_xRbCopyArea->SetReferences(this, m_xEdCopyArea.get());
Init( rArgSet );
- m_xEdFilterArea->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<formula::WeldRefEdit&, void> aLinkEdit = LINK(this, ScSpecialFilterDlg, RefInputEditHdl);
+ Link<formula::WeldRefButton&, void> aLinkButton = LINK(this, ScSpecialFilterDlg, RefInputButtonHdl);
+ m_xEdCopyArea->SetGetFocusHdl(aLinkEdit);
+ m_xRbCopyArea->SetGetFocusHdl(aLinkButton);
+ m_xEdFilterArea->SetGetFocusHdl(aLinkEdit);
+ m_xRbFilterArea->SetGetFocusHdl(aLinkButton);
+ m_xEdCopyArea->SetLoseFocusHdl(aLinkEdit);
+ m_xRbCopyArea->SetLoseFocusHdl(aLinkButton);
+ m_xEdFilterArea->SetLoseFocusHdl(aLinkEdit);
+ m_xRbFilterArea->SetLoseFocusHdl(aLinkButton);
+
+ m_xEdFilterArea->GrabFocus();
}
ScSpecialFilterDlg::~ScSpecialFilterDlg()
@@ -104,10 +109,6 @@ ScSpecialFilterDlg::~ScSpecialFilterDlg()
pOptionsMgr.reset();
pOutItem.reset();
-
- // hack: control of RefInput
- pIdle->Stop();
- pIdle.reset();
}
void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
@@ -358,10 +359,19 @@ IMPL_LINK(ScSpecialFilterDlg, EndDlgHdl, weld::Button&, rBtn, void)
}
}
-IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
+IMPL_LINK_NOARG(ScSpecialFilterDlg, RefInputEditHdl, formula::WeldRefEdit&, void)
{
- // every 50ms check whether RefInputMode is still true
- if (_pIdle == pIdle.get() && m_xDialog->has_toplevel_focus())
+ RefInputHdl();
+}
+
+IMPL_LINK_NOARG(ScSpecialFilterDlg, RefInputButtonHdl, formula::WeldRefButton&, void)
+{
+ RefInputHdl();
+}
+
+void ScSpecialFilterDlg::RefInputHdl()
+{
+ if (m_xDialog->has_toplevel_focus())
{
if( m_xEdCopyArea->GetWidget()->has_focus() || m_xRbCopyArea->GetWidget()->has_focus() )
{
@@ -379,8 +389,6 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
bRefInputMode = false;
}
}
-
- pIdle->Start();
}
IMPL_LINK(ScSpecialFilterDlg, FilterAreaSelHdl, weld::ComboBox&, rLb, void)
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index a33d0b91f823..a84a5289ab70 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -184,9 +184,6 @@ private:
bool bRefInputMode;
- // Hack: RefInput control
- std::unique_ptr<Idle> pIdle;
-
formula::WeldRefEdit* m_pRefInputEdit;
std::unique_ptr<weld::ComboBox> m_xLbFilterArea;
@@ -222,8 +219,10 @@ private:
DECL_LINK( FilterAreaModHdl, formula::WeldRefEdit&, void );
DECL_LINK( EndDlgHdl, weld::Button&, void );
- // Hack: RefInput control
- DECL_LINK( TimeOutHdl, Timer*, void );
+ // RefInput control
+ DECL_LINK( RefInputEditHdl, formula::WeldRefEdit&, void );
+ DECL_LINK( RefInputButtonHdl, formula::WeldRefButton&, void );
+ void RefInputHdl();
};
#endif // INCLUDED_SC_SOURCE_UI_INC_FILTDLG_HXX
More information about the Libreoffice-commits
mailing list