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 8e8fc0b62965596c3c1ec37a4062ebb6a3d154fd
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Mon Nov 6 09:44:18 2023 -0500
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Nov 21 07:12:30 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>
    (cherry picked from commit 0c54c09aeb7e170512195c8f619ab2ded98c1ec5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159037
    Reviewed-by: Patrick Luby <plub...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 87ab09868edd..950c8d6345e1 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 209f0b94ac59..028e10cfb70d 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 0ccdb048d190..68681ba495c0 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -859,6 +859,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;
     }
 }
 
@@ -1162,6 +1166,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