sw/inc/crsrsh.hxx              |    1 -
 sw/source/core/crsr/crsrsh.cxx |    8 --------
 sw/source/core/crsr/viscrs.cxx |    4 +++-
 3 files changed, 3 insertions(+), 10 deletions(-)

New commits:
commit ccaeb27fafbd7ab40a6b811202edd6a65da639fb
Author:     Gülşah Köse <[email protected]>
AuthorDate: Mon Jan 27 16:51:51 2025 +0300
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Feb 5 13:09:33 2025 +0100

    ONLINE: Check cursor position changes more safely
    
    Prevent cursor invalidation if the cursor position doesn't change.
    It prevents to flickering hyperlink popup while other users are typing.
    
    Fixes the regression caused by a260cc52b2fae1382805b4389c95f29ed8671f42
    
    With that patch we can use next and previous page buttons in the status
    bar safely.
    
    Signed-off-by: Gülşah Köse <[email protected]>
    Change-Id: I82bfe2355f91d18057d2254a8969fd4994dab4df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180784
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 5cf244aa6b4e..97248572c762 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -237,7 +237,6 @@ 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 6f108b625d00..51f675adc9dd 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1905,7 +1905,6 @@ class SwNotifyAccAboutInvalidTextSelections
 
 void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 {
-    Point nOldPos = m_pCurrentCursor->GetPtPos();
     CurrShell aCurr( this );
     ClearUpCursors();
 
@@ -2400,10 +2399,6 @@ 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
 
@@ -2411,7 +2406,6 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool 
bIdleEnd )
         sendLOKCursorUpdates();
 
     getIDocumentMarkAccess()->NotifyCursorUpdate(*this);
-    m_bIsCursorPosChanged = false; // reset to default
 }
 
 void SwCursorShell::sendLOKCursorUpdates()
@@ -3330,7 +3324,6 @@ 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;
@@ -3380,7 +3373,6 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, 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 b82baebf5aa5..2226e77d96ae 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -205,6 +205,8 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
         m_pCursorShell->IsSelection() )
         aRect.Width( 0 );
 
+    bool bIsCursorPosChanged = m_aTextCursor.GetPos() != aRect.Pos();
+
     m_aTextCursor.SetSize( aRect.SSize() );
 
     m_aTextCursor.SetPos( aRect.Pos() );
@@ -247,7 +249,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * 
pViewShell)
                     LOK_CALLBACK_INVALIDATE_VIEW_CURSOR);
             }
         }
-        else if (m_pCursorShell->m_bIsCursorPosChanged || 
m_pCursorShell->IsTableMode())
+        else if ( bIsCursorPosChanged || m_pCursorShell->IsTableMode())
         {
             
SfxLokHelper::notifyUpdatePerViewId(m_pCursorShell->GetSfxViewShell(), 
SfxViewShell::Current(),
                 m_pCursorShell->GetSfxViewShell(), 
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR);

Reply via email to