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 b8910f2a00119e2de136b00567d5f9704f84ac25
Author:     Patrick Luby <[email protected]>
AuthorDate: Mon Nov 6 09:44:18 2023 -0500
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Nov 20 17:55:28 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 <[email protected]>
    (cherry picked from commit 0c54c09aeb7e170512195c8f619ab2ded98c1ec5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159038
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index af8783b96147..b79d317ad55f 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 d3d35de8577f..88c9a9dcb06f 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);
 
@@ -1015,8 +1016,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];
     }
@@ -1036,8 +1038,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 08821800f5a9..3892ef659cf2 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -786,6 +786,10 @@ static AquaSalFrame* getMouseContainerFrame()
             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;
     }
 }
 
@@ -1089,6 +1093,9 @@ static AquaSalFrame* getMouseContainerFrame()
 
             mpFrame->CallCallback( SalEvent::WheelMouse, &aEvent );
         }
+
+        // tdf#155266 force flush after scrolling
+        mpFrame->mbForceFlush = true;
     }
 }
 

Reply via email to