vcl/inc/osx/salframe.h  |    3 +++
 vcl/osx/salframe.cxx    |    9 ++++++---
 vcl/osx/salframeview.mm |    7 +++++++
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 0c54c09aeb7e170512195c8f619ab2ded98c1ec5
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Mon Nov 6 09:44:18 2023 -0500
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Mon Nov 6 20:27:08 2023 +0100

    tdf#155266 force flush after scrolling
    
    This is the second attempt to force a flush after scrolling.
    Commit 9c0803edd1f42b2d29115674795c7c674fea1a35 worked on
    Mac Silicon but not Mac Intel.
    
    So, instead of calling [NSApp currentEvent] to determine if
    scrolling has occurred, mark the AquaSalFrame whenever a
    scrollwheel or mouse drag event is dispatched so the frame
    will be flushed in the next AquaSalFrame::Flush() call.
    
    Change-Id: I2d0b99d2cd1167e92c7fd89bf53b2f30ab85a165
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159003
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 21a4b963717d..2d9b9084fcbb 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -98,6 +98,9 @@ public:
 
     int                             mnBlinkCursorDelay;
 
+    // tdf#155266 force flush after scrolling
+    bool                            mbForceFlush;
+
 public:
     /** Constructor
 
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index d20e6e3d8422..a8616c4fedc4 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -87,7 +87,8 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, 
SalFrameStyleFlags salFrameStyle
     mnTrackingRectTag( 0 ),
     mrClippingPath( nullptr ),
     mnICOptions( InputContextFlags::NONE ),
-    mnBlinkCursorDelay ( nMinBlinkCursorDelay )
+    mnBlinkCursorDelay( nMinBlinkCursorDelay ),
+    mbForceFlush( false )
 {
     mpParent = dynamic_cast<AquaSalFrame*>(pParent);
 
@@ -1018,8 +1019,9 @@ void AquaSalFrame::Flush()
     // outside of the application's event loop (e.g. IntroWindow)
     // nothing would trigger paint event handling
     // => fall back to synchronous painting
-    if( ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
+    if( mbForceFlush || ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
     {
+        mbForceFlush = false;
         mpGraphics->Flush();
         [mpNSView display];
     }
@@ -1039,8 +1041,9 @@ void AquaSalFrame::Flush( const tools::Rectangle& rRect )
     // outside of the application's event loop (e.g. IntroWindow)
     // nothing would trigger paint event handling
     // => fall back to synchronous painting
-    if( ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
+    if( mbForceFlush || ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
     {
+        mbForceFlush = false;
         mpGraphics->Flush( rRect );
         [mpNSView display];
     }
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 4071155e28cc..27c9e773ec4c 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -861,6 +861,10 @@ static NSArray *getMergedAccessibilityChildren(NSArray 
*pDefaultChildren, NSArra
             aEvent.mnX = pDispatchFrame->maGeometry.width() - 1 - aEvent.mnX;
 
         pDispatchFrame->CallCallback( nEvent, &aEvent );
+
+        // tdf#155266 force flush after scrolling
+        if (nButton == MOUSE_LEFT && nEvent == SalEvent::MouseMove)
+            mpFrame->mbForceFlush = true;
     }
 }
 
@@ -1164,6 +1168,9 @@ static NSArray *getMergedAccessibilityChildren(NSArray 
*pDefaultChildren, NSArra
 
             mpFrame->CallCallback( SalEvent::WheelMouse, &aEvent );
         }
+
+        // tdf#155266 force flush after scrolling
+        mpFrame->mbForceFlush = true;
     }
 }
 

Reply via email to