vcl/osx/salinst.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 812c3cf069b068b75d01662c241b52bec2dd2928
Author:     Patrick Luby <guibmac...@gmail.com>
AuthorDate: Tue May 7 17:41:10 2024 -0400
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Tue May 14 07:34:24 2024 +0200

    tdf#160767 skip fix for tdf#155266 when the event hasn't changed
    
    When scrolling in Writer with automatic spellchecking enabled,
    the current event never changes because the fix for tdf#155266
    causes Writer to get stuck in a loop. So, if the current event
    has not changed since the last pass through this code, skip
    the fix for tdf#155266.
    
    Change-Id: I97265a7698756c5fb65b6686f6bb77c1caa08862
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167229
    Reviewed-by: Patrick Luby <guibomac...@gmail.com>
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Tested-by: Jenkins

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 7f755bb618b3..33101c8d1b11 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -750,7 +750,22 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
         // not NSEventTypeScrollWheel.
         NSEvent* pCurrentEvent = [NSApp currentEvent];
         if( pCurrentEvent && [pCurrentEvent type] == NSEventTypeScrollWheel )
-            nEventMask &= ~NSEventMaskScrollWheel;
+        {
+            // tdf#160767 skip fix for tdf#155266 when the event hasn't changed
+            // When scrolling in Writer with automatic spellchecking enabled,
+            // the current event never changes because the fix for tdf#155266
+            // causes Writer to get stuck in a loop. So, if the current event
+            // has not changed since the last pass through this code, skip
+            // the fix for tdf#155266.
+            static NSEvent *pLastCurrentEvent = nil;
+            if( pLastCurrentEvent != pCurrentEvent )
+            {
+                if( pLastCurrentEvent )
+                    [pLastCurrentEvent release];
+                pLastCurrentEvent = [pCurrentEvent retain];
+                nEventMask &= ~NSEventMaskScrollWheel;
+            }
+        }
     }
 
     if( nType & VclInputFlags::KEYBOARD)

Reply via email to