From c90792cf4309557981d1f89febeff9157fd93b0c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 30 Apr 2021 12:29:45 +0100 Subject: Related: tdf#138281 move grab_focus to ActivateFind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and remove the explicit KeyInput callback handling of "KEY_RETURN" in favor of the ActivateHdl callback which Entry emits from its built-in KeyInput handler Change-Id: Ie6ddc8d73345400586418f2495958b14ab61c7d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114907 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'svx/source') diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index c75c3edb03ef..c247e313452a 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -298,11 +298,10 @@ IMPL_LINK(FindTextFieldControl, KeyInputHdl, const KeyEvent&, rKeyEvent, bool) else if ( bMod1 && nCode == KEY_F ) m_xWidget->select_entry_region(0, -1); - // Execute the search when Return, Ctrl-G or F3 pressed - else if ( KEY_RETURN == nCode || (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) ) + // Execute the search when Ctrl-G or F3 pressed (in addition to ActivateHdl conditions) + else if ( (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) ) { ActivateFind(bShift); - m_xWidget->grab_focus(); bRet = true; } else @@ -324,8 +323,11 @@ void FindTextFieldControl::ActivateFind(bool bShift) ToolBox* pToolBox = static_cast(pWindow); impl_executeSearch(m_xContext, m_xFrame, pToolBox, bShift); + + m_xWidget->grab_focus(); } +// Execute the search when activated, typically due to "Return" IMPL_LINK_NOARG(FindTextFieldControl, ActivateHdl, weld::ComboBox&, bool) { if (isDisposed()) -- cgit v1.2.3