svx/source/inc/findtextfield.hxx | 1 + svx/source/tbxctrls/tbunosearchcontrollers.cxx | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
New commits: commit 08beeee8908468d81713213be4271b64e1cb6981 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 9 15:14:12 2020 +0000 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Nov 9 18:07:38 2020 +0100 tdf#137993 ensure the toplevel vcl::Window is activated when the search entry gains focus so that SfxViewFrame::Current is valid Change-Id: Ibb21db12688a7d44758cf607da618035c22a062a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105485 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx index 1ac5519a2dcd..3e5de483c91a 100644 --- a/svx/source/inc/findtextfield.hxx +++ b/svx/source/inc/findtextfield.hxx @@ -63,6 +63,7 @@ private: DECL_LINK(ActivateHdl, weld::ComboBox&, bool); DECL_LINK(OnAsyncGetFocus, void*, void); + void FocusIn(); void ActivateFind(bool bShift); }; diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index f7c0d2a9fc7b..716e7cb9e227 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -340,12 +340,20 @@ IMPL_LINK_NOARG(FindTextFieldControl, OnAsyncGetFocus, void*, void) m_xWidget->select_entry_region(0, -1); } -IMPL_LINK_NOARG(FindTextFieldControl, FocusInHdl, weld::Widget&, void) +void FindTextFieldControl::FocusIn() { - if (m_nAsyncGetFocusId) + if (m_nAsyncGetFocusId || !m_xWidget) return; + // do it async to defeat entry in combobox having its own ideas about the focus m_nAsyncGetFocusId = Application::PostUserEvent(LINK(this, FindTextFieldControl, OnAsyncGetFocus)); + + GrabFocus(); // tdf#137993 ensure the toplevel vcl::Window is activated so SfxViewFrame::Current is valid +} + +IMPL_LINK_NOARG(FindTextFieldControl, FocusInHdl, weld::Widget&, void) +{ + FocusIn(); } void FindTextFieldControl::dispose() @@ -400,6 +408,7 @@ void FindTextFieldControl::GetFocus() if (m_xWidget) m_xWidget->grab_focus(); InterimItemWindow::GetFocus(); + FocusIn(); } namespace { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits