core.git: Branch 'libreoffice-24-2' - vcl/source

2024-07-26 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 796a3e836e5c2379b22e6b73aba5986f406d8c38
Author: Patrick Luby 
AuthorDate: Wed Jul 17 08:41:30 2024 -0400
Commit: Patrick Luby 
CommitDate: Sat Jul 27 01:56:32 2024 +0200

tdf#162062 only apply fix for tdf#161833 if there is a palette

Change-Id: I50d13ed336110eb5e65e99dd5d4a6c6defe6bc50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170627
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit ee76e5041c79843ef0942c6427d4cd3717820ff6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170655
Reviewed-by: Mike Kaganski 

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 2778a434b390..23a260c9c84b 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -1309,7 +1309,8 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 // causes clipping of any shadows or other semi-transaprent
 // areas in the image. So, instead of testing for fully opaque
 // pixels, treat pixels that are not fully transparent as opaque.
-const BitmapColor   aTransparent = pAcc->GetBestMatchingColor( 
COL_ALPHA_TRANSPARENT );
+// tdf#162062 only apply fix for tdf#161833 if there is a palette
+const BitmapColor   aTransparent = pAcc->GetBestMatchingColor( 
pAcc->HasPalette() ? COL_ALPHA_TRANSPARENT : COL_ALPHA_OPAQUE );
 
 pPoints1.reset(new Point[ nHeight ]);
 pPoints2.reset(new Point[ nHeight ]);


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-06-27 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 8590499c1f382244155624cd3f712d0894faaa2b
Author: Patrick Luby 
AuthorDate: Thu Jun 27 11:15:52 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Jun 28 00:33:49 2024 +0200

tdf#161498 use COL_ALPHA_OPAQUE for finding opaque pixels

Starting with commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
pixels now contain an alpha value instead of a transparency
value.

Change-Id: I07dd39859057d153a21ee38625049039b106
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169654
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit 1ac602f6ccd75f3b79d6c7a9d40e64677dd5741a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169667
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 07e25f177180..571f8d700836 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -1304,7 +1304,11 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 std::unique_ptr pPoints2;
 tools::LongnX, nY;
 sal_uInt16  nPolyPos = 0;
-const BitmapColor   aBlack = pAcc->GetBestMatchingColor( COL_BLACK 
);
+// tdf#161498 use COL_ALPHA_OPAQUE for finding opaque pixels
+// Starting with commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
+// pixels now contain an alpha value instead of a transparency
+// value.
+const BitmapColor   aTransparencyOpaque = 
pAcc->GetBestMatchingColor( COL_ALPHA_OPAQUE );
 
 pPoints1.reset(new Point[ nHeight ]);
 pPoints2.reset(new Point[ nHeight ]);
@@ -1317,7 +1321,7 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 // scan row from left to right
 while( nX < nEndX1 )
 {
-if( aBlack == pAcc->GetPixelFromData( pScanline, nX ) )
+if( aTransparencyOpaque == pAcc->GetPixelFromData( 
pScanline, nX ) )
 {
 pPoints1[ nPolyPos ] = Point( nX, nY );
 nX = nStartX2;
@@ -1325,7 +1329,7 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 // this loop always breaks eventually as there is at 
least one pixel
 while( true )
 {
-if( aBlack == pAcc->GetPixelFromData( pScanline, 
nX ) )
+if( aTransparencyOpaque == pAcc->GetPixelFromData( 
pScanline, nX ) )
 {
 pPoints2[ nPolyPos ] = Point( nX, nY );
 break;


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-06-12 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/itiff/itiff.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 302dde87c1ccf1163131ed2794f54add290757d3
Author: Caolán McNamara 
AuthorDate: Wed Jun 12 16:01:38 2024 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Jun 12 22:51:42 2024 +0200

Resolves: tdf#160635 allow larger tiff images

Change-Id: I67a21877e7e75c2753218a7e6c978f691d679583
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168720
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index 741be4c5c1d1..af5d88a31499 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -155,8 +155,7 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 }
 
 uint32_t nPixelsRequired;
-// use the same max size that libtiff defaults to for its own utilities
-constexpr size_t nMaxPixelsAllowed = (256 * 1024 * 1024) / 4;
+constexpr size_t nMaxPixelsAllowed = SAL_MAX_INT32/4;
 // two buffers currently required, so limit further
 bool bOk = !o3tl::checked_multiply(w, h, nPixelsRequired) && 
nPixelsRequired <= nMaxPixelsAllowed / 2;
 SAL_WARN_IF(!bOk, "filter.tiff", "skipping oversized tiff image " << w 
<< " x " << h);


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-05-20 Thread Khaled Hosny (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit af319f4122aab98d44e88e8d582c109096c57049
Author: Khaled Hosny 
AuthorDate: Sat May 18 17:23:19 2024 +0300
Commit: Xisco Fauli 
CommitDate: Mon May 20 10:45:50 2024 +0200

tdf#160884: Apply scale to position of embedded images in Type 3 fonts

Regression from:

commit bc3f6c3a47411a3b5dafadca4e5c55cd24e30662
Author: Khaled Hosny 
Date:   Tue Aug 22 10:47:33 2023 +0300

tdf#155610: Workaround Acrobat bug with Type 3 fonts and unusual UPEM

Change-Id: I5e352292268d19fb8348a038d251f2d395a0be46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167830
Reviewed-by: Stéphane Guillou 
Reviewed-by: خالد حسني 
Tested-by: Jenkins
(cherry picked from commit 44f2bc12779645bce1000289caf9c66804ecb14e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167815
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index ff7383d7be99..16b0b5e23501 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2746,15 +2746,11 @@ bool PDFWriterImpl::emitType3Font(const 
vcl::font::PhysicalFontFace* pFace,
 appendDouble(aRect.GetWidth() * fScale, aContents);
 aContents.append(" 0 0 ");
 appendDouble(aRect.GetHeight() * fScale, aContents);
-aContents.append(
-+ " "
-+ OString::number(aRect.getX())
-+ " "
-+ OString::number(aRect.getY())
-+ " cm "
-  "/Im"
-+ OString::number(nObject)
-+ " Do Q
");
+aContents.append(" ");
+appendDouble(aRect.getX() * fScale, aContents);
+aContents.append(" ");
+appendDouble(aRect.getY() * fScale, aContents);
+aContents.append(" cm /Im" + OString::number(nObject) + " Do Q
");
 }
 
 const auto& rOutline = rGlyph.getOutline();


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-28 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit e1a5213427a876ae609635671f6fd6186aea1e67
Author: Patrick Luby 
AuthorDate: Sun Apr 28 14:35:42 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Apr 29 00:47:02 2024 +0200

tdf#160831 only set outside color to black for alpha masks

The outside color still needs to be white for the content
so only apply the fix for tdf#157795 to the alpha mask.

Change-Id: I7486b2c9062ca96bf127f2bce6b1bd5e65d00ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166806
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
(cherry picked from commit 5425103fb5a09c7e5e56d077260523438c593e21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166727
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 40feacbf66dd..07e25f177180 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -657,7 +657,7 @@ namespace
 const Bitmap& rSource,
 const Size& rDestinationSize,
 const basegfx::B2DHomMatrix& rTransform,
-bool bSmooth)
+bool bSmooth, bool bAlphaMask)
 {
 Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP);
 BitmapScopedWriteAccess xWrite(aDestination);
@@ -673,7 +673,10 @@ namespace
 // tdf#157795 set color to black outside of bitmap bounds
 // Due to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
 // transparent areas are now black instead of white.
-const BitmapColor aOutside(0x0, 0x0, 0x0);
+// tdf#160831 only set outside color to black for alpha masks
+// The outside color still needs to be white for the content
+// so only apply the fix for tdf#157795 to the alpha mask.
+const BitmapColor aOutside = bAlphaMask ? BitmapColor(0x0, 
0x0, 0x0) : BitmapColor(0xff, 0xff, 0xff);
 
 for(tools::Long y(0); y < aDestinationSizePixel.getHeight(); 
y++)
 {
@@ -759,12 +762,12 @@ BitmapEx BitmapEx::TransformBitmapEx(
 // force destination to 24 bit, we want to smooth output
 const Size aDestinationSize(basegfx::fround(fWidth), 
basegfx::fround(fHeight));
 bool bSmooth = implTransformNeedsSmooth(rTransformation);
-const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, false));
 
 // create mask
 if(IsAlpha())
 {
-const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, true));
 return BitmapEx(aDestination, AlphaMask(aAlpha));
 }
 


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-23 Thread Noel Grandin (via logerrit)
 vcl/source/app/svapp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 6b9cd13f502363c1784cdcb4538b6409a3a14c83
Author: Noel Grandin 
AuthorDate: Tue Apr 23 09:20:22 2024 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Apr 23 20:19:28 2024 +0200

tdf#160469 Ctrl+Alt+F4 is marked reserved, but doesn't do anything

this used to be SV_SHORTCUT_DOCKUNDOCK, which was introduced in

commit b342b183aaea042ef0e6e1c75304072cb4e1375a
Author: Rüdiger Timm 
Date:   Tue Jul 24 09:03:18 2007 +
INTEGRATION: CWS mergesvp (1.1.2); FILE ADDED

I assume this was a solaris or something similar system hotkey, so
remove it as no longer being relevant.

Certainly nothing inside the vcl code is handling it specially.

Change-Id: I80b9d293e7db42e1ff523319862d44b93d3231c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166502
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit bced98442d5e9c4b55ec6d4e5da3d549f8141359)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166513
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index e1e12dbc3e8a..71b884423af3 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -103,7 +103,6 @@ vcl::KeyCode const ReservedKeys[]
 vcl::KeyCode(KEY_F2,KEY_SHIFT)  ,
 vcl::KeyCode(KEY_F4,KEY_MOD1)   ,
 vcl::KeyCode(KEY_F4,KEY_MOD2)   ,
-vcl::KeyCode(KEY_F4,KEY_MOD1|KEY_MOD2)  ,
 vcl::KeyCode(KEY_F6,0)  ,
 vcl::KeyCode(KEY_F6,KEY_MOD1)   ,
 vcl::KeyCode(KEY_F6,KEY_SHIFT)  ,


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-09 Thread Mike Kaganski (via logerrit)
 vcl/source/gdi/sallayout.cxx |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 70c19e55662e8a42876bc6aebdc7cfe1ede14ee1
Author: Mike Kaganski 
AuthorDate: Tue Apr 2 08:55:51 2024 +0500
Commit: Xisco Fauli 
CommitDate: Tue Apr 9 10:24:53 2024 +0200

Fix UB after 8962141a12c966b2d891829925e6203bf8d51852

(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 
2024-04-01).
As reported by Stephan in 
https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now 
fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the 
range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at 
vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString 
const&, int, int, int, unsigned long, KernArraySpan, std::span, SalLayoutGlyphs const*) const at 
vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, 
rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString 
const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at 
starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at 
starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at 
starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at 
starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at 
starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at 
starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at 
starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at 
starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at 
starmath/source/unomodel.cxx:1105:22
   #16 in 
writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&)
 at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at 
writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at 
writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in 
writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at 
writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous 
namespace)::RtfFilter::filter(com::sun::star::uno::Sequence
 const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, 
com::sun::star::uno::Reference const&) at 
sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at 
sfx2/source/doc/objstor.cxx:760:23
   #23 in 
SfxBaseModel::load(com::sun::star::uno::Sequence
 const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 in (anonymous 
namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence
 const&, com::sun::star::uno::Reference const&) 
at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at 
framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at 
framework/source/loadenv/loadenv.cxx:412:20
   #27 in framework::LoadEnv::startLoading(rtl::OUString const&, 
com::sun::star::uno::Sequence const&, 
com::sun::star::uno::Reference const&, 
rtl::OUString const&, int, LoadEnvFeatures) at 
framework/source/loadenv/loadenv.cxx:308:5
   #28 in 
framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference
 const&, com::sun::star::uno::Reference 
const&, rtl::OUString const&, rtl::OUString const&, int, 
com::sun::star::uno::Sequence const&) at 
framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, 
rtl::OUString const&, int, 
com::sun::star::uno::Sequence const&) at 
framework/source/services/desktop.cxx:591:16
   #30 in non-virtual thunk to 
framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString 
const&, int, 
com::sun::star::uno::Sequence const&) at 
framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, 

core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-08 Thread Aron Budea (via logerrit)
 vcl/source/gdi/sallayout.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit beff8cb9344f13ddbcdc667ad6b73d2d405fa21d
Author: Aron Budea 
AuthorDate: Sat Apr 6 22:48:07 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon Apr 8 16:55:48 2024 +0200

tdf#160342 Unwanted space before end of line when printing

Also adjust some numeric literals to reflect they're
floating point values in the expressions.

Regression from 172b500ccbc8dac0496cc2936a9bcca793c0b594.

Change-Id: I8281ba7c7d480135471ba94b11d447d76fd33063
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165860
Tested-by: Jenkins
Reviewed-by: Aron Budea 
(cherry picked from commit 357f07bfd96da6cca87fcf0ef339495c2fea6937)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165836
Reviewed-by: خالد حسني 
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index af281127ba86..d052ab53221b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -292,7 +292,7 @@ void GenericSalLayout::Justify(double nNewWidth)
 std::vector::iterator pGlyphIter;
 // count stretchable glyphs
 int nStretchable = 0;
-double nMaxGlyphWidth = 0;
+double nMaxGlyphWidth = 0.0;
 for(pGlyphIter = m_GlyphItems.begin(); pGlyphIter != pGlyphIterRight; 
++pGlyphIter)
 {
 if( !pGlyphIter->IsInCluster() )
@@ -303,7 +303,7 @@ void GenericSalLayout::Justify(double nNewWidth)
 
 // move rightmost glyph to requested position
 nOldWidth -= pGlyphIterRight->origWidth();
-if( nOldWidth <= 0 )
+if( nOldWidth <= 0.0 )
 return;
 if( nNewWidth < nMaxGlyphWidth)
 nNewWidth = nMaxGlyphWidth;
@@ -312,10 +312,10 @@ void GenericSalLayout::Justify(double nNewWidth)
 
 // justify glyph widths and positions
 double nDiffWidth = nNewWidth - nOldWidth;
-if( nDiffWidth >= 0) // expanded case
+if( nDiffWidth >= 0.0 ) // expanded case
 {
 // expand width by distributing space between glyphs evenly
-int nDeltaSum = 0;
+double nDeltaSum = 0.0;
 for( pGlyphIter = m_GlyphItems.begin(); pGlyphIter != pGlyphIterRight; 
++pGlyphIter )
 {
 // move glyph to justified position


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-04 Thread Caolán McNamara (via logerrit)
 vcl/source/window/legacyaccessibility.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b2a2b4b3093aaba9dd44819f7b8b3ac12f262a19
Author: Caolán McNamara 
AuthorDate: Tue Mar 26 15:38:51 2024 +
Commit: Michael Stahl 
CommitDate: Thu Apr 4 11:15:13 2024 +0200

crash on deref null parent on attempting to find label

ImplFindDlgCtrlWindow always calls ImplGetChildWindow with first arg

which does

pParent = ImplGetTopParentOfTabHierarchy( pParent );
vcl::Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex );

ImplGetSubChildWindow always derefs its first arg and
ImplGetTopParentOfTabHierarchy only returns null if its input was null
so ImplFindDlgCtrlWindow shouldn't be called with null

program/libmergedlo.so(_ZNK3vcl6Window13ImplGetWindowEv+0x4)[0x7513e2a40e54]
program/libmergedlo.so(+0x33ba57c)[0x7513e29ba57c]
program/libmergedlo.so(+0x33ba97c)[0x7513e29ba97c]
program/libmergedlo.so(+0x33baf64)[0x7513e29baf64]
program/libmergedlo.so(+0x3378d47)[0x7513e2978d47]

program/libmergedlo.so(_ZNK3vcl6Window30GetAccessibleRelationLabeledByEv+0x19c)[0x7513e297866c]

program/libmergedlo.so(_ZN3vcl6Window18DumpAsPropertyTreeERN5tools10JsonWriterE+0x241)[0x7513e2a4b301]

program/libmergedlo.so(_ZN6Dialog18DumpAsPropertyTreeERN5tools10JsonWriterE+0x2e)[0x7513e29b217e]

program/libmergedlo.so(_ZN3vcl6Window18DumpAsPropertyTreeERN5tools10JsonWriterE+0x182)[0x7513e2a4b242]

program/libmergedlo.so(_ZN3vcl3lok9dumpStateERN3rtl13OStringBufferE+0xc0)[0x7513e2d6ee80]

Change-Id: I732550bd67c3af38627849a7d96d8ee6140008b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165314
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 23b72488140e7e2031e0071718d55d2b9e1c2bef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165321
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/window/legacyaccessibility.cxx 
b/vcl/source/window/legacyaccessibility.cxx
index 346e1fdc8f2a..a0f4aff33919 100644
--- a/vcl/source/window/legacyaccessibility.cxx
+++ b/vcl/source/window/legacyaccessibility.cxx
@@ -109,7 +109,7 @@ Window* 
Window::getLegacyNonLayoutAccessibleRelationLabelFor() const
 static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, 
Window* pLabeled )
 {
 Window* pWindow = nullptr;
-if ( (nMyType != WindowType::GROUPBOX) && (nMyType != 
WindowType::FIXEDLINE) )
+if (pFrameWindow && nMyType != WindowType::GROUPBOX && nMyType != 
WindowType::FIXEDLINE)
 {
 // search for a control that labels this window
 // a label is considered the last fixed text, fixed line or group box


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-03-31 Thread Caolán McNamara (via logerrit)
 vcl/source/treelist/iconviewimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 57428bfc71762687594c3c0fa62cdff391dda3f9
Author: Caolán McNamara 
AuthorDate: Sat Mar 30 21:25:51 2024 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Mar 31 20:46:35 2024 +0200

Resolves: tdf#157587 IconView scoll range not updated

IconView::SetUpdateMode(true) doesn't update the scroll
range for any changes that might have taken place while
updates were suspended.

The similar SvImpLBox::UpdateAll() for "normal" lists
does this update, so do the equivalent update here too.

Noticeable since:

commit 666925f2ab06e690c41c470713dc83f2d752bfb7
Date:   Sat Jun 3 15:23:15 2023 +0100

perf: use freeze/thaw around block insert of multiple icons

Change-Id: I318fc4509c6906161eabf3b312f311cb97ac063a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165485
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/treelist/iconviewimpl.cxx 
b/vcl/source/treelist/iconviewimpl.cxx
index 048e193d4f4b..35025d1c81f4 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -467,6 +467,7 @@ void IconViewImpl::SyncVerThumb()
 void IconViewImpl::UpdateAll()
 {
 FindMostRight();
+AdjustScrollBars(m_aOutputSize);
 SyncVerThumb();
 FillView();
 ShowVerSBar();


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-03-27 Thread Caolán McNamara (via logerrit)
 vcl/source/window/printdlg.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d3ed3836cbec932f8a381fcb2c85787fb0f8b766
Author: Caolán McNamara 
AuthorDate: Wed Mar 27 17:23:18 2024 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Mar 28 05:42:32 2024 +0100

Resolves: tdf#160392 preview's measurement are black on dark bg in dark mode

Change-Id: I538750ef7d20ecc17a60ce47989eeaf0390a0103
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165414
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 9c5f519f7cfb..c001b6e74070 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -122,7 +122,7 @@ void 
PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext,
 {
 rRenderContext.Push();
 weld::SetPointFont(rRenderContext, 
rRenderContext.GetSettings().GetStyleSettings().GetLabelFont());
-
+
rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetLabelTextColor());
 
rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor()));
 rRenderContext.Erase();
 


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-03-07 Thread Patrick Luby (via logerrit)
 vcl/source/window/paint.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 358eee88dd0af37ffc83c3abd9633593b758a5be
Author: Patrick Luby 
AuthorDate: Thu Mar 7 17:22:35 2024 -0500
Commit: Noel Grandin 
CommitDate: Fri Mar 8 07:05:50 2024 +0100

tdf#159996 use transparent alpha mask for output device

Since commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, fixed text
needs to be drawn to an output device with a transparent alpha
mask.

Change-Id: I2036e8c6c9133b1caceb24aeca40f04524c16b23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164556
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 73c14fcf97a1dcc9c95c98f9223449957b0b4963)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164499
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index a98703ca255b..deb4bc33 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1523,7 +1523,7 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 VclPtrInstance pMaskedDevice(*i_pTargetOutDev,
 DeviceFormat::WITH_ALPHA);
 
-pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
+pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel(), true, true );
 pMaskedDevice->EnableRTL( IsRTLEnabled() );
 aMtf.WindStart();
 aMtf.Play(*pMaskedDevice);


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-02-13 Thread Mike Kaganski (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6d87919d0e3a3e0c5febda19cd30da73813f0965
Author: Mike Kaganski 
AuthorDate: Mon Feb 12 12:50:05 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 13 10:19:32 2024 +0100

tdf#159689: trailing newline before "endstream" must not count in Length

Change-Id: Ic1e636c9d4e5a531113f26e147427fb75ce3591c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163185
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 5121c1f8a3dc1e326a4195393f463f5c0383859b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163281
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index c7ef07ff49cb..a5365e681b3b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2775,7 +2775,7 @@ bool PDFWriterImpl::emitType3Font(const 
vcl::font::PhysicalFontFace* pFace,
 aLine.setLength(0);
 aLine.append(OString::number(nStream)
 + " 0 obj
<>
stream
");
 if (!writeBuffer(aLine))
 return false;


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-02-09 Thread Noel Grandin (via logerrit)
 vcl/source/treelist/svimpbox.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 6b7a23022a4d2471df7b458f3ac61c8b768ea896
Author: Noel Grandin 
AuthorDate: Fri Feb 9 10:55:18 2024 +0200
Commit: Christian Lohmaier 
CommitDate: Fri Feb 9 15:55:28 2024 +0100

tdf#159641 TreeView repaint problem with PgUp in kf5/gen

regression from
commit be53f32655973c7a18824d5145eed992be788d2f
Author: Noel Grandin 
Date:   Thu Mar 12 13:55:55 2020 +0200
rename vcl::Window::Update to PaintImmediately

Change-Id: I74fc87e984e1f085d2351cbae033e51920608e3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163154
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit 30fb8cde7579fb5da15c1d8da9611198f2f5ce78)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163149
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 0deea8f69820..66c697e8afd8 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -387,6 +387,7 @@ void SvImpLBox::PageDown( sal_uInt16 nDelta )
 ShowCursor( false );
 
 m_nFlags &= ~LBoxFlags::Filling;
+m_pView->PaintImmediately();
 m_pStartEntry = pNext;
 
 if( nRealDelta >= m_nVisibleCount )
@@ -424,6 +425,7 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta )
 m_nFlags &= ~LBoxFlags::Filling;
 ShowCursor( false );
 
+m_pView->PaintImmediately();
 m_pStartEntry = pPrev;
 if( nRealDelta >= m_nVisibleCount )
 {


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-01-14 Thread Patrick Luby (via logerrit)
 vcl/source/app/salvtables.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 753981dd0cbbdedeca4fa95681f6d65d370a758f
Author: Patrick Luby 
AuthorDate: Wed Jan 10 19:30:17 2024 -0500
Commit: Michael Weghorn 
CommitDate: Sun Jan 14 20:22:24 2024 +0100

tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`

rather than waiting for `m_xDrawingArea` to get disposed, to prevent
unsafe use of the now potentially non-functional accessible until it
gets disposed with the VclDrawingArea

Change-Id: I5b8720ac4d5ed41cb1775b0142b17d198e9f036d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161903
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 244bd399732017615bab2c34c2b29d6a80d27ae9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162006
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 17e6435c3fc2..95beb907f6c0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6340,6 +6340,19 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea()
 m_xDrawingArea->SetResizeHdl(Link());
 m_xDrawingArea->SetPaintHdl(
 Link, void>());
+
+// tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
+// rather than waiting for `m_xDrawingArea` to get disposed, to prevent
+// unsafe use of the now potentially non-functional accessible until it
+// gets disposed with the VclDrawingArea
+css::uno::Reference xAccessible
+= m_xDrawingArea->GetAccessible();
+css::uno::Reference xComp(xAccessible, 
css::uno::UNO_QUERY);
+if (xComp.is())
+{
+xComp->dispose();
+m_xDrawingArea->SetAccessible(nullptr);
+}
 }
 
 OutputDevice& SalInstanceDrawingArea::get_ref_device() { return 
*m_xDrawingArea->GetOutDev(); }


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-01-08 Thread Samuel Mehrbrodt (via logerrit)
 vcl/source/window/dlgctrl.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 7c7507e9319e65f7e9a16cbb66ffdea859403d19
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jan 8 13:58:03 2024 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jan 8 17:45:55 2024 +0100

tdf#157649 Allow omitting Alt key in Windows only

Follow-up for ea1421747985bd09ad40565da8536e857b5c2e9a

Change-Id: Ifdfeb8a0a9507f66af26607efc31438169452b46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161787
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 90cdf353f8c0..ac75333d9011 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -952,9 +952,13 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool 
bKeyInput )
 GetFocusFlags nGetFocusFlags = GetFocusFlags::Mnemonic;
 if ( pSWindow == ::ImplFindAccelWindow( this, i, c, 
nFormStart, nFormEnd ) )
 nGetFocusFlags |= GetFocusFlags::UniqueMnemonic;
+#ifdef _WIN32
 // tdf#157649 Allow omitting the Alt key when focus is in 
the dialog action area:
 bool bIsButtonBox = 
dynamic_cast(pSWindow->GetParent()) != nullptr;
 if ((bIsButtonBox && 
pSWindow->GetParent()->HasChildPathFocus(true)) || aKeyCode.IsMod2())
+#else
+if (aKeyCode.IsMod2())
+#endif
 {
 pSWindow->ImplControlFocus( nGetFocusFlags );
 return true;


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-01-08 Thread Samuel Mehrbrodt (via logerrit)
 vcl/source/window/dlgctrl.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit aaefd2080ecb39a3deade23368a83acee91367ef
Author: Samuel Mehrbrodt 
AuthorDate: Fri Dec 22 09:25:53 2023 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jan 8 17:45:48 2024 +0100

tdf#157649 Allow omitting Alt key when focus is in dialog action area

Adapt to usual Windows experience: Allow triggering the Ok, Cancel, etc
buttons in the dialog action area without pressing the Alt key - when
the focus is in that area (and the accelerator is unique in that dialog).

Change-Id: I85b544867cf5507a15240b2972a26a1c248c4f82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161146
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit ea1421747985bd09ad40565da8536e857b5c2e9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161568

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index adf416b21769..90cdf353f8c0 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -941,7 +941,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool 
bKeyInput )
 }
 }
 }
-else if (aKeyCode.IsMod2()) // tdf#151385
+else
 {
 sal_Unicode c = rKEvt.GetCharCode();
 if ( c )
@@ -952,8 +952,13 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool 
bKeyInput )
 GetFocusFlags nGetFocusFlags = GetFocusFlags::Mnemonic;
 if ( pSWindow == ::ImplFindAccelWindow( this, i, c, 
nFormStart, nFormEnd ) )
 nGetFocusFlags |= GetFocusFlags::UniqueMnemonic;
-pSWindow->ImplControlFocus( nGetFocusFlags );
-return true;
+// tdf#157649 Allow omitting the Alt key when focus is in 
the dialog action area:
+bool bIsButtonBox = 
dynamic_cast(pSWindow->GetParent()) != nullptr;
+if ((bIsButtonBox && 
pSWindow->GetParent()->HasChildPathFocus(true)) || aKeyCode.IsMod2())
+{
+pSWindow->ImplControlFocus( nGetFocusFlags );
+return true;
+}
 }
 }
 }


core.git: Branch 'libreoffice-24-2' - vcl/source

2023-12-24 Thread Patrick Luby (via logerrit)
 vcl/source/control/InterimItemWindow.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 656a18c236d9d60d31fe74a05710f3fff5e05c99
Author: Patrick Luby 
AuthorDate: Sun Dec 24 16:43:54 2023 -0500
Commit: Michael Weghorn 
CommitDate: Mon Dec 25 00:42:22 2023 +0100

Eliminate warning when changing timer's priority

Task::SetPriority() expects the timer to be stopped while
changing the timer's priority.

Change-Id: Ib025cc1451bf6fa959284d202d29dbb1489beb0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161272
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit c6a7432b6240f2de7af3b8321c427a4da8b5cab3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161227
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/control/InterimItemWindow.cxx 
b/vcl/source/control/InterimItemWindow.cxx
index 697f78759933..0769245eb477 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -189,7 +189,15 @@ void InterimItemWindow::Draw(OutputDevice* pDevice, const 
Point& rPos,
 
 void InterimItemWindow::SetPriority(TaskPriority nPriority)
 {
+// Eliminate warning when changing timer's priority
+// Task::SetPriority() expects the timer to be stopped while
+// changing the timer's priority.
+bool bActive = m_aLayoutIdle.IsActive();
+if (bActive)
+m_aLayoutIdle.Stop();
 m_aLayoutIdle.SetPriority(nPriority);
+if (bActive)
+m_aLayoutIdle.Start();
 }
 
 void InterimItemWindow::ImplPaintToDevice(::OutputDevice* pTargetOutDev, const 
Point& rPos)


core.git: Branch 'libreoffice-24-2' - vcl/source

2023-12-24 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/bitmappaint.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit df08a291c4aea3e777f786c65048b03b4a13dbdb
Author: Patrick Luby 
AuthorDate: Sat Dec 23 17:25:54 2023 -0500
Commit: Noel Grandin 
CommitDate: Sun Dec 24 16:59:13 2023 +0100

tdf#158807 Call UpdatePaletteForNewColor with rReplaceColor parameter

Change-Id: Id9d55600c69e84f7d7ffdd9cfbf4e1b3985b79c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161260
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit 0e788111f13992f8323d691f2daf98e43cc7bdf8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161224

diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index fa1e8486c2e3..cc3674ad3123 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -919,8 +919,8 @@ bool Bitmap::ReplaceMask(const AlphaMask& rMask, const 
Color& rReplaceColor)
 const sal_uInt16 nActColors = pAcc->GetPaletteEntryCount();
 const sal_uInt16 nMaxColors = 1 << pAcc->GetBitCount();
 
-aReplace
-= UpdatePaletteForNewColor(pAcc, nActColors, nMaxColors, nHeight, 
nWidth, aReplace);
+aReplace = UpdatePaletteForNewColor(pAcc, nActColors, nMaxColors, 
nHeight, nWidth,
+BitmapColor(rReplaceColor));
 }
 else
 aReplace = rReplaceColor;


core.git: Branch 'libreoffice-24-2' - vcl/source

2023-12-11 Thread Michael Weghorn (via logerrit)
 vcl/source/control/listbox.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit b0b5ae68cbc95990ad72653212005ef89d7f3ea3
Author: Michael Weghorn 
AuthorDate: Fri Dec 8 11:50:40 2023 +0100
Commit: Michael Weghorn 
CommitDate: Tue Dec 12 08:16:51 2023 +0100

tdf#158548 vcl: Require mouse over listbox to mouse-wheel through entries

As described in tdf#158548, it's unexpected that listbox/
combobox entries change when using the mouse wheel while the
listbox/combobox has keyboard focus, but the mouse cursor
is positioned somewhere else

Therefore, only do that for the VCL ListBox when the mouse cursor
is currently positioned above it, which also matches what
e.g. native Qt applications do.
(When using the gtk3 VCL plugin that uses a native GtkComboBox,
nothing changes on scroll independent of the position.)

Change-Id: I8a69628471c1cd4258194627b95145d6b8fb686a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160459
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 22250df05830700b2555348b8ac46ee1007d0e5d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160583

diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 7e87ae390185..e189c8480f05 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -867,12 +867,14 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt )
   (rNEvt.GetCommandEvent()->GetCommand() == 
CommandEventId::Wheel) &&
   (rNEvt.GetWindow() == mpImplWin) )
 {
+const Point& rMousePos = 
rNEvt.GetCommandEvent()->GetMousePosPixel();
+const tools::Rectangle aWinRect(mpImplWin->GetPosPixel(), 
mpImplWin->GetSizePixel());
+const bool bMousePositionedOverWin = aWinRect.Contains(rMousePos);
+
 MouseWheelBehaviour nWheelBehavior( 
GetSettings().GetMouseSettings().GetWheelBehavior() );
-if  (   ( nWheelBehavior == MouseWheelBehaviour::ALWAYS )
-||  (   ( nWheelBehavior == MouseWheelBehaviour::FocusOnly )
-&&  HasChildPathFocus()
-)
-)
+if (bMousePositionedOverWin
+&& ((nWheelBehavior == MouseWheelBehaviour::ALWAYS)
+|| ((nWheelBehavior == MouseWheelBehaviour::FocusOnly) && 
HasChildPathFocus(
 {
 bDone = 
mpImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
 }