sw/inc/crsrsh.hxx | 1 + sw/source/core/crsr/crsrsh.cxx | 7 +++++++ sw/source/core/crsr/viscrs.cxx | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-)
New commits: commit 6a2071cafae41afdfde56b07817d8674482431f6 Author: Gülşah Köse <gulsah.k...@collabora.com> AuthorDate: Fri Sep 20 15:02:51 2024 +0300 Commit: Gülşah Köse <gulsah.k...@collabora.com> CommitDate: Mon Sep 30 14:10:10 2024 +0200 Prevent cursor invalidation if the cursor position doesn't change. Signed-off-by: Gülşah Köse <gulsah.k...@collabora.com> Change-Id: Ib8f0a28ff526f161e2f63b0746d72a676cea417f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173726 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 97248572c762..5cf244aa6b4e 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -237,6 +237,7 @@ private: bool m_bBasicHideCursor : 1; // true -> HideCursor from Basic bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in ReadOnly-Areas bool m_bOverwriteCursor : 1; // true -> show Overwrite Cursor + bool m_bIsCursorPosChanged : 1; // true -> if the cursor position is changed last cursor update // true -> send accessible events when cursor changes // (set to false when using internal-only helper cursor) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 20e32e66c255..c8462c71a7cc 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1921,6 +1921,7 @@ class SwNotifyAccAboutInvalidTextSelections void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { + Point nOldPos = m_pCurrentCursor->GetPtPos(); CurrShell aCurr( this ); ClearUpCursors(); @@ -2415,6 +2416,10 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) GetOut()->SetSettings( aSettings ); } + // Do not notify the cursor if the position didn't change + Point nNewPos = m_pCurrentCursor->GetPtPos(); + m_bIsCursorPosChanged = nOldPos != nNewPos; + if( m_bSVCursorVis ) m_pVisibleCursor->Show(); // show again @@ -2422,6 +2427,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) sendLOKCursorUpdates(); getIDocumentMarkAccess()->NotifyCursorUpdate(*this); + m_bIsCursorPosChanged = false; // reset to default } void SwCursorShell::sendLOKCursorUpdates() @@ -3340,6 +3346,7 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin ) m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd = m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor = m_bOverwriteCursor = false; + m_bIsCursorPosChanged = false; m_bSendAccessibleCursorEvents = true; m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true; m_bSVCursorVis = true; diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 3224893d81bb..a61d17c84624 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -247,7 +247,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) LOK_CALLBACK_INVALIDATE_VIEW_CURSOR); } } - else + else if (m_pCursorShell->m_bIsCursorPosChanged) { SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), SfxViewShell::Current(), m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);