external/skia/UnpackedTarball_skia.mk    |    2 
 external/skia/macosmetal.patch.0         |   70 +++++++++++++++++--------------
 package/qa/cppunit/data/tdf163341.ods    |binary
 package/qa/cppunit/data/tdf163364.ods    |binary
 package/qa/cppunit/test_zippackage.cxx   |   41 ++++++++++++++++++
 package/source/zipapi/ZipFile.cxx        |   10 ++--
 package/source/zippackage/ZipPackage.cxx |    8 +++
 svx/source/svdraw/svdview.cxx            |    4 -
 vcl/osx/salgdiutils.cxx                  |   17 ++-----
 vcl/source/filter/ipdf/pdfdocument.cxx   |    1 
 vcl/source/window/window2.cxx            |    2 
 vcl/unx/gtk3/gtkframe.cxx                |   21 ++++++++-
 12 files changed, 124 insertions(+), 52 deletions(-)

New commits:
commit d51b9be02d940cce58db1f392ce9f12e04d76194
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Oct 14 15:51:31 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    Dereference before nullptr check
    
    After commit 2c8c436c4a8546276e285dd18f3f7ded091a2c4e (tdf#152992:
    for Impress/Draw add horizontal hit tolerance for quick text edit,
    2023-07-21).
    
    Change-Id: Ia19bca115f95c53851dc63cdc7e4336f0289d731
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174793
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit c5703bbeebc6b4976dbf7cafb2e0bfda6345f864)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174921
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 27233a6435a6..297f21fe7252 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -518,8 +518,8 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, 
SdrViewEvent& rVEvt) co
 
         // Around the TextEditArea there's a border to select without going 
into text edit mode.
         tools::Rectangle aBoundRect;
-        const GeoStat& rGeo = pTextObj->GetGeoStat();
-        if (pTextObj && !rGeo.m_nRotationAngle && !rGeo.m_nShearAngle)
+        if (pTextObj && !pTextObj->GetGeoStat().m_nRotationAngle
+            && !pTextObj->GetGeoStat().m_nShearAngle)
         {
             pTextObj->TakeTextEditArea(nullptr, nullptr, &aBoundRect, nullptr);
         }
commit e010913d497adf8138c68dd25670039d11fdd3dc
Author:     Michael Stahl <[email protected]>
AuthorDate: Mon Oct 14 13:52:12 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    tdf#163341 package: fix reading Zip64 produced by stream-write-ods
    
    1. Accept 0xFFFF as nEndDisk/nEndDirDisk - the Zip APPNOTE says that
       values that don't fit into 16 bits SHOULD be 0xFFFF but it doesn't
       prohibit values that do fit (like, uhm, 0) to be written as 0xFFFF
    
       (regression from commit ca21cc985d57fffe7c834159b17c095206304994)
    
    2. Fix misuse of o3tl::make_unsigned - it requires non-negative value,
       just do signed compare instead
    
    3. Fix bad conversion from pointer to optional in
       ZipFile::readExtraFields() which effectively prevented the offset
       from being read
    
       (regression from commit efae4fc42d5fe3c0a69757226f38efc10d101194)
    
    Change-Id: Ib5e7776a30834e507b297fb28266b5489d1ab68d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174898
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 279f42fa8b19d4fe81c3bba4c7af21aa8ab135b9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174795
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/package/qa/cppunit/data/tdf163341.ods 
b/package/qa/cppunit/data/tdf163341.ods
new file mode 100644
index 000000000000..5971e0123883
Binary files /dev/null and b/package/qa/cppunit/data/tdf163341.ods differ
diff --git a/package/qa/cppunit/test_zippackage.cxx 
b/package/qa/cppunit/test_zippackage.cxx
index 892f2979cd61..e8f3f910bb5a 100644
--- a/package/qa/cppunit/test_zippackage.cxx
+++ b/package/qa/cppunit/test_zippackage.cxx
@@ -412,6 +412,19 @@ CPPUNIT_TEST_FIXTURE(ZipPackageTest, testTdf163364)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testTdf163341)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/tdf163341.ods"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::PACKAGE)))
+    };
+
+    // this Zip64 should load successfully
+    
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args,
+                                                                           
m_xContext);
+}
+
 //CPPUNIT_TEST_SUITE_REGISTRATION(...);
 //CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/package/source/zipapi/ZipFile.cxx 
b/package/source/zipapi/ZipFile.cxx
index 2e82433fb0da..5b5502cb5ea1 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -1158,12 +1158,12 @@ std::tuple<sal_Int64, sal_Int64, sal_Int64> 
ZipFile::findCentralDirectory()
 
         aGrabber.seek(nEndPos + 4);
         sal_uInt16 const nEndDisk = aGrabber.ReadUInt16();
-        if (nEndDisk != 0)
+        if (nEndDisk != 0 && nEndDisk != 0xFFFF)
         {   // only single disk is supported!
             throw ZipException(u"invalid end (disk)"_ustr );
         }
         sal_uInt16 const nEndDirDisk = aGrabber.ReadUInt16();
-        if (nEndDirDisk != 0)
+        if (nEndDirDisk != 0 && nEndDisk != 0xFFFF)
         {
             throw ZipException(u"invalid end (directory disk)"_ustr );
         }
@@ -1245,12 +1245,12 @@ std::tuple<sal_Int64, sal_Int64, sal_Int64> 
ZipFile::findCentralDirectory()
                 {
                     throw ZipException(u"inconsistent Zip/Zip64 end 
(entries)"_ustr);
                 }
-                if (o3tl::make_unsigned(nEndDirSize) != sal_uInt32(-1)
+                if (nEndDirSize != -1
                     && nEnd64DirSize != nEndDirSize)
                 {
                     throw ZipException(u"inconsistent Zip/Zip64 end 
(size)"_ustr);
                 }
-                if (o3tl::make_unsigned(nEndDirOffset) != sal_uInt32(-1)
+                if (nEndDirOffset != -1
                     && nEnd64DirOffset != nEndDirOffset)
                 {
                     throw ZipException(u"inconsistent Zip/Zip64 end 
(offset)"_ustr);
@@ -1525,7 +1525,7 @@ bool ZipFile::readExtraFields(MemoryByteGrabber& 
aMemGrabber, sal_Int16 nExtraLe
             {
                 nCompressedSize = aMemGrabber.ReadUInt64();
                 nReadSize = 16;
-                if (dataSize >= 24 && roOffset)
+                if (dataSize >= 24)
                 {
                     roOffset.emplace(aMemGrabber.ReadUInt64());
                     nReadSize = 24;
commit ee7457688c86febb36a87413fc5efabde6539eff
Author:     Michael Stahl <[email protected]>
AuthorDate: Mon Oct 14 12:04:05 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    tdf#163364 package: ask to recover for this invalid ODF package
    
    Bugdoc has a data descriptor on a folder entry, which is very odd and
    entirely pointless.  Which is also the first entry, so it's an invalid
    ODF package anyway.
    
    ZipPackageFolder throws UnknownPropertyException for "WasEncrypted",
    which results in General I/O error, but we want to ask the user if the
    file should be opened in recovery mode.
    
    (regression from commit 32cad89592ec04ab552399095c91dd76afb3002c)
    
    Change-Id: Iafe610d507cf92d2fd2e9c3040592c3e638a30dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174889
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 3efad499bf4f7623610a54f9f14622de4954352f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174790
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/package/qa/cppunit/data/tdf163364.ods 
b/package/qa/cppunit/data/tdf163364.ods
new file mode 100644
index 000000000000..a772aebdbc7e
Binary files /dev/null and b/package/qa/cppunit/data/tdf163364.ods differ
diff --git a/package/qa/cppunit/test_zippackage.cxx 
b/package/qa/cppunit/test_zippackage.cxx
index 624457ab7bcf..892f2979cd61 100644
--- a/package/qa/cppunit/test_zippackage.cxx
+++ b/package/qa/cppunit/test_zippackage.cxx
@@ -384,6 +384,34 @@ CPPUNIT_TEST_FIXTURE(ZipPackageTest, testZip64End)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(ZipPackageTest, testTdf163364)
+{
+    auto const 
url(m_directories.getURLFromSrc(u"/package/qa/cppunit/data/tdf163364.ods"));
+    uno::Sequence<uno::Any> const args{
+        uno::Any(url),
+        uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::PACKAGE)))
+    };
+
+    // don't load corrupted zip file
+    
CPPUNIT_ASSERT_THROW(m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+                             ZipPackage, args, m_xContext),
+                         css::packages::zip::ZipIOException);
+
+    try
+    {
+        uno::Sequence<uno::Any> const args2{
+            uno::Any(url), uno::Any(beans::NamedValue(u"RepairPackage"_ustr, 
uno::Any(true))),
+            uno::Any(beans::NamedValue("StorageFormat", 
uno::Any(embed::StorageFormats::ZIP)))
+        };
+        
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(ZipPackage,
 args2,
+                                                                               
m_xContext);
+    }
+    catch (css::packages::zip::ZipIOException const&)
+    {
+        // check that this doesn't crash, it doesn't matter if it succeeds or 
not
+    }
+}
+
 //CPPUNIT_TEST_SUITE_REGISTRATION(...);
 //CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/package/source/zippackage/ZipPackage.cxx 
b/package/source/zippackage/ZipPackage.cxx
index 91a82fe7fbdb..b2bdf4cf016e 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -192,6 +192,14 @@ void ZipPackage::checkZipEntriesWithDD()
             {
                 uno::Reference<XPropertySet> xStream;
                 getByHierarchicalName(rEntry.sPath) >>= xStream;
+                uno::Reference<XServiceInfo> const xStreamSI{xStream, 
uno::UNO_QUERY_THROW};
+                if 
(!xStreamSI->supportsService("com.sun.star.packages.PackageStream"))
+                {
+                    SAL_INFO("package", "entry STORED with data descriptor is 
folder: \"" << rEntry.sPath << "\"");
+                    throw ZipIOException(
+                        THROW_WHERE
+                        "entry STORED with data descriptor is folder");
+                }
                 if (!xStream->getPropertyValue("WasEncrypted").get<bool>())
                 {
                     SAL_INFO("package", "entry STORED with data descriptor but 
not encrypted: \"" << rEntry.sPath << "\"");
commit 3d3b29551aca800d1cd729a091083a53999d9b25
Author:     Justin Luth <[email protected]>
AuthorDate: Mon Oct 7 15:29:38 2024 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    avoid PDF export crash when ReadWithPossibleFixup falls back to Pdfium
    
    Unfortunately, I failed to create a clean-room example,
    even when I pasted some binary garbage at the end of the file.
    Somehow I was getting a sanitized version from getAsStream.
    
    In any case, this prevents crashing with the two examples I have,
    although there are still significant problems somewhere
    because the export just results in empty pages...
    
    The problem is that reading again with the Pdfium-fixed version
    gets mixed in with the original read results,
    and things get pretty garbled.
    Probably m_rElements and everything needs to be cleared
    before tokenizing the fixup-version.
    
    Change-Id: I01daefa23b8f92e2849d71bca269ba2b476199da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174648
    Reviewed-by: Justin Luth <[email protected]>
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit 636e703722c1a36b4078de932b5a44855145c18a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174663
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 8400b5bf0d116b8ed193696820beeb812e89a9ac)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174670

diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index dac68d5344af..b5fbc757da57 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1427,6 +1427,7 @@ bool PDFDocument::Read(SvStream& rStream)
             nStartXRef = pPrev->GetValue();
 
         // Reset state, except the edit buffer.
+        m_aOffsetTrailers.clear(); // contents are lifecycle managed by 
m_aElements
         m_aElements.clear();
         m_aOffsetObjects.clear();
         m_aIDObjects.clear();
commit b9d77aafe77e02a2530973c7b483d1cc572be9a0
Author:     Patrick Luby <[email protected]>
AuthorDate: Wed Sep 25 19:32:55 2024 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    tdf#163152 don't convert image's sRGB colorspace
    
    With Skia/Raster or Skia disabled, converting the image's
    colorspace to match the window's colorspace causes more than
    an expected amount of color saturation so let the window's
    underlying CGContext handle any necessary colorspace conversion
    in CGContextDrawImage().
    
    With Skia/Metal, this bug is caused by the CAMetalLayer being
    set to the same colorspace as its matching window. So set the
    CAMetalLayer's colorspace to sRGB so that, like with Skia/Raster
    and Skia disabled, any colorspace conversion is handled when the
    CAMetalLayer is drawn to the window.
    
    Change-Id: Ifa2abe46d34bfcf5acd478fffd346603f869157b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173962
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <[email protected]>
    (cherry picked from commit e4ab68142c7bc4e04ffe429567dda974b86985a7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174005
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/external/skia/UnpackedTarball_skia.mk 
b/external/skia/UnpackedTarball_skia.mk
index 2cdcf62872d3..bdfd27d36703 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -33,7 +33,7 @@ skia_patches := \
     windows-libraries-system32.patch.1 \
     allow-no-es2restrictions.patch.1 \
     vk_mem_alloc.patch.1 \
-    tdf147342.patch.0 \
+    macosmetal.patch.0 \
     redefinition-of-op.patch.0 \
     0001-Added-missing-include-cstdio.patch \
     fix-SkDebugf-link-error.patch.1 \
diff --git a/external/skia/tdf147342.patch.0 b/external/skia/macosmetal.patch.0
similarity index 84%
rename from external/skia/tdf147342.patch.0
rename to external/skia/macosmetal.patch.0
index 3b50038c07ac..3da9fc693fe9 100644
--- a/external/skia/tdf147342.patch.0
+++ b/external/skia/macosmetal.patch.0
@@ -18,36 +18,6 @@
  
  namespace window_context_factory {
  
---- tools/sk_app/mac/MetalWindowContext_mac.mm 2021-11-25 10:39:27.000000000 
-0500
-+++ tools/sk_app/mac/MetalWindowContext_mac.mm 2023-01-28 14:55:57.000000000 
-0500
-@@ -11,6 +11,8 @@
- #import <Cocoa/Cocoa.h>
- #import <QuartzCore/CAConstraintLayoutManager.h>
- 
-+#include <sal/log.hxx>
-+
- using sk_app::DisplayParams;
- using sk_app::window_context_factory::MacWindowInfo;
- using sk_app::MetalWindowContext;
-@@ -87,6 +89,18 @@
-     fMetalLayer.drawableSize = backingSize;
-     fMetalLayer.contentsScale = backingScaleFactor;
- 
-+    // Related: tdf#147342 Copy layer's colorspace to window's colorspace
-+    // This method is now called when the window's backing properties have
-+    // changed so copy any colorspace changes.
-+    NSColorSpace* cs = fMainView.window.colorSpace;
-+    fMetalLayer.colorspace = cs.CGColorSpace;
-+    // Related tdf#145988 Reset layer's pixel format to 
MTLPixelFormatBGRA8Unorm
-+    // Skia initally sets the layer's pixel format to be BGRA8888 but macOS
-+    // may change the layer's pixel format when a window has moved to a screen
-+    // with 30-bit color depth so reset it back to BGRA8888.
-+    SAL_WARN_IF(fMetalLayer.pixelFormat != MTLPixelFormatBGRA8Unorm, 
"vcl.skia.metal", "CAMetalLayer pixel format is " << fMetalLayer.pixelFormat << 
" but should be " << MTLPixelFormatBGRA8Unorm << " (MTLPixelFormatBGRA8Unorm)");
-+    fMetalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm;
-+
-     fWidth = backingSize.width;
-     fHeight = backingSize.height;
- }
 --- /dev/null  2023-01-25 09:20:55.000000000 -0500
 +++ tools/sk_app/mac/WindowContextFactory_mac.mm       2023-01-25 
09:21:22.000000000 -0500
 @@ -0,0 +1,57 @@
@@ -108,3 +78,43 @@
 +}
 +
 +}  // namespace sk_app
+--- tools/sk_app/mac/MetalWindowContext_mac.mm 2024-08-31 15:49:57
++++ tools/sk_app/mac/MetalWindowContext_mac.mm 2024-09-25 20:09:32
+@@ -11,6 +11,8 @@
+ #import <Cocoa/Cocoa.h>
+ #import <QuartzCore/CAConstraintLayoutManager.h>
+ 
++#include <sal/log.hxx>
++
+ using sk_app::DisplayParams;
+ using sk_app::window_context_factory::MacWindowInfo;
+ using sk_app::MetalWindowContext;
+@@ -66,8 +68,7 @@
+     fMetalLayer.autoresizingMask = kCALayerHeightSizable | 
kCALayerWidthSizable;
+     fMetalLayer.contentsGravity = kCAGravityTopLeft;
+     fMetalLayer.magnificationFilter = kCAFilterNearest;
+-    NSColorSpace* cs = fMainView.window.colorSpace;
+-    fMetalLayer.colorspace = cs.CGColorSpace;
++    fMetalLayer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ 
+     fMainView.layer = fMetalLayer;
+     fMainView.wantsLayer = YES;
+@@ -86,6 +87,18 @@
+     fMetalLayer.drawableSize = backingSize;
+     fMetalLayer.contentsScale = backingScaleFactor;
+ 
++    // Related: tdf#147342 Copy layer's colorspace to window's colorspace
++    // This method is now called when the window's backing properties have
++    // changed so copy any colorspace changes.
++    fMetalLayer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
++
++    // Related tdf#145988 Reset layer's pixel format to 
MTLPixelFormatBGRA8Unorm
++    // Skia initally sets the layer's pixel format to be BGRA8888 but macOS
++    // may change the layer's pixel format when a window has moved to a screen
++    // with 30-bit color depth so reset it back to BGRA8888.
++    SAL_WARN_IF(fMetalLayer.pixelFormat != MTLPixelFormatBGRA8Unorm, 
"vcl.skia.metal", "CAMetalLayer pixel format is " << fMetalLayer.pixelFormat << 
" but should be " << MTLPixelFormatBGRA8Unorm << " (MTLPixelFormatBGRA8Unorm)");
++    fMetalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm;
++
+     fWidth = backingSize.width;
+     fHeight = backingSize.height;
+ }
diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx
index d7f8ec48eaf0..7e2cf029b71f 100644
--- a/vcl/osx/salgdiutils.cxx
+++ b/vcl/osx/salgdiutils.cxx
@@ -381,17 +381,12 @@ void AquaSalGraphics::UpdateWindow( NSRect& rRect )
 
         CGContextSetBlendMode(rCGContextHolder.get(), kCGBlendModeCopy);
 
-        NSWindow *pWindow = maShared.mpFrame->getNSWindow();
-        if (pWindow)
-        {
-            CGImageRef displayColorSpaceImage = 
CGImageCreateCopyWithColorSpace(img, [[maShared.mpFrame->getNSWindow() 
colorSpace] CGColorSpace]);
-            CGContextDrawImage(rCGContextHolder.get(), aRect, 
displayColorSpaceImage);
-            CGImageRelease(displayColorSpaceImage);
-        }
-        else
-        {
-            CGContextDrawImage(rCGContextHolder.get(), aRect, img);
-        }
+        // tdf#163152 don't convert image's sRGB colorspace
+        // Converting the image's colorspace to match the window's
+        // colorspace causes more than an expected amount of color
+        // saturation so let the window's underlying CGContext handle
+        // any necessary colorspace conversion in CGContextDrawImage().
+        CGContextDrawImage(rCGContextHolder.get(), aRect, img);
 
         rCGContextHolder.restoreState();
 
commit cf049bdcd42cb46a3c54043c87a73363bb07c694
Author:     Rico Tzschichholz <[email protected]>
AuthorDate: Mon Feb 6 19:24:41 2023 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    vcl: Use fabs() for double argument
    
    Change-Id: I959786e42dc576cb72411bacccf1b9bd32fbe21d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173625
    Tested-by: Jenkins
    Reviewed-by: Ilmari Lauhakangas <[email protected]>
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index ceaebf52bea8..b823ea099595 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -632,7 +632,7 @@ static double lcl_HandleScrollHelper( Scrollable* pScrl, 
double nN, bool isMulti
         }
 
         // compute how many quantized units to scroll
-        tools::Long magnitude = o3tl::saturating_cast<tools::Long>(abs(nN));
+        tools::Long magnitude = o3tl::saturating_cast<tools::Long>(fabs(nN));
         tools::Long change = copysign(magnitude, nN);
 
         nNewPos = nNewPos - change;
commit 01b8ba0e6111ffbb75df5268f1849ce14e0550c3
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Oct 10 11:56:35 2024 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Oct 15 10:18:07 2024 +0200

    tdf#161479 make presentation work on fractionally scaled display
    
    With fractional scaling on wayland the monitor sizes here are reported
    effectively with the fractional scaling factor rounded up to the next
    integer.
    
    So:
    1920 x 1080 at 125% scaling which appears like,
    1536 x 864 is reported the same as 200% scaling, i.e.
    960 x 540
    
    So using these values as constraints for GDK_HINT_MAX_SIZE
    with gtk_window_set_geometry_hints for m_bFullscreen are
    too small to allow filling the screen.
    
    Seeing as this was introduced as a workaround in the first
    place, drop the workaround under wayland.
    
    Change-Id: I7acfc929755728bbf77731d040f1f0f66cac836c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174761
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 4059c6351d9dc07ef2ab88149079cb2c59e22c32)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174783
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 8c097c526c5b..f31274e54f4e 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -2472,8 +2472,25 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, 
SetType eType, tools::Rect
 
         // #i110881# for the benefit of compiz set a max size here
         // else setting to fullscreen fails for unknown reasons
-        m_aMaxSize.setWidth( aNewMonitor.width );
-        m_aMaxSize.setHeight( aNewMonitor.height );
+        //
+        // tdf#161479 With fractional scaling on wayland the monitor
+        // sizes here are reported effectively with the fractional
+        // scaling factor rounded up to the next integer, so,
+        // 1920 x 1080 at 125% scaling which appears like,
+        // 1536 x 864 is reported the same as 200% scaling, i.e.
+        // 960 x 540 which causes a problem on trying to set
+        // fullscreen on fractional scaling under wayland. Drop
+        // this old workaround when under wayland.
+#if defined(GDK_WINDOWING_WAYLAND)
+        const bool bWayland = 
DLSYM_GDK_IS_WAYLAND_DISPLAY(GtkSalFrame::getGdkDisplay());
+#else
+        const bool bWayland = false;
+#endif
+        if (!bWayland)
+        {
+            m_aMaxSize.setWidth( aNewMonitor.width );
+            m_aMaxSize.setHeight( aNewMonitor.height );
+        }
     }
 
     if( pSize && eType == SetType::UnFullscreen )

Reply via email to