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 1c93172b5b0bc6e4fec1edccc19dcf0843def46c
Author:     Gülşah Köse <[email protected]>
AuthorDate: Mon Jan 27 16:51:51 2025 +0300
Commit:     Gülşah Köse <[email protected]>
CommitDate: Wed Feb 12 10:35: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]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181346

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2fc9598401cc..211f6b0592ad 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -236,7 +236,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 4f7e457be8ba..62d2776ba6c6 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1945,7 +1945,6 @@ class SwNotifyAccAboutInvalidTextSelections
 
 void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 {
-    Point nOldPos = m_pCurrentCursor->GetPtPos();
     CurrShell aCurr( this );
     ClearUpCursors();
 
@@ -2445,10 +2444,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
 
@@ -2456,7 +2451,6 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool 
bIdleEnd )
         sendLOKCursorUpdates();
 
     getIDocumentMarkAccess()->NotifyCursorUpdate(*this);
-    m_bIsCursorPosChanged = false; // reset to default
 }
 
 void SwCursorShell::sendLOKCursorUpdates()
@@ -3375,7 +3369,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;
@@ -3425,7 +3418,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 33894da0440f..ad11b3a8294d 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