summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-01-22 02:03:13 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-01-22 04:06:00 +0100
commitd49b0c3654e50ff9b74545140e6f19e008009c33 (patch)
tree52aab9e8b9ca8c7845e7f8b6215d8c63cd11798b
parent638f9bd2c6413588d7bcf3aac1b56bff03d20bb0 (diff)
tdf#158139: show autotext / word completion tooltips also for delayed flush
The problem was that commit 843af72bcc9047867588e29c8e10b84a5e58d70e (make win32 variant AnyInput() not deliver events (tdf#140293), 2021-02-11) made AnyInput ~always return true, when called in SwEditWin::KeyInput. Calling AnyInput(KEYBOARD) there is to query if there are more pending characters. But in its new form on Windows, it tells if there are any keyboard-related window events in the queue, where e.g. WM_KEYUP counts, which is for the same keypress (WM_KEYDOWN) that is being handled right now - even though those messages will not produce new characters. When AnyInput() returns true, a delayed flush timer starts. Only immediate flush was accompanied by tooltips. To make sure that the tooltip is shown also for delayed flush, move the tooltip code into SwEditWin::FlushInBuffer. Store the 'bNormalChar' flag (which controlled if the tooltip was shown) in a new member in SwEditWin. Change-Id: I51686b25f8d86df48ae9574ab8f3eb1d0e6ca985 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162350 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx35
-rw-r--r--sw/source/uibase/inc/edtwin.hxx3
2 files changed, 26 insertions, 12 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index e36699b74def..dc5914bfa791 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -896,6 +896,25 @@ void SwEditWin::FlushInBuffer()
return;
SwWrtShell& rSh = m_rView.GetWrtShell();
+ uno::Reference<frame::XDispatchRecorder> xRecorder
+ = m_rView.GetViewFrame().GetBindings().GetRecorder();
+
+ comphelper::ScopeGuard showTooltipGuard(
+ [this, &rSh]
+ {
+ SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
+ const bool bAutoTextShown
+ = rACfg.IsAutoTextTip() && ShowAutoText(rSh.GetChunkForAutoText());
+ if (!bAutoTextShown)
+ {
+ SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
+ if (pACorr && pACorr->GetSwFlags().bAutoCompleteWords)
+ ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr);
+ }
+ });
+ if (!m_bMaybeShowTooltipAfterBufferFlush || xRecorder)
+ showTooltipGuard.dismiss();
+ m_bMaybeShowTooltipAfterBufferFlush = false;
// generate new sequence input checker if not already done
if ( !pCheckIt )
@@ -993,8 +1012,6 @@ void SwEditWin::FlushInBuffer()
}
}
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- m_rView.GetViewFrame().GetBindings().GetRecorder();
if ( xRecorder.is() )
{
// determine shell
@@ -1381,6 +1398,9 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
}
}
+ // Do not show autotext / word completion tooltips in intermediate flushes
+ m_bMaybeShowTooltipAfterBufferFlush = false;
+
sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
if (nKey == KEY_ESCAPE)
@@ -2821,19 +2841,12 @@ KEYINPUT_CHECKTABLE_INSDEL:
if( KEY_UP == nKey || KEY_DOWN == nKey || KEY_PAGEUP == nKey || KEY_PAGEDOWN == nKey )
GetView().GetViewFrame().GetBindings().Update( FN_STAT_PAGE );
+ m_bMaybeShowTooltipAfterBufferFlush = bNormalChar;
+
// in case the buffered characters are inserted
if( bFlushBuffer && !m_aInBuffer.isEmpty() )
{
FlushInBuffer();
-
- // maybe show Tip-Help
- if (bNormalChar)
- {
- const bool bAutoTextShown
- = pACfg && pACfg->IsAutoTextTip() && ShowAutoText(rSh.GetChunkForAutoText());
- if (!bAutoTextShown && pACorr && pACorr->GetSwFlags().bAutoCompleteWords)
- ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), *pACorr);
- }
}
// get the word count dialog to update itself
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index 8978762ac3d3..3c180718c033 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -124,7 +124,8 @@ class SW_DLLPUBLIC SwEditWin final : public vcl::DocWindow,
selection position depending on what has changed lately
*/
m_bUseInputLanguage: 1,
- m_bObjectSelect : 1;
+ m_bObjectSelect : 1,
+ m_bMaybeShowTooltipAfterBufferFlush : 1 = false;
sal_uInt16 m_nKS_NUMDOWN_Count; // #i23725#
sal_uInt16 m_nKS_NUMINDENTINC_Count;