vcl/osx/salframeview.mm |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit d118be7ed4dd6596a8b4d766e8507b6dcaf2b7f7
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Mon Jan 2 19:53:46 2023 -0500
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jan 3 07:12:20 2023 +0000

    Related: tdf#152703 Eliminate empty window with Skia/Metal while resizing
    
    The window will clear its background in [SalFrameWindow displayIfNeeded]
    so when Skia/Metal is enabled, explicitly flush the Skia graphics to the
    window during live resizing or else nothing will be drawn until after live
    resizing has ended.
    
    Also, when Skia/Metal is enabled, rapidly resizing a window has a noticeable
    amount of flicker so don't send any paint events during live resizing. Also,
    it appears that most of the LibreOffice layouts do not change their layout
    much during live resizing so apply this change when Skia is not enabled to
    ensure consistent behavior whether Skia is enabled or not.
    
    Change-Id: If6423faa72529b9de8735e04e69c9511aceb2276
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144979
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 2f35d3a057b7..de996654bc1d 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -36,6 +36,10 @@
 #include <quartz/salgdi.h>
 #include <quartz/utils.h>
 
+#if HAVE_FEATURE_SKIA
+#include <vcl/skia/SkiaHelper.hxx>
+#endif
+
 #define WHEEL_EVENT_FACTOR 1.5
 
 static sal_uInt16 ImplGetModifierMask( unsigned int nMask )
@@ -215,6 +219,21 @@ static AquaSalFrame* getMouseContainerFrame()
     if( GetSalData() && GetSalData()->mpInstance )
     {
         SolarMutexGuard aGuard;
+
+#if HAVE_FEATURE_SKIA
+        // Related: tdf#152703 Eliminate empty window with Skia/Metal while 
resizing
+        // The window will clear its background so when Skia/Metal is enabled,
+        // explicitly flush the Skia graphics to the window during live
+        // resizing or else nothing will be drawn until after live resizing
+        // has ended.
+        if ( [self inLiveResize] && SkiaHelper::isVCLSkiaEnabled() && mpFrame 
&& AquaSalFrame::isAlive( mpFrame ) )
+        {
+            AquaSalGraphics* pGraphics = mpFrame->mpGraphics;
+            if ( pGraphics )
+                pGraphics->Flush();
+        }
+#endif
+
         [super displayIfNeeded];
     }
 }
@@ -317,7 +336,17 @@ static AquaSalFrame* getMouseContainerFrame()
     {
         mpFrame->UpdateFrameGeometry();
         mpFrame->CallCallback( SalEvent::Resize, nullptr );
-        mpFrame->SendPaintEvent();
+
+        // Related: tdf#152703 Stop flicker with Skia/Metal while resizing
+        // When Skia/Metal is enabled, rapidly resizing a window has a
+        // noticeable amount of flicker so don't send any paint events during
+        // live resizing.
+        // Also, it appears that most of the LibreOffice layouts do not change
+        // their layout much during live resizing so apply this change when
+        // Skia is not enabled to ensure consistent behavior whether Skia is
+        // enabled or not.
+        if ( ![self inLiveResize] )
+            mpFrame->SendPaintEvent();
     }
 }
 

Reply via email to