[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - 2 commits - configure.ac external/libffi external/python3 RepositoryExternal.mk

2023-08-02 Thread Jan-Marek Glogowski (via logerrit)
 RepositoryExternal.mk   |1 
 configure.ac|2 -
 external/libffi/ExternalProject_libffi.mk   |   29 ++--
 external/libffi/Module_libffi.mk|1 
 external/python3/ExternalProject_python3.mk |2 -
 5 files changed, 27 insertions(+), 8 deletions(-)

New commits:
commit 5c20dd294119daa1cd87d9b8da8984ee76dc7dab
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 7 15:15:58 2021 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Aug 2 15:29:54 2023 +0200

tdf#140236 WIN install libffi with Python

Regression from commit b4dfba947768834ffecc09056992019878711c8b
("python3: update to 3.8.4"). Previous Python versions included
the source for libffi on all platforms, but now just for MacOS.
So now LO must build that DLL on Windows, which was done in
commit 883068462fe5bcbb01a8e14736fc06d0c3695c62 ("libffi: build
DLL on Windows").

Since OpenSSL is installed in the program directory and the LO
Python directory, this currently works "accidentially". Not sure
the Python OpenSSL DLLs should be handled via some extra gbuild
package to separate both, but that can be done in an additional
change.

Change-Id: I4a42e39cc2f4434a9944aad32836f66ec2819931
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110537
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index f43f8acf2f1e..4d7b30a24b0f 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3175,6 +3175,7 @@ else # !SYSTEM_PYTHON
 
 $(eval $(call gb_Helper_register_packages_for_install,python,\
python3 \
+$(if $(filter WNT,$(OS)),libffi) \
 ))
 
 define gb_LinkTarget__use_python_headers
commit 62db67b07d1f8fc32cabf1b3b0b4e7e34a6eb4d6
Author: Jan-Marek Glogowski 
AuthorDate: Tue Jul 14 23:20:06 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Aug 2 14:40:58 2023 +0200

libffi: build DLL on Windows

The build setup is rather horrible, with some minimal gcc MSVC
wrapper. But the DLL is a prerequisite for the Python 3.8 build,
which dropped the internal libffi.

It's also possible to build it statically, but then you have to
patch the Python 3 _ctypes msbuild properties.

This also defaults to explicit --build and --host settings, even
without a cross build, because the predicted name would otherwise
differ (*-unknown-* instead of *-pc-*).

Additionally a "make install" also fails...

Change-Id: Ifb7dac840e23efffb9a5e342560aef9e11e0db79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98436
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/configure.ac b/configure.ac
index 85ea8ecfc58c..1b71847401b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8756,7 +8756,7 @@ internal)
 fi
 AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
 BUILD_TYPE="$BUILD_TYPE PYTHON"
-if test "$OS" = LINUX; then
+if test "$OS" = LINUX -o "$OS" = WNT ; then
 BUILD_TYPE="$BUILD_TYPE LIBFFI"
 fi
 # Embedded Python dies without Home set
diff --git a/external/libffi/ExternalProject_libffi.mk 
b/external/libffi/ExternalProject_libffi.mk
index bdf8fe61eb76..0ff625ea3e20 100644
--- a/external/libffi/ExternalProject_libffi.mk
+++ b/external/libffi/ExternalProject_libffi.mk
@@ -14,17 +14,34 @@ $(eval $(call gb_ExternalProject_register_targets,libffi,\
 ))
 
 # set prefix so that it ends up in libffi.pc so that pkg-config in python3 
works
+# For a static Windows build, change CPPFLAGS to include -D_LIB and 
--disable-static
+# Also remove the ExternalPackage in that case
+
+libffi_WIN_PLATFORM := $(strip \
+$(if $(filter INTEL,$(CPUNAME)),32) \
+$(if $(filter X86_64,$(CPUNAME)),64) \
+$(if $(filter ARM64,$(CPUNAME)),arm64) \
+)
 
 $(call gb_ExternalProject_get_state_target,libffi,build):
$(call gb_ExternalProject_run,build,\
+   export LIB="$(ILIB)" && \
./configure \
--enable-option-checking=fatal \
-   $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) 
--host=$(HOST_PLATFORM)) \
-   --enable-static \
-   --disable-shared \
-   --with-pic \
-   --enable-portable-binary \
-   CC="$(CC) $(if $(filter 
LINUX,$(OS)),-fvisibility=hidden)" \
+   --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+   $(if $(filter LINUX,$(OS)), \
+   --disable-shared \
+   CC="$(CC) -fvisibility=hidden" \
+   --with-pic \
+   --enable-portable-binary) \
+   $(if $(filter WNT,$(OS)), \
+   --disable-static \
+   

[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - solenv/clang-format vcl/Library_vclplug_win.mk vcl/win

2022-11-24 Thread Jan-Marek Glogowski (via logerrit)
 solenv/clang-format/blacklist   |4 
 vcl/Library_vclplug_win.mk  |1 
 vcl/win/dtrans/WinClipbImpl.cxx |  210 --
 vcl/win/dtrans/WinClipbImpl.hxx |  106 -
 vcl/win/dtrans/WinClipboard.cxx |  365 
 vcl/win/dtrans/WinClipboard.hxx |   94 
 vcl/win/dtrans/XNotifyingDataObject.cxx |7 
 vcl/win/dtrans/XNotifyingDataObject.hxx |   11 
 8 files changed, 289 insertions(+), 509 deletions(-)

New commits:
commit 65f799543f6c91f596aacaf5840ed537d5997e1a
Author: Jan-Marek Glogowski 
AuthorDate: Mon Sep 21 20:12:48 2020 +0200
Commit: Balazs Varga 
CommitDate: Thu Nov 24 12:26:03 2022 +0100

WIN merge CWinClipbImpl into CWinClipboard

Get rid of the already minimal pImpl.

Change-Id: Ida6fedab6e779b649e546bae2cda5f14fd4090d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103211
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143175
Tested-by: Balazs Varga 
Reviewed-by: Balazs Varga 

diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 57ff18204d53..fd1e190ed427 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -18145,10 +18145,6 @@ vcl/win/dtrans/target.hxx
 vcl/win/dtrans/TxtCnvtHlp.cxx
 vcl/win/dtrans/TxtCnvtHlp.hxx
 vcl/win/dtrans/wcbentry.cxx
-vcl/win/dtrans/WinClipbImpl.cxx
-vcl/win/dtrans/WinClipbImpl.hxx
-vcl/win/dtrans/WinClipboard.cxx
-vcl/win/dtrans/WinClipboard.hxx
 vcl/win/dtrans/XNotifyingDataObject.cxx
 vcl/win/dtrans/XNotifyingDataObject.hxx
 vcl/win/dtrans/XTDataObject.cxx
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index a80b5abf6b5a..f0e48cd77ad3 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_win,\
 vcl/win/dtrans/targetdragcontext \
 vcl/win/dtrans/targetdropcontext \
 vcl/win/dtrans/TxtCnvtHlp \
-vcl/win/dtrans/WinClipbImpl \
 vcl/win/dtrans/WinClipboard \
 vcl/win/dtrans/XNotifyingDataObject \
 vcl/win/dtrans/XTDataObject \
diff --git a/vcl/win/dtrans/WinClipbImpl.cxx b/vcl/win/dtrans/WinClipbImpl.cxx
deleted file mode 100644
index 0a3e5808e437..
--- a/vcl/win/dtrans/WinClipbImpl.cxx
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include 
-#include "WinClipbImpl.hxx"
-
-#include 
-#include "DtObjFactory.hxx"
-#include "APNDataObject.hxx"
-#include "DOTransferable.hxx"
-#include "WinClipboard.hxx"
-#include 
-#include "XNotifyingDataObject.hxx"
-
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include 
-#include 
-#include 
-
-using namespace osl;
-using namespace std;
-using namespace cppu;
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::datatransfer;
-using namespace com::sun::star::datatransfer::clipboard;
-using namespace com::sun::star::datatransfer::clipboard::RenderingCapabilities;
-
-// definition of static members
-CWinClipbImpl* CWinClipbImpl::s_pCWinClipbImpl = nullptr;
-osl::Mutex CWinClipbImpl::s_aMutex;
-
-CWinClipbImpl::CWinClipbImpl( const OUString& aClipboardName, CWinClipboard* 
theWinClipboard ) :
-m_itsName( aClipboardName ),
-m_pWinClipboard( theWinClipboard ),
-m_pCurrentClipContent( nullptr )
-{
-OSL_ASSERT( nullptr != m_pWinClipboard );
-
-// necessary to reassociate from
-// the static callback function
-s_pCWinClipbImpl = this;
-registerClipboardViewer( );
-}
-
-CWinClipbImpl::~CWinClipbImpl( )
-{
-{
-MutexGuard aGuard(s_aMutex);
-s_pCWinClipbImpl = nullptr;
-}
-
-unregisterClipboardViewer( );
-}
-
-Reference< XTransferable > CWinClipbImpl::getContents( )
-{
-// use the shortcut or create a transferable from
-// system clipboard
-{
-MutexGuard aGuard(m_ClipContentMutex);
-
-if (nullptr != m_pCurrentClipContent)
-{
-return m_pCurrentClipContent->m_XTransferable;
-  

[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - dtrans/Library_dnd.mk dtrans/Library_dtrans.mk dtrans/Library_ftransl.mk dtrans/Library_sysdtrans.mk dtrans/Module_dtrans.mk dtran

2022-11-24 Thread Jan-Marek Glogowski (via logerrit)
 Repository.mk   |4 
 dtrans/Library_dnd.mk   |   60 
 dtrans/Library_dtrans.mk|   37 ---
 dtrans/Library_ftransl.mk   |   52 --
 dtrans/Library_sysdtrans.mk |   52 --
 dtrans/Module_dtrans.mk |   10 --
 dtrans/README   |4 
 dtrans/StaticLibrary_dtobj.mk   |   44 
 dtrans/source/win32/clipb/APNDataObject.hxx |   72 --
 dtrans/util/dnd.component   |   30 --
 dtrans/util/ftransl.component   |   26 -
 dtrans/util/sysdtrans.component |   26 -
 postprocess/Rdb_services.mk |5 -
 solenv/clang-format/blacklist   |  140 +---
 starmath/CppunitTest_starmath_qa_cppunit.mk |8 -
 vcl/Library_vclplug_win.mk  |   35 ++-
 vcl/vclplug_win.component   |   22 +++-
 vcl/win/dtrans/APNDataObject.hxx|5 +
 vcl/win/dtrans/DOTransferable.cxx   |4 
 vcl/win/dtrans/DTransHelper.hxx |2 
 vcl/win/dtrans/DataFmtTransl.cxx|4 
 vcl/win/dtrans/DtObjFactory.cxx |3 
 vcl/win/dtrans/Fetc.cxx |2 
 vcl/win/dtrans/FetcList.cxx |4 
 vcl/win/dtrans/MtaOleClipb.cxx  |   15 +--
 vcl/win/dtrans/TxtCnvtHlp.cxx   |3 
 vcl/win/dtrans/WinClipbImpl.cxx |8 -
 vcl/win/dtrans/XNotifyingDataObject.cxx |4 
 vcl/win/dtrans/XTDataObject.cxx |2 
 vcl/win/dtrans/ftransl.cxx  |2 
 vcl/win/dtrans/ftransl.hxx  |2 
 vcl/win/dtrans/source.cxx   |3 
 vcl/win/dtrans/target.cxx   |2 
 33 files changed, 163 insertions(+), 529 deletions(-)

New commits:
commit 06d0b2b32ad2e5aff718a87c2acc59021139c9b5
Author: Jan-Marek Glogowski 
AuthorDate: Tue Sep 22 13:23:00 2020 +0200
Commit: Balazs Varga 
CommitDate: Thu Nov 24 12:25:05 2022 +0100

WIN move dtrans code into vcl/win/dtrans

There is nothing abstract about either the clipboard or data
transfer code in that directory and it's just used on Windows.

All other backends implement this code in VCL, so this moves
almost all code, except for the common MimeContentTypeFactory,
into the vcl Windows backend / vclplug_win.

This also drops four DLLs: sysdtrans, dnd, dtrans and ftransl.

Change-Id: I7018f50768bf221447b40487cc1f8a8586da33c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103209
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143174
Tested-by: Balazs Varga 
Reviewed-by: Balazs Varga 

diff --git a/Repository.mk b/Repository.mk
index 6d468833eaf6..8175a7ceb8f5 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -619,7 +619,6 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
sdbc2 \
sofficeapp \
srtrs1 \
-   $(if $(filter $(OS),WNT),sysdtrans) \
textconv_dict \
ucb1 \
ucbhelper \
@@ -638,10 +637,7 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
macabdrv1 \
) \
$(if $(filter WNT,$(OS)), \
-   dnd \
-   dtrans \
fps \
-   ftransl \
inprocserv \
UAccCOM \
winaccessibility \
diff --git a/dtrans/Library_dnd.mk b/dtrans/Library_dnd.mk
deleted file mode 100644
index 930b552827e1..
--- a/dtrans/Library_dnd.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the "License"); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Library_Library,dnd))
-
-$(eval $(call gb_Library_set_componentfile,dnd,dtrans/util/dnd))
-
-$(eval $(call gb_Library_use_externals,dnd, \
-boost_headers \
-))
-
-$(eval $(call gb_Library_use_sdk_api,dnd))
-
-$(eval $(call gb_Library_use_libraries,dnd,\
-   comphelper \
-   cppu \

[Libreoffice-commits] core.git: Branch 'feature/cib_contract891c' - sw/inc sw/source

2022-11-14 Thread Jan-Marek Glogowski (via logerrit)
 sw/inc/IDocumentTimerAccess.hxx |   40 ++--
 sw/source/core/doc/DocumentTimerManager.cxx |   20 +++---
 sw/source/core/inc/DocumentTimerManager.hxx |3 --
 sw/source/core/inc/docfld.hxx   |2 -
 sw/source/core/inc/rootfrm.hxx  |4 +-
 5 files changed, 35 insertions(+), 34 deletions(-)

New commits:
commit d24d40f8f22d64cecbb707a930caed1da96d2dce
Author: Jan-Marek Glogowski 
AuthorDate: Fri Aug 17 23:10:00 2018 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Nov 14 09:23:23 2022 +0100

tdf#116370 cleanup Writer idle job handing

This prevents the start of the idle job, while processing itself,
so the fixed WinSalInstance::AnyInput of commit 3bf6c97029d2
("tdf#112975 WIN correctly handle VclInputFlags::OTHER") won't
report the timer events of the re-started idle job to process.

Fixes the early abort of the background job, which resulted in
the busy loop of the reported bug and this strange printing
behaviour.

P.S. I'm not sure, why this was just broken on Windows.

Reviewed-on: https://gerrit.libreoffice.org/59279
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 401cba4c20fbc930f034168872642428d7459218)

Change-Id: I6503dcd925c9a0ed843e794a31eea32a4a4b2889

diff --git a/sw/inc/IDocumentTimerAccess.hxx b/sw/inc/IDocumentTimerAccess.hxx
index 2cdb33e5ab7d..d28e2ef9b1a3 100644
--- a/sw/inc/IDocumentTimerAccess.hxx
+++ b/sw/inc/IDocumentTimerAccess.hxx
@@ -20,41 +20,43 @@
 #ifndef INCLUDED_SW_INC_IDOCUMENTTIMERACCESS_HXX
 #define INCLUDED_SW_INC_IDOCUMENTTIMERACCESS_HXX
 
-/** Manipulate background jobs of the document. It starts with a mode of
- 'started' and a block count of 0.
+/**
+ * Handle the background job of the Writer document.
+ *
+ * Initially it's disabled and unblocked.
+ *
+ * Jobs include:
+ *  * grammar checking
+ *  * field updating
+ *  * document layouting
  */
 class IDocumentTimerAccess
 {
 public:
 /**
-Set modus to 'start'.
-*/
+ * Start the idle job depending on the block count.
+ */
 virtual void StartIdling() = 0;
 
 /**
-Set mode to 'stopped'.
-*/
+ * Stop idle processing.
+ */
 virtual void StopIdling() = 0;
 
 /**
-Increment block count.
-*/
+ * Increment block count.
+ *
+ * Prevents further background idle processing.
+ */
 virtual void BlockIdling() = 0;
 
 /**
-Decrement block count.
-*/
+ * Decrement block count.
+ *
+ * May start the idle job.
+ */
 virtual void UnblockIdling() = 0;
 
-/**
-Do these jobs asynchronously: do grammar checking,
-do layout, and update fields.
-They will be delayed until mode is start AND block count == 0.
-The implementation might delay them further, for example
-it might wait until the application is idle.
-*/
-virtual void StartBackgroundJobs() = 0;
-
 protected:
 virtual ~IDocumentTimerAccess() {};
 };
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx 
b/sw/source/core/doc/DocumentTimerManager.cxx
index 83ce6fe2dce9..652672859203 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -49,9 +49,13 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc 
) : m_rDoc( i_rSwdoc
 
 void DocumentTimerManager::StartIdling()
 {
-mbStartIdleTimer = true;
-if( !mIdleBlockCount )
+if( !mIdleBlockCount && !maIdle.IsActive() )
+{
+mbStartIdleTimer = false;
 maIdle.Start();
+}
+else
+mbStartIdleTimer = true;
 }
 
 void DocumentTimerManager::StopIdling()
@@ -70,14 +74,10 @@ void DocumentTimerManager::UnblockIdling()
 {
 --mIdleBlockCount;
 if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() )
+{
+mbStartIdleTimer = false;
 maIdle.Start();
-}
-
-void DocumentTimerManager::StartBackgroundJobs()
-{
-// Trigger DoIdleJobs(), asynchronously.
-if (!maIdle.IsActive()) //fdo#73165 if the timer is already running don't 
restart from 0
-maIdle.Start();
+}
 }
 
 IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
@@ -87,6 +87,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, 
void )
 if( !pModLogFile )
 pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
 #endif
+BlockIdling();
 
 SwRootFrame* pTmpRoot = 
m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
 if( pTmpRoot &&
@@ -163,6 +164,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, 
void )
 
m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty( false );
 }
 }
+
 #ifdef TIMELOG
 if( pModLogFile && 1 != (long)pModLogFile )
 delete pModLogFile, static_cast(pModLogFile) = 1;
diff --git a/sw/source/core/inc/DocumentTimerManager.hxx 
b/sw/source/core/inc/DocumentTimerManager.hxx
index 

[Libreoffice-commits] core.git: Branch 'feature/cib_contract891c' - 7 commits - download.lst external/curl external/libxml2 external/poppler external/zlib sc/source sdext/Executable_xpdfimport.mk unox

2022-11-03 Thread Jan-Marek Glogowski (via logerrit)
 download.lst |   18 ++--
 external/curl/ExternalProject_curl.mk|2 
 external/curl/curl-7.26.0_win-proxy.patch|8 -
 external/curl/curl-nss.patch.1   |7 +
 external/libxml2/ExternalPackage_xml2.mk |2 
 external/libxml2/UnpackedTarball_xml2.mk |5 -
 external/libxml2/libxml2-android.patch   |6 -
 external/libxml2/libxml2-config.patch.1  |   43 -
 external/libxml2/xml2-config.in  |   28 ++
 external/poppler/UnpackedTarball_poppler.mk  |2 
 external/poppler/disable-freetype.patch.1|   41 +
 external/poppler/gcc7-EntityInfo.patch.1 |   48 +++
 external/poppler/poppler-c++11.patch.1   |   13 ++
 external/poppler/poppler-config.patch.1  |   27 ++
 external/zlib/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d.patch |   29 ++
 external/zlib/UnpackedTarball_zlib.mk|7 +
 external/zlib/eff308af425b67093bab25f80f1ae950166bece1.patch |   32 +++
 sc/source/core/tool/interpr7.cxx |3 
 sdext/Executable_xpdfimport.mk   |4 
 unoxml/source/xpath/xpathobject.cxx  |2 
 20 files changed, 248 insertions(+), 79 deletions(-)

New commits:
commit 98d3d103fb99ee4433e84aa2fd1f0fa13016cf02
Author: Jan-Marek Glogowski 
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Nov 4 03:05:50 2022 +0100

libxml2: use xml2-config dummy for internal build

When building a static LO with --disable-dynloading on Linux,
--without-system-libs failed for me. And it left me really puzzled:
raptor configure failed and claimed it couldn't link libxml2.

raptor's config.log showed missing math functions. xml2-config of
LO's build is patched and it includes a -lm. The xml2-config in my
chroot doesn't. But we explicitly pass the xml2-config for
non-system-libxml2 build. Reading the configure from raptor didn't
reveal a way, that it could somehow pick up the xml2-config from
the chroot, but that code is autoconf-complex...

When running "sh -x configure", it turned out the configure script
actually picks up the LIBXML_* flags from the environment, which
are set by LO's config_host.mk. These just add -lm for Android.

So this adds a xml2-config.in "dummy", which overwrites the one
from the libxml2 source and just echos LO's LIBXML_* values and
it adds -lm for all DISABLE_DYNLOADING targets.

Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116409
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 8b9f8f0f9d38cc64f742fe5358fce88d0f82391a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139965
Reviewed-by: Michael Stahl 
(cherry picked from commit 5c044ae7a3246bddbd0513bd5ed3efef10cb1503)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142035
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

Conflicts:
external/libxml2/UnpackedTarball_xml2.mk
external/libxml2/libxml2-config.patch.1

diff --git a/external/libxml2/UnpackedTarball_xml2.mk 
b/external/libxml2/UnpackedTarball_xml2.mk
index 5cff2aed0a87..52523c5c8bd3 100644
--- a/external/libxml2/UnpackedTarball_xml2.mk
+++ b/external/libxml2/UnpackedTarball_xml2.mk
@@ -11,12 +11,15 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,xml2))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,xml2,$(LIBXML_TARBALL),,libxml2))
 
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,xml2))
+
 $(eval $(call gb_UnpackedTarball_add_patches,xml2,\
-   external/libxml2/libxml2-config.patch.1 \
external/libxml2/libxml2-global-symbols.patch \
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
external/libxml2/libxml2-icu.patch.0 \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,xml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 
b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 28ac8f2809a7..
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
 a/xml2-config.in   2009-12-17 11:45:20.0 +
-+++ b/xml2-config.in   2009-12-17 11:45:36.0 +
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - external/libxml2

2022-10-30 Thread Jan-Marek Glogowski (via logerrit)
 external/libxml2/UnpackedTarball_libxml2.mk |3 +
 external/libxml2/libxml2-config.patch.1 |   43 
 external/libxml2/xml2-config.in |   28 ++
 3 files changed, 30 insertions(+), 44 deletions(-)

New commits:
commit 50dc245b351702b54a52d0203e6594929da73f82
Author: Jan-Marek Glogowski 
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Sun Oct 30 13:58:17 2022 +0100

libxml2: use xml2-config dummy for internal build

When building a static LO with --disable-dynloading on Linux,
--without-system-libs failed for me. And it left me really puzzled:
raptor configure failed and claimed it couldn't link libxml2.

raptor's config.log showed missing math functions. xml2-config of
LO's build is patched and it includes a -lm. The xml2-config in my
chroot doesn't. But we explicitly pass the xml2-config for
non-system-libxml2 build. Reading the configure from raptor didn't
reveal a way, that it could somehow pick up the xml2-config from
the chroot, but that code is autoconf-complex...

When running "sh -x configure", it turned out the configure script
actually picks up the LIBXML_* flags from the environment, which
are set by LO's config_host.mk. These just add -lm for Android.

So this adds a xml2-config.in "dummy", which overwrites the one
from the libxml2 source and just echos LO's LIBXML_* values and
it adds -lm for all DISABLE_DYNLOADING targets.

Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116409
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 8b9f8f0f9d38cc64f742fe5358fce88d0f82391a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139965
Reviewed-by: Michael Stahl 
(cherry picked from commit 5c044ae7a3246bddbd0513bd5ed3efef10cb1503)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142035
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/external/libxml2/UnpackedTarball_libxml2.mk 
b/external/libxml2/UnpackedTarball_libxml2.mk
index 00398f16af56..4ec3fa074dea 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -14,11 +14,12 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,libxml2,$(LIBXML_TARBALL),,libxml2)
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libxml2))
 
 $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
-   external/libxml2/libxml2-config.patch.1 \
external/libxml2/libxml2-global-symbols.patch \
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
external/libxml2/libxml2-icu.patch.0 \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,libxml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 
b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 5a2ef1485e92..
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
 a/xml2-config.in   2009-12-17 11:45:20.0 +
-+++ b/xml2-config.in   2009-12-17 11:45:36.0 +
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@
-+#includedir=@includedir@
-+#libdir=@libdir@
-+
-+prefix=${WORKDIR}/UnpackedTarball/libxml2
-+exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
-+includedir=${WORKDIR}/UnpackedTarball/libxml2/include
-+libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
- cflags=
- libs=
- 
-@@ -67,7 +72,8 @@
-   ;;
- 
- --cflags)
--cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+#cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+cflags="-I${includedir}"
-   ;;
- 
- --libtool-libs)
-@@ -91,7 +96,8 @@
- libs="@XML_LIBDIR@ $libs"
- fi
- 
--libs="$libs @WIN32_EXTRA_LIBADD@"
-+#libs="$libs @WIN32_EXTRA_LIBADD@"
-+libs="-L${libdir} -lxml2 -lm"
- ;;
- 
- *)
diff --git a/external/libxml2/xml2-config.in b/external/libxml2/xml2-config.in
new file mode 100644
index ..164508e47e67
--- /dev/null
+++ b/external/libxml2/xml2-config.in
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+while test $# -gt 0; do
+case "$1" in
+-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+*) optarg= ;;
+esac
+
+case "$1" in
+--version)
+   echo @VERSION@
+   exit 0
+;;
+--cflags)
+cflags="$LIBXML_CFLAGS"
+;;
+--libs)
+libs="$LIBXML_LIBS"
+;;
+esac
+shift
+done
+
+if test -n "$cflags$libs"; then
+echo $cflags $libs
+fi
+
+exit 0


[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d+hotfix' - external/libxml2

2022-10-22 Thread Jan-Marek Glogowski (via logerrit)
 external/libxml2/UnpackedTarball_libxml2.mk |3 +
 external/libxml2/libxml2-config.patch.1 |   43 
 external/libxml2/xml2-config.in |   28 ++
 3 files changed, 30 insertions(+), 44 deletions(-)

New commits:
commit f434730bf1f3fcc2093ee3014fd7d5714a7c5179
Author: Jan-Marek Glogowski 
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Sat Oct 22 09:45:20 2022 +0200

libxml2: use xml2-config dummy for internal build

When building a static LO with --disable-dynloading on Linux,
--without-system-libs failed for me. And it left me really puzzled:
raptor configure failed and claimed it couldn't link libxml2.

raptor's config.log showed missing math functions. xml2-config of
LO's build is patched and it includes a -lm. The xml2-config in my
chroot doesn't. But we explicitly pass the xml2-config for
non-system-libxml2 build. Reading the configure from raptor didn't
reveal a way, that it could somehow pick up the xml2-config from
the chroot, but that code is autoconf-complex...

When running "sh -x configure", it turned out the configure script
actually picks up the LIBXML_* flags from the environment, which
are set by LO's config_host.mk. These just add -lm for Android.

So this adds a xml2-config.in "dummy", which overwrites the one
from the libxml2 source and just echos LO's LIBXML_* values and
it adds -lm for all DISABLE_DYNLOADING targets.

Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116409
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 8b9f8f0f9d38cc64f742fe5358fce88d0f82391a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139965
Reviewed-by: Michael Stahl 
(cherry picked from commit 5c044ae7a3246bddbd0513bd5ed3efef10cb1503)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140006
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/external/libxml2/UnpackedTarball_libxml2.mk 
b/external/libxml2/UnpackedTarball_libxml2.mk
index 00398f16af56..4ec3fa074dea 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -14,11 +14,12 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,libxml2,$(LIBXML_TARBALL),,libxml2)
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libxml2))
 
 $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
-   external/libxml2/libxml2-config.patch.1 \
external/libxml2/libxml2-global-symbols.patch \
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
external/libxml2/libxml2-icu.patch.0 \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,libxml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 
b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 5a2ef1485e92..
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
 a/xml2-config.in   2009-12-17 11:45:20.0 +
-+++ b/xml2-config.in   2009-12-17 11:45:36.0 +
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@
-+#includedir=@includedir@
-+#libdir=@libdir@
-+
-+prefix=${WORKDIR}/UnpackedTarball/libxml2
-+exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
-+includedir=${WORKDIR}/UnpackedTarball/libxml2/include
-+libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
- cflags=
- libs=
- 
-@@ -67,7 +72,8 @@
-   ;;
- 
- --cflags)
--cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+#cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+cflags="-I${includedir}"
-   ;;
- 
- --libtool-libs)
-@@ -91,7 +96,8 @@
- libs="@XML_LIBDIR@ $libs"
- fi
- 
--libs="$libs @WIN32_EXTRA_LIBADD@"
-+#libs="$libs @WIN32_EXTRA_LIBADD@"
-+libs="-L${libdir} -lxml2 -lm"
- ;;
- 
- *)
diff --git a/external/libxml2/xml2-config.in b/external/libxml2/xml2-config.in
new file mode 100644
index ..164508e47e67
--- /dev/null
+++ b/external/libxml2/xml2-config.in
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+while test $# -gt 0; do
+case "$1" in
+-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+*) optarg= ;;
+esac
+
+case "$1" in
+--version)
+   echo @VERSION@
+   exit 0
+;;
+--cflags)
+cflags="$LIBXML_CFLAGS"
+;;
+--libs)
+libs="$LIBXML_LIBS"
+;;
+esac
+shift
+done
+
+if test -n "$cflags$libs"; then
+echo $cflags $libs
+fi
+
+exit 0


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - configure.ac m4/libo_externals.m4

2022-09-26 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac |   62 ++-
 m4/libo_externals.m4 |   12 ++---
 2 files changed, 26 insertions(+), 48 deletions(-)

New commits:
commit be7a238c33dc02dfba40b2ad60485a56f4685d26
Author: Jan-Marek Glogowski 
AuthorDate: Tue Dec 7 05:19:01 2021 +0100
Commit: Tor Lillqvist 
CommitDate: Mon Sep 26 20:54:56 2022 +0200

Simplify FONTCONFIG and FREETYPE tests

Add an additional option to libo_CHECK_SYSTEM_MODULE to select
the default external lookup.

Don't "if" the libo_CHECK_SYSTEM_MODULE, so the AC_SUBST are
always run, but set the test_* flags instead.

Change-Id: Ie0a1204b34d596fdd57a7ee770418f91bf8c5d00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126464
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140050
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/configure.ac b/configure.ac
index 910c6f6655b9..c4de07a897b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1171,6 +1171,9 @@ if test "$using_freetype_fontconfig" = yes; then
 AC_DEFINE(ENABLE_HEADLESS)
 ENABLE_HEADLESS=TRUE
 fi
+else
+test_fontconfig=no
+test_freetype=no
 fi
 
 AC_SUBST(ENABLE_HEADLESS)
@@ -5863,23 +5866,7 @@ fi
 
 AC_SUBST(ENABLE_CUPS)
 
-# fontconfig checks
-if test "$using_freetype_fontconfig" = yes; then
-AC_MSG_CHECKING([which fontconfig to use])
-fi
-if test "$using_freetype_fontconfig" = yes -a "$test_system_fontconfig" != no; 
then
-AC_MSG_RESULT([external])
-PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
-SYSTEM_FONTCONFIG=TRUE
-FilterLibs "${FONTCONFIG_LIBS}"
-FONTCONFIG_LIBS="${filteredlibs}"
-elif test "$using_freetype_fontconfig" = yes; then
-AC_MSG_RESULT([internal])
-BUILD_TYPE="$BUILD_TYPE FONTCONFIG"
-fi
-AC_SUBST(FONTCONFIG_CFLAGS)
-AC_SUBST(FONTCONFIG_LIBS)
-AC_SUBST([SYSTEM_FONTCONFIG])
+libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 
2.4.1],,,TRUE)
 
 dnl whether to find & fetch external tarballs?
 dnl ===
@@ -9511,38 +9498,25 @@ fi
 
 dnl ===
 dnl Check whether freetype is available
+dnl
+dnl FreeType has 3 different kinds of versions
+dnl * release, like 2.4.10
+dnl * libtool, like 13.0.7 (this what pkg-config returns)
+dnl * soname
+dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
+dnl
+dnl 9.9.3 is 2.2.0
+dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
 dnl ===
-if test "$using_freetype_fontconfig" = yes; then
-AC_MSG_CHECKING([which freetype to use])
-fi
-if test "$using_freetype_fontconfig" = yes -a "$test_system_freetype" != no; 
then
-AC_MSG_RESULT([external])
-# FreeType has 3 different kinds of versions
-# * release, like 2.4.10
-# * libtool, like 13.0.7 (this what pkg-config returns)
-# * soname
-# FreeType's docs/VERSION.DLL provides a table mapping between the three
-#
-# 9.9.3 is 2.2.0
-# When the minimal version is at least 2.8.1, remove Skia's check down 
below.
-PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
-FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e 
"s/-I/${ISYSTEM?}/g")
-FilterLibs "${FREETYPE_LIBS}"
-FREETYPE_LIBS="${filteredlibs}"
-SYSTEM_FREETYPE=TRUE
-elif test "$using_freetype_fontconfig" = yes; then
-AC_MSG_RESULT([internal])
-FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
+if test "$test_freetype" != no; then
 if test "x$ac_config_site_64bit_host" = xYES; then
-FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 
-lfreetype"
+
FREETYPE_LIBS_INTERNAL="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 
-lfreetype"
 else
-FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib 
-lfreetype"
+
FREETYPE_LIBS_INTERNAL="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib 
-lfreetype"
 fi
-BUILD_TYPE="$BUILD_TYPE FREETYPE"
 fi
-AC_SUBST(FREETYPE_CFLAGS)
-AC_SUBST(FREETYPE_LIBS)
-AC_SUBST([SYSTEM_FREETYPE])
+libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],
+
["${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"],["$FREETYPE_LIBS_INTERNAL"],TRUE)
 
 # ===
 # Check for system libxslt
diff --git a/m4/libo_externals.m4 b/m4/libo_externals.m4
index d19178ab8250..b2b314fec933 100644
--- a/m4/libo_externals.m4
+++ b/m4/libo_externals.m4
@@ -6,15 +6,19 @@ dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; 
fill-column: 102 -*
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
+# ,,,
+# ,,
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - m4/libo_externals.m4

2022-09-26 Thread Jan-Marek Glogowski (via logerrit)
 m4/libo_externals.m4 |   30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

New commits:
commit df45cb78617eebcace731c2a8e61cc4aaec2a8cf
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 25 14:57:29 2021 +0200
Commit: Tor Lillqvist 
CommitDate: Mon Sep 26 20:54:32 2022 +0200

m4: Add test flag to libo_CHECK_SYSTEM_MODULE

Automatically adds an ENABLE_* AC_SUBST and test for a disabled
test via test_*, like ENABLE_EPUBGEN and test_libepubgen.

Change-Id: Ifaf27d4d1193f41de6291ab70d973fe151f36b2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126169
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140049
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/m4/libo_externals.m4 b/m4/libo_externals.m4
index f755358bb395..d19178ab8250 100644
--- a/m4/libo_externals.m4
+++ b/m4/libo_externals.m4
@@ -12,20 +12,26 @@ AC_ARG_WITH(system-$1,
 [Use $1 from operating system instead of building and bundling it.]),,
 [with_system_$1="$with_system_libs"])
 AC_MSG_CHECKING([which $1 to use])
-if test "$with_system_$1" = "yes"; then
-AC_MSG_RESULT([external])
-SYSTEM_$2=TRUE
-PKG_CHECK_MODULES([$2], [$3])
-$2_CFLAGS=$(printf '%s' "${$2_CFLAGS}" | sed -e "s/-I/${ISYSTEM?}/g")
-FilterLibs "${$2_LIBS}"
-$2_LIBS="$filteredlibs"
+if test "$test_$1" != "no"; then
+ENABLE_$2=TRUE
+if test "$with_system_$1" = "yes"; then
+AC_MSG_RESULT([external])
+SYSTEM_$2=TRUE
+PKG_CHECK_MODULES([$2], [$3])
+$2_CFLAGS=$(printf '%s' "${$2_CFLAGS}" | sed -e "s/-I/${ISYSTEM?}/g")
+FilterLibs "${$2_LIBS}"
+$2_LIBS="$filteredlibs"
+else
+AC_MSG_RESULT([internal])
+SYSTEM_$2=
+$2_CFLAGS=$4
+$2_LIBS=$5
+BUILD_TYPE="$BUILD_TYPE $2"
+fi
 else
-AC_MSG_RESULT([internal])
-SYSTEM_$2=
-$2_CFLAGS=$4
-$2_LIBS=$5
-BUILD_TYPE="$BUILD_TYPE $2"
+AC_MSG_RESULT([ignored])
 fi
+AC_SUBST([ENABLE_$2])
 AC_SUBST([SYSTEM_$2])
 AC_SUBST([$2_CFLAGS])
 AC_SUBST([$2_LIBS])


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - external/libxml2

2022-09-15 Thread Jan-Marek Glogowski (via logerrit)
 external/libxml2/UnpackedTarball_libxml2.mk |3 +
 external/libxml2/libxml2-config.patch.1 |   43 
 external/libxml2/xml2-config.in |   28 ++
 3 files changed, 30 insertions(+), 44 deletions(-)

New commits:
commit 9e5926061d7c65eab633b4bed084ee0dc9233fb6
Author: Jan-Marek Glogowski 
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Sep 15 16:33:45 2022 +0200

libxml2: use xml2-config dummy for internal build

When building a static LO with --disable-dynloading on Linux,
--without-system-libs failed for me. And it left me really puzzled:
raptor configure failed and claimed it couldn't link libxml2.

raptor's config.log showed missing math functions. xml2-config of
LO's build is patched and it includes a -lm. The xml2-config in my
chroot doesn't. But we explicitly pass the xml2-config for
non-system-libxml2 build. Reading the configure from raptor didn't
reveal a way, that it could somehow pick up the xml2-config from
the chroot, but that code is autoconf-complex...

When running "sh -x configure", it turned out the configure script
actually picks up the LIBXML_* flags from the environment, which
are set by LO's config_host.mk. These just add -lm for Android.

So this adds a xml2-config.in "dummy", which overwrites the one
from the libxml2 source and just echos LO's LIBXML_* values and
it adds -lm for all DISABLE_DYNLOADING targets.

Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116409
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 8b9f8f0f9d38cc64f742fe5358fce88d0f82391a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139965
Reviewed-by: Michael Stahl 
(cherry picked from commit 5c044ae7a3246bddbd0513bd5ed3efef10cb1503)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140006
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/external/libxml2/UnpackedTarball_libxml2.mk 
b/external/libxml2/UnpackedTarball_libxml2.mk
index 83df02849cb3..8c81c3d26e4c 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -14,7 +14,6 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,libxml2,$(LIBXML_TARBALL),,libxml2)
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libxml2))
 
 $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
-   external/libxml2/libxml2-config.patch.1 \
external/libxml2/libxml2-global-symbols.patch \
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
@@ -23,4 +22,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
external/libxml2/libxml2-icu.patch.0) \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,libxml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 
b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 5a2ef1485e92..
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
 a/xml2-config.in   2009-12-17 11:45:20.0 +
-+++ b/xml2-config.in   2009-12-17 11:45:36.0 +
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@
-+#includedir=@includedir@
-+#libdir=@libdir@
-+
-+prefix=${WORKDIR}/UnpackedTarball/libxml2
-+exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
-+includedir=${WORKDIR}/UnpackedTarball/libxml2/include
-+libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
- cflags=
- libs=
- 
-@@ -67,7 +72,8 @@
-   ;;
- 
- --cflags)
--cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+#cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+cflags="-I${includedir}"
-   ;;
- 
- --libtool-libs)
-@@ -91,7 +96,8 @@
- libs="@XML_LIBDIR@ $libs"
- fi
- 
--libs="$libs @WIN32_EXTRA_LIBADD@"
-+#libs="$libs @WIN32_EXTRA_LIBADD@"
-+libs="-L${libdir} -lxml2 -lm"
- ;;
- 
- *)
diff --git a/external/libxml2/xml2-config.in b/external/libxml2/xml2-config.in
new file mode 100644
index ..164508e47e67
--- /dev/null
+++ b/external/libxml2/xml2-config.in
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+while test $# -gt 0; do
+case "$1" in
+-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+*) optarg= ;;
+esac
+
+case "$1" in
+--version)
+   echo @VERSION@
+   exit 0
+;;
+--cflags)
+cflags="$LIBXML_CFLAGS"
+;;
+--libs)
+libs="$LIBXML_LIBS"
+;;
+esac
+shift
+done
+
+if test -n "$cflags$libs"; then
+echo 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - configure.ac external/libxml2 external/redland

2022-09-15 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac  |2 -
 external/libxml2/UnpackedTarball_libxml2.mk   |3 +
 external/libxml2/libxml2-config.patch.1   |   43 --
 external/libxml2/xml2-config.in   |   28 
 external/redland/UnpackedTarball_raptor.mk|1 
 external/redland/raptor/libxml-override.patch |   13 ---
 6 files changed, 31 insertions(+), 59 deletions(-)

New commits:
commit 5c044ae7a3246bddbd0513bd5ed3efef10cb1503
Author: Jan-Marek Glogowski 
AuthorDate: Sun May 30 13:23:16 2021 +0200
Commit: Michael Stahl 
CommitDate: Thu Sep 15 10:56:29 2022 +0200

libxml2: use xml2-config dummy for internal build

When building a static LO with --disable-dynloading on Linux,
--without-system-libs failed for me. And it left me really puzzled:
raptor configure failed and claimed it couldn't link libxml2.

raptor's config.log showed missing math functions. xml2-config of
LO's build is patched and it includes a -lm. The xml2-config in my
chroot doesn't. But we explicitly pass the xml2-config for
non-system-libxml2 build. Reading the configure from raptor didn't
reveal a way, that it could somehow pick up the xml2-config from
the chroot, but that code is autoconf-complex...

When running "sh -x configure", it turned out the configure script
actually picks up the LIBXML_* flags from the environment, which
are set by LO's config_host.mk. These just add -lm for Android.

So this adds a xml2-config.in "dummy", which overwrites the one
from the libxml2 source and just echos LO's LIBXML_* values and
it adds -lm for all DISABLE_DYNLOADING targets.

Change-Id: Ia713cf80c8e7dc989cf23c224e7a0f7ea1210a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116409
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 8b9f8f0f9d38cc64f742fe5358fce88d0f82391a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139965
Reviewed-by: Michael Stahl 

diff --git a/configure.ac b/configure.ac
index 8ef428589d79..3a39b672a033 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9614,7 +9614,7 @@ else
 
LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
 else
 LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
-if test "$_os" = Android; then
+if test "$DISABLE_DYNLOADING" = TRUE; then
 LIBXML_LIBS="$LIBXML_LIBS -lm"
 fi
 fi
diff --git a/external/libxml2/UnpackedTarball_libxml2.mk 
b/external/libxml2/UnpackedTarball_libxml2.mk
index 83df02849cb3..8c81c3d26e4c 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -14,7 +14,6 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,libxml2,$(LIBXML_TARBALL),,libxml2)
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libxml2))
 
 $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
-   external/libxml2/libxml2-config.patch.1 \
external/libxml2/libxml2-global-symbols.patch \
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
@@ -23,4 +22,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
external/libxml2/libxml2-icu.patch.0) \
 ))
 
+$(eval $(call 
gb_UnpackedTarball_add_file,libxml2,xml2-config.in,external/libxml2/xml2-config.in))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-config.patch.1 
b/external/libxml2/libxml2-config.patch.1
deleted file mode 100644
index 5a2ef1485e92..
--- a/external/libxml2/libxml2-config.patch.1
+++ /dev/null
@@ -1,43 +0,0 @@
-Hack the xml2-config to return paths into WORKDIR.
-
 a/xml2-config.in   2009-12-17 11:45:20.0 +
-+++ b/xml2-config.in   2009-12-17 11:45:36.0 +
-@@ -1,9 +1,14 @@
- #! /bin/sh
- 
--prefix=@prefix@
--exec_prefix=@exec_prefix@
--includedir=@includedir@
--libdir=@libdir@
-+#prefix=@prefix@
-+#exec_prefix=@exec_prefix@
-+#includedir=@includedir@
-+#libdir=@libdir@
-+
-+prefix=${WORKDIR}/UnpackedTarball/libxml2
-+exec_prefix=${WORKDIR}/UnpackedTarball/libxml2
-+includedir=${WORKDIR}/UnpackedTarball/libxml2/include
-+libdir=${WORKDIR}/UnpackedTarball/libxml2/.libs
- cflags=
- libs=
- 
-@@ -67,7 +72,8 @@
-   ;;
- 
- --cflags)
--cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+#cflags="@XML_INCLUDEDIR@ @XML_CFLAGS@"
-+cflags="-I${includedir}"
-   ;;
- 
- --libtool-libs)
-@@ -91,7 +96,8 @@
- libs="@XML_LIBDIR@ $libs"
- fi
- 
--libs="$libs @WIN32_EXTRA_LIBADD@"
-+#libs="$libs @WIN32_EXTRA_LIBADD@"
-+libs="-L${libdir} -lxml2 -lm"
- ;;
- 
- *)
diff --git a/external/libxml2/xml2-config.in b/external/libxml2/xml2-config.in
new file mode 100644
index ..164508e47e67
--- /dev/null
+++ b/external/libxml2/xml2-config.in
@@ 

[Libreoffice-commits] core.git: vcl/win

2022-06-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |  181 ++--
 1 file changed, 93 insertions(+), 88 deletions(-)

New commits:
commit 1759fb1f50015a4ce4f8b9843891e71a615b5a2e
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 13 18:57:11 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 25 18:46:57 2022 +0200

WIN flatten and assert some code

Thanks to Mike Kaganski to come up with the correct asserts.

Change-Id: I01b2b0026fc4de67a14fa803357a4c28951088ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135810
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 9306d35d77fe..b419a259c450 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -44,7 +44,7 @@
 #include 
 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -3959,18 +3959,6 @@ static void UpdateFrameGeometry(WinSalFrame* pFrame)
 pFrame->updateScreenNumber();
 }
 
-static void ImplCallMoveHdl( HWND hWnd )
-{
-WinSalFrame* pFrame = GetWindowPtr( hWnd );
-if ( pFrame )
-{
-pFrame->CallCallback( SalEvent::Move, nullptr );
-// to avoid doing Paint twice by VCL and SAL
-//if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
-//UpdateWindow( hWnd );
-}
-}
-
 static void ImplCallClosePopupsHdl( HWND hWnd )
 {
 WinSalFrame* pFrame = GetWindowPtr( hWnd );
@@ -3980,40 +3968,51 @@ static void ImplCallClosePopupsHdl( HWND hWnd )
 }
 }
 
-static void ImplHandleMoveMsg( HWND hWnd )
+static void ImplCallMoveHdl(HWND hWnd)
 {
-WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTMOVE );
-if ( pFrame )
-{
-UpdateFrameGeometry(pFrame);
+WinSalFrame* pFrame = ProcessOrDeferMessage(hWnd, SAL_MSG_POSTMOVE);
+if (!pFrame)
+return;
 
-if ( GetWindowStyle( hWnd ) & WS_VISIBLE )
-pFrame->mbDefPos = false;
+pFrame->CallCallback(SalEvent::Move, nullptr);
 
-// protect against recursion
-if ( !pFrame->mbInMoveMsg )
-{
-// adjust window again for FullScreenMode
-pFrame->mbInMoveMsg = true;
-if (pFrame->isFullScreen())
-ImplSalFrameFullScreenPos( pFrame );
-pFrame->mbInMoveMsg = false;
-}
+ImplSalYieldMutexRelease();
+}
 
-pFrame->UpdateFrameState();
+static void ImplHandleMoveMsg(HWND hWnd, LPARAM lParam)
+{
+WinSalFrame* pFrame = GetWindowPtr( hWnd );
+if (!pFrame)
+return;
 
-// Call Hdl
-//#93851 if we call this handler, VCL floating windows are not updated 
correctly
-ImplCallMoveHdl( hWnd );
+UpdateFrameGeometry(pFrame);
 
-ImplSalYieldMutexRelease();
+#ifdef NDEBUG
+(void) lParam;
+#endif
+assert(IsIconic(hWnd) || (pFrame->maGeometry.x() == 
static_cast(LOWORD(lParam;
+assert(IsIconic(hWnd) || (pFrame->maGeometry.y() == 
static_cast(HIWORD(lParam;
+
+if (GetWindowStyle(hWnd) & WS_VISIBLE)
+pFrame->mbDefPos = false;
+
+// protect against recursion
+if (!pFrame->mbInMoveMsg)
+{
+// adjust window again for FullScreenMode
+pFrame->mbInMoveMsg = true;
+if (pFrame->isFullScreen())
+ImplSalFrameFullScreenPos(pFrame);
+pFrame->mbInMoveMsg = false;
 }
+
+pFrame->UpdateFrameState();
+
+ImplCallMoveHdl(hWnd);
 }
 
 static void ImplCallSizeHdl( HWND hWnd )
 {
-// as Windows can send these messages also, we have to use
-// the Solar semaphore
 WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTCALLSIZE );
 if (!pFrame)
 return;
@@ -4026,7 +4025,7 @@ static void ImplCallSizeHdl( HWND hWnd )
 ImplSalYieldMutexRelease();
 }
 
-static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, LPARAM)
+static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 if ((wParam == SIZE_MAXSHOW) || (wParam == SIZE_MAXHIDE))
 return;
@@ -4036,7 +4035,15 @@ static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, 
LPARAM)
 return;
 
 UpdateFrameGeometry(pFrame);
+
+#ifdef NDEBUG
+(void) lParam;
+#endif
+assert(pFrame->maGeometry.width() == 
static_cast(LOWORD(lParam)));
+assert(pFrame->maGeometry.height() == 
static_cast(HIWORD(lParam)));
+
 pFrame->UpdateFrameState();
+
 ImplCallSizeHdl(hWnd);
 
 WinSalTimer* pTimer = 
static_cast(ImplGetSVData()->maSchedCtx.mpSalTimer);
@@ -4047,30 +4054,30 @@ static void ImplHandleSizeMsg(HWND hWnd, WPARAM wParam, 
LPARAM)
 static void ImplHandleFocusMsg( HWND hWnd )
 {
 WinSalFrame* pFrame = ProcessOrDeferMessage( hWnd, SAL_MSG_POSTFOCUS );
-if ( pFrame )
-{
-if ( !WinSalFrame::mbInReparent )
-{
-bool bGotFocus = ::GetFocus() == hWnd;
-if ( bGotFocus )
-{
-if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
- 

[Libreoffice-commits] core.git: vcl/android vcl/headless vcl/inc vcl/ios vcl/source

2022-06-22 Thread Jan-Marek Glogowski (via logerrit)
 vcl/android/androidinst.cxx   |2 
 vcl/headless/headlessinst.cxx |2 
 vcl/headless/svpinst.cxx  |  316 --
 vcl/inc/headless/svpinst.hxx  |  101 -
 vcl/ios/iosinst.cxx   |2 
 vcl/source/app/salplug.cxx|2 
 6 files changed, 130 insertions(+), 295 deletions(-)

New commits:
commit d2de55c93f94bbccff51fa7715b613341f1f4ae6
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 28 01:35:00 2021 +
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 22 12:06:39 2022 +0200

svp: don't directly yield in main thread

AKA svp: always release SolarMutex on yield, v2

Implement the TODO when yielding a non-main thread: "use a
SolarMutexReleaser here and drop the m_bNoYieldLock usage"

This whole concept of "deferred yield" is prone to spurious
"deadlocks", if DoYield spawns a nested event loop. This will
not only block one yielding threads, but all indefinitly. And
not releasing the SolarMutex is also not fair for any other
threads waiting. That whole m_nNoYieldLock hack is just needed
to defer GUI processing to the main thread without releasing
the SolarMutex, the exact opposite of what yielding does.

While we can't do anything for the main thread as long as the
whole nested event loop concept prevails, we can prevent the
yielding thread deadlock using conditionals.

With all the special m_nNoYieldLock gone from SvpSalYieldMutex
there isn't any reason to keep it around.

Change-Id: I87c006ad36b4959f7e0dd18dda99a58c4e25032d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117900
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index ca130fb1b19f..56497db19270 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -157,7 +157,7 @@ SalFrame *AndroidSalInstance::CreateFrame( SalFrame* 
pParent, SalFrameStyleFlags
 extern "C" SalInstance *create_SalInstance()
 {
 LOGI("Android: create_SalInstance!");
-AndroidSalInstance* pInstance = new AndroidSalInstance( 
std::make_unique() );
+AndroidSalInstance* pInstance = new AndroidSalInstance( 
std::make_unique() );
 new SvpSalData();
 return pInstance;
 }
diff --git a/vcl/headless/headlessinst.cxx b/vcl/headless/headlessinst.cxx
index abe3e1cf92c7..162fd5bd865b 100644
--- a/vcl/headless/headlessinst.cxx
+++ b/vcl/headless/headlessinst.cxx
@@ -47,7 +47,7 @@ SalSystem *HeadlessSalInstance::CreateSalSystem()
 
 extern "C" SalInstance *create_SalInstance()
 {
-HeadlessSalInstance* pInstance = new 
HeadlessSalInstance(std::make_unique());
+HeadlessSalInstance* pInstance = new 
HeadlessSalInstance(std::make_unique());
 new SvpSalData();
 return pInstance;
 }
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index bf53dc24faf3..10beeeb58fbd 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -56,138 +56,55 @@
 #include 
 #include 
 #include 
+#include 
 
 SvpSalInstance* SvpSalInstance::s_pDefaultInstance = nullptr;
 
-#ifndef NDEBUG
-static bool g_CheckedMutex = false;
-
-#define DBG_TESTSVPYIELDMUTEX() \
-do { \
-if (!g_CheckedMutex) \
-{ \
-assert(dynamic_cast(GetYieldMutex()) != nullptr \
-&& "This SvpSalInstance function requires use of 
SvpSalYieldMutex"); \
-g_CheckedMutex = true; \
-} \
-} while(false)
-
-#else // NDEBUG
-#define DBG_TESTSVPYIELDMUTEX() ((void)0)
-#endif
-
-#if !defined(ANDROID) && !defined(IOS)
-
-static void atfork_child()
-{
-if (SvpSalInstance::s_pDefaultInstance != nullptr)
-{
-SvpSalInstance::s_pDefaultInstance->CloseWakeupPipe(false);
-SvpSalInstance::s_pDefaultInstance->CreateWakeupPipe(false);
-}
-}
-
-#endif
-
 SvpSalInstance::SvpSalInstance( std::unique_ptr pMutex )
 : SalGenericInstance( std::move(pMutex) )
+, m_WaitCondition(m_NonMainYieldMutex)
+, m_EventCondition(m_NonMainYieldMutex)
+, m_MainYieldCondition(m_MainYieldMutex)
 {
 m_aTimeout.tv_sec   = 0;
 m_aTimeout.tv_usec  = 0;
 m_nTimeoutMS= 0;
 
 m_MainThread = osl::Thread::getCurrentIdentifier();
-CreateWakeupPipe(true);
 if( s_pDefaultInstance == nullptr )
 s_pDefaultInstance = this;
-#if !defined(ANDROID) && !defined(IOS)
-pthread_atfork(nullptr, nullptr, atfork_child);
-#endif
+
+m_bSupportsOpenGL = false;
 }
 
 SvpSalInstance::~SvpSalInstance()
 {
 if( s_pDefaultInstance == this )
 s_pDefaultInstance = nullptr;
-CloseWakeupPipe(true);
 }
 
-void SvpSalInstance::CloseWakeupPipe(bool log)
+void SvpSalInstance::TriggerUserEventProcessing()
 {
-SvpSalYieldMutex *const 
pMutex(dynamic_cast(GetYieldMutex()));
-if (!pMutex)
-return;
-if (pMutex->m_FeedbackFDs[0] != -1)
-{
-if (log)
-{
-SAL_INFO("vcl.headless", "CloseWakeupPipe: 

[Libreoffice-commits] core.git: include/vcl vcl/source

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/menu.hxx   |5 +
 vcl/source/window/menu.cxx |  149 +
 2 files changed, 89 insertions(+), 65 deletions(-)

New commits:
commit fb9af884de622cdac23887417ccb32cfd34860c3
Author: Jan-Marek Glogowski 
AuthorDate: Sat Nov 20 15:06:35 2021 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 18:43:03 2022 +0200

Refactor PopupMenu::ImplExecute for async support

Splits ImplExecute into PrepareRun, Run and FinishRun.

Change-Id: Ifddb1e968b468c9757eeece0bb19513cc26a9c8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125597
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 538cc4c88b80..bb0ef8cee6db 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -495,7 +495,10 @@ class VCL_DLLPUBLIC PopupMenu final : public Menu
 
 private:
 SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
-SAL_DLLPRIVATE sal_uInt16 ImplExecute( const VclPtr& pW, 
const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* 
pSFrom, bool bPreSelectFirst );
+SAL_DLLPRIVATE bool PrepareRun(const VclPtr& pParentWin, 
tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom, 
bool& bRealExecute, VclPtr&);
+SAL_DLLPRIVATE bool Run(const VclPtr&, bool 
bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu* 
pSFrom, const tools::Rectangle& rRect);
+SAL_DLLPRIVATE void FinishRun(const VclPtr&, const 
VclPtr& pParentWin, bool bRealExecute, bool bIsNativeMenu);
+SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr& 
pParentWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, 
Menu* pSFrom, bool bPreSelectFirst);
 SAL_DLLPRIVATE void ImplFlushPendingSelect();
 SAL_DLLPRIVATE tools::Long ImplCalcHeight( sal_uInt16 nEntries ) const;
 SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( tools::Long nMaxHeight, 
sal_uInt16 nStartEntry, sal_uInt16* pLastVisible = nullptr ) const;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index bd244319e136..9f680b9071c1 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2740,10 +2740,8 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, 
const Point& rPopupPos
 return Execute( pExecWindow, tools::Rectangle( rPopupPos, rPopupPos ), 
PopupMenuFlags::ExecuteDown );
 }
 
-sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const 
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+static FloatWinPopupFlags lcl_TranslateFlags(PopupMenuFlags nFlags)
 {
-ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL 
window!", 0 );
-
 FloatWinPopupFlags nPopupModeFlags = FloatWinPopupFlags::NONE;
 if ( nFlags & PopupMenuFlags::ExecuteDown )
 nPopupModeFlags = FloatWinPopupFlags::Down;
@@ -2757,7 +2755,13 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, 
const tools::Rectangle&
 if (nFlags & PopupMenuFlags::NoMouseUpClose )  // 
allow popup menus to stay open on mouse button up
 nPopupModeFlags |= FloatWinPopupFlags::NoMouseUpClose;// useful if 
the menu was opened on mousebutton down (eg toolbox configuration)
 
-return ImplExecute( pExecWindow, rRect, nPopupModeFlags, nullptr, false );
+return nPopupModeFlags;
+}
+
+sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const 
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+{
+ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL 
window!", 0 );
+return ImplExecute( pExecWindow, rRect, lcl_TranslateFlags(nFlags), 
nullptr, false );
 }
 
 void PopupMenu::ImplFlushPendingSelect()
@@ -2773,10 +2777,14 @@ void PopupMenu::ImplFlushPendingSelect()
 }
 }
 
-sal_uInt16 PopupMenu::ImplExecute( const VclPtr& pW, const 
tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool 
bPreSelectFirst )
+bool PopupMenu::PrepareRun(const VclPtr& pParentWin, 
tools::Rectangle& rRect,
+   FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom,
+   bool& bRealExecute, VclPtr& 
pWin)
 {
-if ( !pSFrom && ( vcl::IsInPopupMenuExecute() || !GetItemCount() ) )
-return 0;
+bRealExecute = false;
+const sal_uInt16 nItemCount = GetItemCount();
+if (!pSFrom && (vcl::IsInPopupMenuExecute() || !nItemCount))
+return false;
 
 mpLayoutData.reset();
 
@@ -2788,7 +2796,6 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const tools::R
 bCanceled = false;
 
 VclPtr xFocusId;
-bool bRealExecute = false;
 if ( !pStartedFrom )
 {
 pSVData->mpWinData->mbNoDeactivate = true;
@@ -2804,25 +2811,24 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const tools::R
 }
 
 SAL_WARN_IF( ImplGetWindow(), "vcl", "Win?!" );
-tools::Rectangle aRect( rRect );
-aRect.SetPos( pW->OutputToScreenPixel( 

[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/osx vcl/qt5 vcl/source vcl/unx vcl/win

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/menu.hxx|2 
 vcl/inc/osx/salmenu.h   |2 
 vcl/inc/qt5/QtFrame.hxx |3 -
 vcl/inc/qt5/QtMenu.hxx  |6 +-
 vcl/inc/qt5/QtPainter.hxx   |   18 ++-
 vcl/inc/qt5/QtTools.hxx |5 ++
 vcl/inc/salmenu.hxx |   17 +--
 vcl/inc/unx/gtk/gtksalmenu.hxx  |6 --
 vcl/inc/win/salmenu.h   |3 -
 vcl/osx/salmenu.cxx |2 
 vcl/qt5/QtFrame.cxx |   62 --
 vcl/qt5/QtMenu.cxx  |5 --
 vcl/qt5/QtPainter.cxx   |   20 
 vcl/qt5/QtWidget.cxx|   28 
 vcl/source/app/salvtables.cxx   |2 
 vcl/source/window/menu.cxx  |   25 --
 vcl/source/window/menubarwindow.cxx |   83 +++-
 vcl/source/window/menubarwindow.hxx |1 
 vcl/unx/gtk3/gtksalmenu.cxx |7 ---
 vcl/win/window/salmenu.cxx  |2 
 20 files changed, 172 insertions(+), 127 deletions(-)

New commits:
commit afc828b9833b7a612369e95606ba56d41ef2c369
Author: Jan-Marek Glogowski 
AuthorDate: Sat May 28 23:47:21 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 17:26:06 2022 +0200

VCL expect correct frame size for native menubars

... and renove the wrong framesize hack in the Qt backend

This wastes a few additional pixels in the frame backing store,
actually covered by the real native menu bar, to get rid of all
the hacks and eventually fix quite a bunch of bugs in Qt (and
maybe other backends).

This seems to work correct with Qt using either QPainter or Cairo
as the painting backend. It's much simpler then my previous failed
attempts to fix the Qt related bugs. I would like to convert every
implementation to my interpretation of the API (at least I now
documented the API). It looks like Win and Mac will just work,
because Win has no native menu bar and Mac uses a global menu,
so always returns the size of 0. And Gtk also seems to work, if
it also lies about the menu bar size being zero. That just seems
consequent, if the frame size is reduced by the menubar size.

This fixes at least:
tdf#64438 - Dockable panels in LibreOffice not dockable using KDE
Works.

tdf#130893 - XWindow::SetPosSize resizing based on
  XWindow::GetPosSize shrinks the window
The document macro from tdf#130841 now doesn't resize the window.
This is just fixed for Qt.

tdf#134704 - KDE5 - unable to dock sidebar by dragging frame
not fixed, because the sidebar window is now a dialog, which is
not dockable. FWIW the same has happend the Navigator (F5), which
also renders it non-dockable. No idea, if this is intentional.

tdf#137471 - CMIS dialog advances beyond lower right corner of the
  screen
So commit 3f8d3fd4649ef09e86c735617383a4bda0425540 ("tdf#137471 Qt
return frame pos + client area size") was really not enought as a
fix (at least it didn't break anything). The whole parent-based
repositioning is wrong and it really depends on the correct frame
size, so I'm keeping this as fixed by this patch.

Change-Id: I7faeace61b456c2b0f42c7a826f58018b70d46ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135082
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 54df7ee66631..538cc4c88b80 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -179,6 +179,8 @@ protected:
 
 SAL_DLLPRIVATE void ImplFillLayoutData() const;
 SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu.get(); }
+// convenience function; just returns the SalMenu*, if HasNativeMenuBar() 
is true
+SAL_DLLPRIVATE SalMenu* GetNativeMenuBar();
 SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const;
 
 // returns native check and option menu symbol height in rCheckHeight and 
rRadioHeight
diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h
index 597180cc1ac3..274d1ecd70b2 100644
--- a/vcl/inc/osx/salmenu.h
+++ b/vcl/inc/osx/salmenu.h
@@ -55,7 +55,7 @@ public:
 AquaSalMenu( bool bMenuBar );
 virtual ~AquaSalMenu() override;
 
-virtual bool VisibleMenuBar() override;
+virtual bool HasNativeMenuBar() override;
 
 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) 
override;
 virtual void RemoveItem( unsigned nPos ) override;
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 963572ca819b..40954f66d744 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -131,7 +131,6 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 bool isMinimized() const;
 bool isMaximized() const;
 void SetWindowStateImpl(Qt::WindowStates eState);
-int menuBarOffset() const;
 
 void 

[Libreoffice-commits] core.git: vcl/headless

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 vcl/headless/svpframe.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dbaf5f6fad2ec10f69cf46f9cb697b8760c2a01f
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 20 14:45:07 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 17:01:18 2022 +0200

svp: fix UB SalGraphics vector access

Change-Id: Ic417ffbf91b04ebd6e6f18ac03b155fd01bbb316
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136226
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 9ab3864aa7cd..23a7e2595bda 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -423,7 +423,7 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
 aStdFont.SetFontSize(Size(0, 12));
 aStyleSettings.SetMenuFont(aStdFont);
 
-SvpSalGraphics* pGraphics = m_aGraphics.back();
+SvpSalGraphics* pGraphics = m_aGraphics.empty() ? nullptr : 
m_aGraphics.back();
 bool bFreeGraphics = false;
 if (!pGraphics)
 {


[Libreoffice-commits] core.git: svtools/source

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 svtools/source/control/ctrlbox.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d48dd6057ecc50dbb31d24adce76aaf27d16db16
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 20 14:39:55 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 17:00:40 2022 +0200

Correctly free font previews on settings change

Change-Id: I9fdce7c9fb8a18571d3d6a317b28a344f18efa82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136227
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 411a2dd4961d..ecce7fa8af21 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -355,6 +355,8 @@ IMPL_LINK(FontNameBox, SettingsChangedHdl, VclSimpleEvent&, 
rEvent, void)
 DataChangedEvent* pData = 
static_cast(static_cast(rEvent).GetData());
 if (pData->GetType() == DataChangedEventType::SETTINGS)
 {
+for (auto  : gFontPreviewVirDevs)
+rDev.disposeAndClear();
 gFontPreviewVirDevs.clear();
 gRenderedFontNames.clear();
 calcCustomItemSize(*m_xComboBox);


[Libreoffice-commits] core.git: include/rtl vcl/inc vcl/source

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 include/rtl/ustrbuf.hxx   |   15 +++
 vcl/inc/salframe.hxx  |1 +
 vcl/source/app/salvtables.cxx |   24 
 3 files changed, 40 insertions(+)

New commits:
commit bf35c2b7f4b9fa18e387e2ee8df518303696e13c
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 13 03:53:54 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 13:39:40 2022 +0200

OUStringBuffer: add append via operator<<(T&&)

... and use it to implement SalFrame::DumpSetPosSize.

Change-Id: I82301f7e1f6641d6167c9577ce9ef44ef8067297
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135808
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 8c8cc54f8f01..605fb1efb6d0 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -34,6 +34,7 @@
 #if defined LIBO_INTERNAL_ONLY
 #include 
 #include 
+#include 
 #endif
 
 #include "rtl/ustrbuf.h"
@@ -974,6 +975,20 @@ public:
 return pData->buffer + n;
 }
 
+#if defined LIBO_INTERNAL_ONLY
+/**
+   "Stream" operator to append a value to this OUStringBuffer.
+
+   @internal
+   @since LibreOffice 7.5
+ */
+template
+OUStringBuffer& operator<<(T&& rValue)
+{
+return append(std::forward(rValue));
+}
+#endif
+
 /**
 Inserts the string into this string buffer.
 
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 45ed72956656..552d88eb2519 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -156,6 +156,7 @@ public:
 virtual voidSetMinClientSize( tools::Long nWidth, tools::Long 
nHeight ) = 0;
 virtual voidSetMaxClientSize( tools::Long nWidth, tools::Long 
nHeight ) = 0;
 virtual voidSetPosSize( tools::Long nX, tools::Long nY, 
tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) = 0;
+static OUString DumpSetPosSize(tools::Long nX, tools::Long nY, tools::Long 
nWidth, tools::Long nHeight, sal_uInt16 nFlags);
 virtual voidGetClientSize( tools::Long& rWidth, tools::Long& 
rHeight ) = 0;
 virtual voidGetWorkArea( tools::Rectangle& rRect ) = 0;
 virtual SalFrame*   GetParent() const = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index b6db52c8b87d..40c04421b8d5 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -111,6 +111,30 @@ void SalFrame::SetRepresentedURL(const OUString&)
 // currently this is Mac only functionality
 }
 
+OUString SalFrame::DumpSetPosSize(tools::Long nX, tools::Long nY, tools::Long 
nWidth,
+  tools::Long nHeight, sal_uInt16 nFlags)
+{
+// assuming the 4 integers normally don't have more then 4 digits, but 
might be negative
+OUStringBuffer aBuffer(4 * 5 + 5);
+if (nFlags & SAL_FRAME_POSSIZE_WIDTH)
+aBuffer << nWidth << "x";
+else
+aBuffer << "?x";
+if (nFlags & SAL_FRAME_POSSIZE_HEIGHT)
+aBuffer << nHeight << "@(";
+else
+aBuffer << "?@(";
+if (nFlags & SAL_FRAME_POSSIZE_X)
+aBuffer << nX << ",";
+else
+aBuffer << "?,";
+if (nFlags & SAL_FRAME_POSSIZE_Y)
+aBuffer << nY << ")";
+else
+aBuffer << "?)";
+return aBuffer.makeStringAndClear();
+}
+
 SalInstance::SalInstance(std::unique_ptr pMutex)
 : m_pYieldMutex(std::move(pMutex))
 {


[Libreoffice-commits] core.git: vcl/inc vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_qt6.mk vcl/qt5 vcl/qt6

2022-06-18 Thread Jan-Marek Glogowski (via logerrit)
 vcl/Library_vclplug_qt5.mk   |3 +
 vcl/Library_vclplug_qt6.mk   |3 +
 vcl/inc/qt5/QtTools.hxx  |2 
 vcl/inc/qt5/QtX11Support.hxx |   30 +++
 vcl/inc/qt6/QtX11Support.hxx |   12 
 vcl/qt5/QtFrame.cxx  |   91 -
 vcl/qt5/QtX11Support.cxx |  117 +++
 vcl/qt6/QtX11Support.cxx |   12 
 8 files changed, 192 insertions(+), 78 deletions(-)

New commits:
commit fbc61e06584ff8e6d9240f8b67be8dc28ecab5b9
Author: Jan-Marek Glogowski 
AuthorDate: Wed Jun 15 23:34:01 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 18 12:18:19 2022 +0200

Qt move most X11 specifics into QtX11Support

Just some refactoring.

Change-Id: I5b2ef531778d4d43d2fdc32fe7da59edffa3c02e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136061
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index d21f7d989410..25a8864c83ad 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -106,6 +106,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
 vcl/qt5/QtVirtualDevice \
 vcl/qt5/QtWidget \
 vcl/qt5/QtXAccessible \
+$(if $(USING_X11), \
+vcl/qt5/QtX11Support \
+) \
 ))
 
 ifeq ($(OS),LINUX)
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index 9a4e627f3e22..36da06abb294 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -105,6 +105,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
 vcl/qt6/QtVirtualDevice \
 vcl/qt6/QtWidget \
 vcl/qt6/QtXAccessible \
+$(if $(USING_X11), \
+vcl/qt6/QtX11Support \
+) \
 ))
 
 ifeq ($(OS),LINUX)
diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx
index ecaa7075a426..534fe74de772 100644
--- a/vcl/inc/qt5/QtTools.hxx
+++ b/vcl/inc/qt5/QtTools.hxx
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#include 
+
 #include 
 #include 
 #include 
diff --git a/vcl/inc/qt5/QtX11Support.hxx b/vcl/inc/qt5/QtX11Support.hxx
new file mode 100644
index ..2931e82e4d1a
--- /dev/null
+++ b/vcl/inc/qt5/QtX11Support.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+
+class QtX11Support final
+{
+static constexpr const char* m_sWindowGroupName = "WM_CLIENT_LEADER\0";
+static xcb_atom_t m_nWindowGroupAtom;
+static bool m_bDidAtomLookups;
+
+static xcb_atom_t lookupAtom(xcb_connection_t*, const char* const 
sAtomName);
+static void fetchAtoms();
+
+public:
+static bool fixICCCMwindowGroup(xcb_window_t nWinId);
+static void setApplicationID(xcb_window_t nWinId, std::u16string_view 
rWMClass);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt6/QtX11Support.hxx b/vcl/inc/qt6/QtX11Support.hxx
new file mode 100644
index ..df4ae0d1e069
--- /dev/null
+++ b/vcl/inc/qt6/QtX11Support.hxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "../qt5/QtX11Support.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 31ca3c432be9..006ad4a8bfc1 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -31,12 +31,14 @@
 #include 
 #include 
 #include 
+#if CHECK_ANY_QT_USING_X11
+#include 
+#endif
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -50,13 +52,8 @@
 #endif
 #include 
 #include 
-
 #if CHECK_QT5_USING_X11
 #include 
-#include 
-#if QT5_HAVE_XCB_ICCCM
-#include 
-#endif
 #endif
 
 #include 
@@ -71,7 +68,6 @@
 
 #if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM
 static bool g_bNeedsWmHintsWindowGroup = true;
-static xcb_atom_t g_aXcbClientLeaderAtom = 0;
 #endif
 
 static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 
nExtentsY,
@@ -228,9 +224,6 @@ void QtFrame::FillSystemEnvData(SystemEnvData& rData, 
sal_IntPtr pWindow, QWidge
 void QtFrame::fixICCCMwindowGroup()
 {
 #if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM
-// older Qt5 just sets WM_CLIENT_LEADER, but not the 
XCB_ICCCM_WM_HINT_WINDOW_GROUP
-// see Qt commit 0de4b326d8 ("xcb: fix issue with dialogs hidden by other 
windows")
-// or QTBUG-46626. So LO has to set this itself to help some WMs.
 if 

[Libreoffice-commits] core.git: include/tools tools/source

2022-06-17 Thread Jan-Marek Glogowski (via logerrit)
 include/tools/gen.hxx|   30 +-
 tools/source/generic/gen.cxx |   17 -
 2 files changed, 29 insertions(+), 18 deletions(-)

New commits:
commit 80d801cf07b6583e824ad89c3c750b076118f41d
Author: Jan-Marek Glogowski 
AuthorDate: Tue Jun 14 05:37:30 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 17 20:41:28 2022 +0200

Rectangle: split SetSize into SetWidth/SetHeight

... and inline the functions.

Change-Id: I9285c72e8524f8f0a2d242bfd4cd29edf6d1ed73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135811
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 7a8e66e2a6ff..ab8b443ca403 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -537,7 +537,9 @@ public:
 /// Set the top edge of the rectangle to y, preserving the height
 inline void SetPosY(tools::Long y);
 inline void SetPos( const Point& rPoint );
-voidSetSize( const Size& rSize );
+inline void SetWidth(tools::Long);
+inline void SetHeight(tools::Long);
+inline void SetSize(const Size&);
 
 constexpr Point GetPos() const { return TopLeft(); }
 constexpr Size GetSize() const { return { GetWidth(), GetHeight() }; }
@@ -671,6 +673,32 @@ inline void tools::Rectangle::SetPos( const Point& rPoint )
 SetPosY(rPoint.Y());
 }
 
+inline void tools::Rectangle::SetWidth(tools::Long nWidth)
+{
+if (nWidth < 0)
+nRight = nLeft + nWidth + 1;
+else if (nWidth > 0)
+nRight = nLeft + nWidth - 1;
+else
+SetWidthEmpty();
+}
+
+inline void tools::Rectangle::SetHeight(tools::Long nHeight)
+{
+if (nHeight < 0)
+nBottom = nTop + nHeight + 1;
+else if (nHeight > 0)
+nBottom = nTop + nHeight - 1;
+else
+SetHeightEmpty();
+}
+
+inline void tools::Rectangle::SetSize(const Size& rSize)
+{
+SetWidth(rSize.Width());
+SetHeight(rSize.Height());
+}
+
 constexpr inline tools::Long tools::Rectangle::GetWidth() const
 {
 tools::Long n = 0;
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 27120d6abbd1..069b7482cfba 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -42,23 +42,6 @@ size_t Pair::GetHashValue() const
 return hash;
 }
 
-void tools::Rectangle::SetSize( const Size& rSize )
-{
-if ( rSize.Width() < 0 )
-nRight  = nLeft + rSize.Width() +1;
-else if ( rSize.Width() > 0 )
-nRight  = nLeft + rSize.Width() -1;
-else
-SetWidthEmpty();
-
-if ( rSize.Height() < 0 )
-nBottom  = nTop + rSize.Height() +1;
-else if ( rSize.Height() > 0 )
-nBottom  = nTop + rSize.Height() -1;
-else
-SetHeightEmpty();
-}
-
 void tools::Rectangle::SaturatingSetSize(const Size& rSize)
 {
 if (rSize.Width() < 0)


[Libreoffice-commits] core.git: include/vcl vcl/inc

2022-06-17 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/WindowPosSize.hxx |5 +++--
 include/vcl/windowstate.hxx   |   29 +
 vcl/inc/salgeom.hxx   |2 +-
 3 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit e2a8b4a420ab0f726c43ec6c609d17211cd6ed11
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 12 08:01:32 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 17 20:27:50 2022 +0200

Fix and add ostreams for vcl::WindowPosSize

... and inheriting classes.

Follow-up on commit ea5a0918c8c32309821ab239c4b95f4d6a3b5c12
("VCL add vcl::WindowPosSize abstract class").

Change-Id: I4733cd4619f91fe1ba05c208a650be591ecf5d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135806
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/WindowPosSize.hxx b/include/vcl/WindowPosSize.hxx
index ed52488be33a..6c5484c47b30 100644
--- a/include/vcl/WindowPosSize.hxx
+++ b/include/vcl/WindowPosSize.hxx
@@ -124,9 +124,10 @@ public:
 void setPosSize(const Point& rPos, const Size& rSize) { setPosSize({ rPos, 
rSize }); }
 };
 
-inline std::ostream& operator<<(std::ostream& s, const WindowPosSize& rGeom)
+inline std::ostream& operator<<(std::ostream& s, const WindowPosSize& rPosSize)
 {
-s << rGeom.width() << "x" << rGeom.height() << "@(" << rGeom.x() << "," << 
rGeom.y() << ")";
+s << rPosSize.width() << "x" << rPosSize.height() << "@(" << rPosSize.x() 
<< "," << rPosSize.y()
+  << ")";
 return s;
 }
 
diff --git a/include/vcl/windowstate.hxx b/include/vcl/windowstate.hxx
index 772d5c397f76..ed3cbf1a7f6e 100644
--- a/include/vcl/windowstate.hxx
+++ b/include/vcl/windowstate.hxx
@@ -115,6 +115,35 @@ template <> struct typed_flags : 
is_typed_flags(rData.state()) << 
std::dec;
+else
+s << "?";
+return s;
+}
+
+} // namespace vcl
+
 #endif // INCLUDED_VCL_WINDOWSTATE_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/salgeom.hxx b/vcl/inc/salgeom.hxx
index 63675b6d9ceb..1b19931c5c50 100644
--- a/vcl/inc/salgeom.hxx
+++ b/vcl/inc/salgeom.hxx
@@ -98,7 +98,7 @@ public:
 
 inline std::ostream& operator<<(std::ostream& s, const SalFrameGeometry& rGeom)
 {
-s << static_cast() << ":{" << 
rGeom.leftDecoration() << ","
+s << *static_cast() << ":{" << 
rGeom.leftDecoration() << ","
   << rGeom.topDecoration() << "," << rGeom.rightDecoration() << "," << 
rGeom.bottomDecoration()
   << "}s" << rGeom.screen();
 return s;


[Libreoffice-commits] core.git: vcl/inc vcl/win

2022-06-17 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/win/salframe.h  |   10 +-
 vcl/win/window/salframe.cxx |  201 +---
 2 files changed, 88 insertions(+), 123 deletions(-)

New commits:
commit 8b6000f6075725b2e17b8fa745251ea96d7185f1
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 13 10:26:18 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 17 19:58:08 2022 +0200

WIN drop window state redundancies

So on Windows a window's state is stored in:
- maGeometry, inherited from SalFrame
- maState, which is the same type then maGeometry
- mnWidth and mnHeight, which are just set, never read
- mbFullScreen, which can be encoded in the vcl::WindowState

IMHO we can get rid of mnWidth, mnHeight and mbFullScreen. Which
leaves the mystery of the extra maState. But at least it looks
like we can simply cache an vcl::WindowState instead.

And this is a little start to make WinSalFrame variable members
private; it'll be a long way...

And it also changes a SW_SHOWMAXIMIZED to SW_SHOWMINIMIZED in the
cleaned UpdateFrameState(), which looks like an error.

Change-Id: I5895313d87a6f81371e2b77af6c813d35f591725
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135809
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 0e3cbba81253..bbf3506a723f 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -33,6 +33,8 @@ class WinSalGraphics;
 
 class WinSalFrame final: public SalFrame
 {
+vcl::WindowState m_eState;
+
 public:
 HWNDmhWnd;  // Window handle
 HCURSOR mhCursor;   // cursor handle
@@ -43,10 +45,7 @@ public:
 HMENU   mSelectedhMenu; // the menu where 
highlighting is currently going on
 HMENU   mLastActivatedhMenu;// the menu that was most 
recently opened
 SystemEnvData   maSysData;  // system data
-vcl::WindowData maState; ///< frame state
 int mnShowState;// show state
-LONGmnWidth;// client width in pixeln
-LONGmnHeight;   // client height in pixeln
 int mnMinWidth; // min. client width in 
pixeln
 int mnMinHeight;// min. client height in 
pixeln
 int mnMaxWidth; // max. client width in 
pixeln
@@ -64,7 +63,6 @@ public:
 boolmbSizeBorder;   // has window a sizeable 
border
 boolmbNoIcon;   // is a window without an 
icon
 boolmbFloatWin; // is a FloatingWindow
-boolmbFullScreen;   // TRUE: in full screen 
mode
 boolmbPresentation; // TRUE: Presentation Mode 
running
 boolmbInShow;   // inside a show call
 boolmbRestoreMaximize;  // Restore-Maximize
@@ -141,6 +139,10 @@ public:
 virtual voidBeginSetClipRegion( sal_uInt32 nRects ) 
override;
 virtual voidUnionClipRegion( tools::Long nX, tools::Long 
nY, tools::Long nWidth, tools::Long nHeight ) override;
 virtual voidEndSetClipRegion() override;
+
+constexpr vcl::WindowState state() const { return m_eState; }
+void UpdateFrameState();
+constexpr bool isFullScreen() const { return bool(m_eState & 
vcl::WindowState::FullScreen); }
 };
 
 void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 2b2bd6cb7b72..567d95eec233 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -128,7 +128,7 @@ bool WinSalFrame::mbInReparent = false;
 // Macros for support of WM_UNICHAR & Keyman 6.0
 #define Uni_SupplementaryPlanesStart0x1
 
-static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
+static void UpdateFrameGeometry(WinSalFrame* pFrame);
 static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* 
pParentRect = nullptr );
 
 static void SetGeometrySize(vcl::WindowPosSize& rWinPosSize, const Size& rSize)
@@ -137,57 +137,37 @@ static void SetGeometrySize(vcl::WindowPosSize& 
rWinPosSize, const Size& rSize)
 rWinPosSize.setHeight(rSize.Height() < 0 ? 0 : rSize.Height());
 }
 
-static void UpdateGeometry(WinSalFrame* pFrame, RECT& aRect)
+// If called with UpdateFrameGeometry, it must be called after it, as 
UpdateFrameGeometry
+// updates the geometry depending on the old state!
+void WinSalFrame::UpdateFrameState()
 {
-RECT aRect2 = aRect;
-AdjustWindowRectEx(, GetWindowStyle(pFrame->mhWnd),
-   FALSE, GetWindowExStyle(pFrame->mhWnd));
-   

[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/unx

2022-06-17 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/windowstate.hxx  |1 +
 vcl/inc/window.h |2 --
 vcl/source/window/syswin.cxx |8 +++-
 vcl/unx/gtk3/gtkinst.cxx |4 +---
 4 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 2e509b886f1d77ef158579385b55f1f94cfbc710
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 12 17:42:05 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 17 19:14:05 2022 +0200

Convert ImplWindowStateFromStr to WindowData(str)

To have a constructor as the counterpart of the toStr() function.
Better then some unrelated independant function.

Change-Id: Iba4cb3d400a92704753db6b35d12f2189b23077e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135807
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/windowstate.hxx b/include/vcl/windowstate.hxx
index b78162ddf52e..772d5c397f76 100644
--- a/include/vcl/windowstate.hxx
+++ b/include/vcl/windowstate.hxx
@@ -80,6 +80,7 @@ public:
 , mnMaximizedHeight(0)
 {
 }
+WindowData(std::string_view rStr);
 
 // serialize values to a string (the original WindowState representation)
 OString toStr() const;
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 18e1a3e1e417..3021e8bc7b6b 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -433,8 +433,6 @@ bool ImplLOKHandleMouseEvent( const VclPtr& 
xWindow, MouseNotifyEve
 
 void ImplHandleResize( vcl::Window* pWindow, tools::Long nNewWidth, 
tools::Long nNewHeight );
 
-VCL_DLLPUBLIC void ImplWindowStateFromStr(vcl::WindowData& rData, 
std::string_view rStr);
-
 VCL_DLLPUBLIC css::uno::Reference
 
FindFocusedEditableText(css::uno::Reference
 const&);
 
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 113b2da02689..5a5baf380e71 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -399,8 +399,9 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const
 return mpImplData->maMaxOutSize;
 }
 
-void ImplWindowStateFromStr(vcl::WindowData& rData, std::string_view rStr)
+vcl::WindowData::WindowData(std::string_view rStr)
 {
+vcl::WindowData& rData = *this;
 vcl::WindowDataMask nValidMask = vcl::WindowDataMask::NONE;
 sal_Int32 nIndex  = 0;
 
@@ -826,10 +827,7 @@ void SystemWindow::SetWindowState(std::string_view rStr)
 {
 if (rStr.empty())
 return;
-
-vcl::WindowData aData;
-ImplWindowStateFromStr( aData, rStr );
-SetWindowState( aData );
+SetWindowState(vcl::WindowData(rStr));
 }
 
 OString SystemWindow::GetWindowState(vcl::WindowDataMask nMask) const
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a49e32dc8cfa..6959f80698b0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -6334,9 +6334,7 @@ public:
 
 virtual void set_window_state(const OString& rStr) override
 {
-vcl::WindowData aData;
-ImplWindowStateFromStr( aData, rStr );
-
+const vcl::WindowData aData(rStr);
 const auto nMask = aData.mask();
 const auto nState = aData.state() & vcl::WindowState::SystemMask;
 


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-06-17 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |   24 +++-
 vcl/qt5/QtWidget.cxx |   25 -
 2 files changed, 15 insertions(+), 34 deletions(-)

New commits:
commit 393c9f736b10d1ea82979e9c2c43c8f91ba5831d
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 19 16:00:31 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 17 17:27:16 2022 +0200

Qt use QEvent::type to handle the event correctly

No need for an extra function parameter.

Change-Id: Iedb949b45ad3f161121110e2db2132b6c3cb706e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135894
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e644e7f70cd9..e61357198027 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -42,17 +42,10 @@ class QtWidget : public QWidget
 int m_nDeltaX;
 int m_nDeltaY;
 
-enum class ButtonKeyState
-{
-Pressed,
-Released
-};
-
 static void commitText(QtFrame&, const QString& aText);
 static void deleteReplacementText(QtFrame& rFrame, int nReplacementStart,
   int nReplacementLength);
-static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*, const 
ButtonKeyState);
-static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*, 
const ButtonKeyState);
+static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*);
 static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
 static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
   const QPoint& rPos, Qt::MouseButtons 
eButtons, int nWidth,
@@ -101,23 +94,12 @@ public:
 // key events might be propagated further down => call base on false
 static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, 
QKeyEvent*);
 // mouse events are always accepted
-static inline void handleMousePressEvent(const QtFrame&, const 
QMouseEvent*);
-static inline void handleMouseReleaseEvent(const QtFrame&, const 
QMouseEvent*);
+static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*);
 };
 
 bool QtWidget::handleKeyReleaseEvent(QtFrame& rFrame, const QWidget& rWidget, 
QKeyEvent* pEvent)
 {
-return handleKeyEvent(rFrame, rWidget, pEvent, ButtonKeyState::Released);
-}
-
-void QtWidget::handleMousePressEvent(const QtFrame& rFrame, const QMouseEvent* 
pEvent)
-{
-handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Pressed);
-}
-
-void QtWidget::handleMouseReleaseEvent(const QtFrame& rFrame, const 
QMouseEvent* pEvent)
-{
-handleMouseButtonEvent(rFrame, pEvent, ButtonKeyState::Released);
+return handleKeyEvent(rFrame, rWidget, pEvent);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 5c6fc002ac22..e26e1e3aee1f 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -153,8 +153,7 @@ void QtWidget::fillSalAbstractMouseEvent(const QtFrame& 
rFrame, const QInputEven
 #define FILL_SAME(rFrame, nWidth)  
\
 fillSalAbstractMouseEvent(rFrame, pEvent, pEvent->pos(), 
pEvent->buttons(), nWidth, aEvent)
 
-void QtWidget::handleMouseButtonEvent(const QtFrame& rFrame, const 
QMouseEvent* pEvent,
-  const ButtonKeyState eState)
+void QtWidget::handleMouseButtonEvent(const QtFrame& rFrame, const 
QMouseEvent* pEvent)
 {
 SalMouseEvent aEvent;
 FILL_SAME(rFrame, rFrame.GetQWidget()->width());
@@ -175,7 +174,7 @@ void QtWidget::handleMouseButtonEvent(const QtFrame& 
rFrame, const QMouseEvent*
 }
 
 SalEvent nEventType;
-if (eState == ButtonKeyState::Pressed)
+if (pEvent->type() == QEvent::MouseButtonPress)
 nEventType = SalEvent::MouseButtonDown;
 else
 nEventType = SalEvent::MouseButtonUp;
@@ -184,13 +183,13 @@ void QtWidget::handleMouseButtonEvent(const QtFrame& 
rFrame, const QMouseEvent*
 
 void QtWidget::mousePressEvent(QMouseEvent* pEvent)
 {
-handleMousePressEvent(m_rFrame, pEvent);
+handleMouseButtonEvent(m_rFrame, pEvent);
 if (m_rFrame.isPopup()
 && !geometry().translated(geometry().topLeft() * 
-1).contains(pEvent->pos()))
 closePopup();
 }
 
-void QtWidget::mouseReleaseEvent(QMouseEvent* pEvent) { 
handleMouseReleaseEvent(m_rFrame, pEvent); }
+void QtWidget::mouseReleaseEvent(QMouseEvent* pEvent) { 
handleMouseButtonEvent(m_rFrame, pEvent); }
 
 void QtWidget::mouseMoveEvent(QMouseEvent* pEvent)
 {
@@ -514,11 +513,12 @@ void QtWidget::deleteReplacementText(QtFrame& rFrame, int 
nReplacementStart, int
 rFrame.CallCallback(SalEvent::DeleteSurroundingTextRequest, );
 }
 
-bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, 
QKeyEvent* pEvent,
-  const ButtonKeyState eState)
+bool 

[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/osx vcl/qt5 vcl/source vcl/unx vcl/win

2022-06-15 Thread Jan-Marek Glogowski (via logerrit)
 vcl/headless/svpframe.cxx   |4 
 vcl/inc/headless/svpframe.hxx   |1 -
 vcl/inc/osx/salframe.h  |1 -
 vcl/inc/qt5/QtFrame.hxx |1 -
 vcl/inc/salframe.hxx|1 -
 vcl/inc/unx/gtk/gtkframe.hxx|1 -
 vcl/inc/unx/salframe.h  |1 -
 vcl/inc/win/salframe.h  |1 -
 vcl/osx/salframe.cxx|4 
 vcl/qt5/QtFrame.cxx |2 --
 vcl/source/window/menubarwindow.cxx |3 ---
 vcl/unx/generic/window/salframe.cxx |5 -
 vcl/unx/gtk3/gtkframe.cxx   |4 
 vcl/win/window/salframe.cxx |5 -
 14 files changed, 34 deletions(-)

New commits:
commit 14dfbfe1da056d9570c85df8b5d5bed3943d46e9
Author: Jan-Marek Glogowski 
AuthorDate: Sat Jun 11 01:49:02 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 15 12:17:36 2022 +0200

Drop SalMenu::DrawMenuBar (is WIN-only)

This follow-up on commit 483f3125ecd4744cbcc2f8fd3cdf243d81a601ff
("WIN drop effectively empty ImplDrawMenuBar") should probably
have been included in it. Windows was the only implementation of
that API, but the API is just called for a native menubar, which
Windows doesn't use (VisibleMenuBar returns false). Maybe Windows
SalFrame::SetMenu should also be dropped?

Change-Id: Ic3600e66c91ce9d56d7f911bce5674e0a9ee833c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135633
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 62b43dfd0824..9ab3864aa7cd 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -200,10 +200,6 @@ void SvpSalFrame::SetMenu( SalMenu* )
 {
 }
 
-void SvpSalFrame::DrawMenuBar()
-{
-}
-
 void SvpSalFrame::SetExtendedFrameStyle( SalExtStyle )
 {
 }
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index f2fce5c420b4..bb15711aef53 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -80,7 +80,6 @@ public:
 virtual voidSetTitle( const OUString& rTitle ) override;
 virtual voidSetIcon( sal_uInt16 nIcon ) override;
 virtual voidSetMenu( SalMenu* pMenu ) override;
-virtual voidDrawMenuBar() override;
 
 virtual voidSetExtendedFrameStyle( SalExtStyle nExtStyle ) 
override;
 virtual voidShow( bool bVisible, bool bNoActivate = false 
) override;
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 953a17adbcc9..71b8eb45b772 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -116,7 +116,6 @@ public:
 virtual voidSetIcon( sal_uInt16 nIcon ) override;
 virtual voidSetRepresentedURL( const OUString& ) override;
 virtual voidSetMenu( SalMenu* pSalMenu ) override;
-virtual voidDrawMenuBar() override;
 virtual voidShow( bool bVisible, bool bNoActivate = false 
) override;
 virtual voidSetMinClientSize( tools::Long nWidth, 
tools::Long nHeight )
 override;
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index dcdca17844ae..562c7d3ba89a 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -160,7 +160,6 @@ public:
 virtual void SetTitle(const OUString& rTitle) override;
 virtual void SetIcon(sal_uInt16 nIcon) override;
 virtual void SetMenu(SalMenu* pMenu) override;
-virtual void DrawMenuBar() override;
 
 virtual void registerDragSource(QtDragSource* pDragSource);
 virtual void deregisterDragSource(QtDragSource const* pDragSource);
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index e6c111c1dab5..45ed72956656 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -144,7 +144,6 @@ public:
 virtual voidSetIcon( sal_uInt16 nIcon ) = 0;
 virtual voidSetRepresentedURL( const OUString& );
 virtual voidSetMenu( SalMenu *pSalMenu ) = 0;
-virtual voidDrawMenuBar() = 0;
 
 virtual voidSetExtendedFrameStyle( SalExtStyle nExtStyle ) = 0;
 
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 2adacd1ee5ba..80696439ea79 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -506,7 +506,6 @@ public:
 virtual voidSetIcon( sal_uInt16 nIcon ) override;
 virtual voidSetMenu( SalMenu *pSalMenu ) override;
 SalMenu*GetMenu();
-virtual voidDrawMenuBar() override;
 voidEnsureAppMenuWatch();
 
 virtual voidSetExtendedFrameStyle( SalExtStyle nExtStyle ) 
override;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 46d23f71aaf9..597657333128 100644
--- 

[Libreoffice-commits] core.git: vcl/inc vcl/unx

2022-06-14 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/salframe.hxx|2 --
 vcl/inc/unx/salframe.h  |3 +++
 vcl/unx/generic/window/salframe.cxx |   19 ---
 vcl/unx/gtk3/gtkframe.cxx   |6 --
 4 files changed, 11 insertions(+), 19 deletions(-)

New commits:
commit ec1019f2dac25d8e3d114553ff26eba21275f649
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 12 07:48:09 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 14 13:28:36 2022 +0200

Make PARTIAL_FULLSCREEN a X11SalFrame bool

SalFrameStyleFlags::PARTIAL_FULLSCREEN is just ever read in
X11SalFrame, so there is no need to have it as a "global" flag.
Just save it as a member boolean and drop it from gtk3.

FWIW: consolidating all the booleans in X11SalFrame as a bitfield
(AKA reorder the fields and declare them bool myvar : 1;) might
be a nice easy hack.

Change-Id: I6a94310d3b734ecfd083b520d613a076b1e7670a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135805
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index b7dcea63e64f..e6c111c1dab5 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -78,8 +78,6 @@ enum class SalFrameStyleFlags
 DIALOG  = 0x0080,
 // the window containing the intro bitmap, aka splashscreen
 INTRO   = 0x0100,
-// partial fullscreen: fullscreen on one monitor of a multimonitor display
-PARTIAL_FULLSCREEN  = 0x0080,
 // tdf#144624: don't set icon
 NOICON  = 0x0100,
 // system child window inside another SalFrame
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 7b804b0cc089..46d23f71aaf9 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -114,6 +114,7 @@ class X11SalFrame final : public SalFrame
 boolmbMaximizedVert;
 boolmbMaximizedHorz;
 boolmbFullScreen;
+bool m_bIsPartialFullScreen;
 
 // icon id
 int mnIconID;
@@ -168,6 +169,8 @@ public:
 voidInit( SalFrameStyleFlags nSalFrameStyle, SalX11Screen 
nScreen,
   SystemParentData const * pParentData, bool 
bUseGeometry = false );
 
+bool IsPartialFullScreen() const { return m_bIsPartialFullScreen; }
+
 SalDisplay* GetDisplay() const
 {
 return pDisplay_;
diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index c2036167148f..bd0ffd7e 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -721,9 +721,7 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, 
SalX11Screen nXScreen
 }
 #define DECOFLAGS (SalFrameStyleFlags::MOVEABLE | SalFrameStyleFlags::SIZEABLE 
| SalFrameStyleFlags::CLOSEABLE)
 int nDecoFlags = WMAdaptor::decoration_All;
-if( (nStyle_ & SalFrameStyleFlags::PARTIAL_FULLSCREEN) ||
-(nStyle_ & SalFrameStyleFlags::OWNERDRAWDECORATION)
-)
+if (m_bIsPartialFullScreen || (nStyle_ & 
SalFrameStyleFlags::OWNERDRAWDECORATION))
 nDecoFlags = 0;
 else if( (nStyle_ & DECOFLAGS ) != DECOFLAGS || (nStyle_ & 
SalFrameStyleFlags::TOOLWINDOW) )
 {
@@ -757,8 +755,7 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, 
SalX11Screen nXScreen
 eType = WMWindowType::Utility;
 if( nStyle_ & SalFrameStyleFlags::OWNERDRAWDECORATION )
 eType = WMWindowType::Toolbar;
-if((nStyle_ & SalFrameStyleFlags::PARTIAL_FULLSCREEN)
-&& GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+if (m_bIsPartialFullScreen && 
GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen())
 eType = WMWindowType::Dock;
 
 GetDisplay()->getWMAdaptor()->
@@ -767,11 +764,10 @@ void X11SalFrame::Init( SalFrameStyleFlags 
nSalFrameStyle, SalX11Screen nXScreen
nDecoFlags,
hPresentationWindow ? nullptr : 
mpParent );
 
-if( (nStyle_ & (SalFrameStyleFlags::DEFAULT |
+if (!m_bIsPartialFullScreen && (nStyle_ & (SalFrameStyleFlags::DEFAULT 
|
 SalFrameStyleFlags::OWNERDRAWDECORATION|
 SalFrameStyleFlags::FLOAT |
-SalFrameStyleFlags::INTRO |
-SalFrameStyleFlags::PARTIAL_FULLSCREEN) )
+SalFrameStyleFlags::INTRO))
  == SalFrameStyleFlags::DEFAULT )
 pDisplay_->getWMAdaptor()->maximizeFrame( this );
 
@@ -844,6 +840,7 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, 
SalFrameStyleFlags nSalFrameStyle,
 mbMaximizedVert = false;
 mbMaximizedHorz = false;
 mbFullScreen= false;
+m_bIsPartialFullScreen = false;
 
 mnIconID= SV_ICON_ID_OFFICE;
 
@@ 

[Libreoffice-commits] core.git: configure.ac

2022-06-11 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5b0c50544d3b1a5f2bfc5636384981caefe37f3b
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jun 9 20:02:34 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 11 10:20:22 2022 +0200

WASM use 'em-config LLVM_ROOT' to get llvm-nm path

Change-Id: I3073330ed25676d5fbf9f2af008e42828466fc3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135565
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/configure.ac b/configure.ac
index 11e697c733f8..3883c3176e44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12917,7 +12917,7 @@ then
 AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} 
or ${QT5_PLATFORMS_SRCDIR}])
 fi
 
-EMSDK_LLVM_NM="$(em-config EMSCRIPTEN_ROOT)"/../bin/llvm-nm
+EMSDK_LLVM_NM="$(em-config LLVM_ROOT)"/llvm-nm
 if ! test -x "$EMSDK_LLVM_NM"; then
 AC_MSG_ERROR([Missing llvm-nm expected to be found at 
"$EMSDK_LLVM_NM".])
 fi


[Libreoffice-commits] core.git: external/redland

2022-06-09 Thread Jan-Marek Glogowski (via logerrit)
 external/redland/ExternalProject_raptor.mk  |2 +-
 external/redland/ExternalProject_rasqal.mk  |2 +-
 external/redland/ExternalProject_redland.mk |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 136fac12eb9752f1072f852cc193d6a9accdc4a7
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jun 9 06:39:32 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jun 9 09:50:46 2022 +0200

redland WASM: add Emscripten flags to fix NEH build

Change-Id: I4ed242e774e1ce2ac05dabb9fc657329dc4a63c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135519
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/external/redland/ExternalProject_raptor.mk 
b/external/redland/ExternalProject_raptor.mk
index 324d231c5073..b3ae74c10b61 100644
--- a/external/redland/ExternalProject_raptor.mk
+++ b/external/redland/ExternalProject_raptor.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build):
LDFLAGS=" \
$(if $(filter LINUX 
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin 
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX 
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
-   CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include)" \
+   CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include) 
$(gb_EMSCRIPTEN_CPPFLAGS)" \
$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
 --enable-parsers="rdfxml ntriples turtle trig guess 
rss-tag-soup" \
--with-www=xml \
diff --git a/external/redland/ExternalProject_rasqal.mk 
b/external/redland/ExternalProject_rasqal.mk
index dd8887c669c8..e7d1fdb1195d 100644
--- a/external/redland/ExternalProject_rasqal.mk
+++ b/external/redland/ExternalProject_rasqal.mk
@@ -22,7 +22,7 @@ $(eval $(call gb_ExternalProject_register_targets,rasqal,\
 $(call gb_ExternalProject_get_state_target,rasqal,build):
$(call gb_Trace_StartRange,rasqal,EXTERNAL)
$(call gb_ExternalProject_run,build,\
-   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,rasqal)" \
+   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,rasqal) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if $(filter LINUX 
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin 
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX 
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
diff --git a/external/redland/ExternalProject_redland.mk 
b/external/redland/ExternalProject_redland.mk
index d4dd34519670..d92c642b9cd1 100644
--- a/external/redland/ExternalProject_redland.mk
+++ b/external/redland/ExternalProject_redland.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_ExternalProject_register_targets,redland,\
 $(call gb_ExternalProject_get_state_target,redland,build):
$(call gb_Trace_StartRange,redland,EXTERNAL)
$(call gb_ExternalProject_run,build,\
-   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,redland)" \
+   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,redland) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if $(filter LINUX 
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin 
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX 
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \


[Libreoffice-commits] core.git: external/libtiff

2022-06-08 Thread Jan-Marek Glogowski (via logerrit)
 external/libtiff/ExternalProject_libtiff.mk |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 98cfc7db5ed352b2ddb9a547c7f88abb83264cef
Author: Jan-Marek Glogowski 
AuthorDate: Wed Jun 8 17:44:56 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 8 18:53:32 2022 +0200

libtiff WASM: add Emscripten flags to fix NEH build

Change-Id: I3ea1ca064cdddee1bea6b5816f63f0e4a93217de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135505
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/external/libtiff/ExternalProject_libtiff.mk 
b/external/libtiff/ExternalProject_libtiff.mk
index 04af18322541..e318126dcfe0 100644
--- a/external/libtiff/ExternalProject_libtiff.mk
+++ b/external/libtiff/ExternalProject_libtiff.mk
@@ -50,7 +50,7 @@ $(call gb_ExternalProject_get_state_target,libtiff,build) :
--with-pic \
--without-x \
$(if 
$(verbose),--disable-silent-rules,--enable-silent-rules) \
-   CFLAGS="$(CFLAGS) $(call 
gb_ExternalProject_get_build_flags,libtiff)" \
+   CFLAGS="$(CFLAGS) $(call 
gb_ExternalProject_get_build_flags,libtiff) $(gb_EMSCRIPTEN_CFLAGS)" \
$(if $(SYSTEM_ZLIB),,--with-zlib-include-dir="$(call 
gb_UnpackedTarball_get_dir,zlib)") \
$(if 
$(SYSTEM_ZLIB),,--with-zlib-lib-dir="$(gb_StaticLibrary_WORKDIR)") \
$(if $(SYSTEM_LIBJPEG),,--with-jpeg-include-dir="$(call 
gb_UnpackedTarball_get_dir,libjpeg-turbo)") \
@@ -59,8 +59,8 @@ $(call gb_ExternalProject_get_state_target,libtiff,build) :
$(if $(SYSTEM_LIBWEBP),,$(if $(filter 
WNT,$(OS_FOR_BUILD)),\
--with-webp-lib-dir="$(call 
gb_UnpackedTarball_get_dir,libwebp)/output/lib/libwebp$(if 
$(MSVC_USE_DEBUG_RUNTIME),_debug)$(gb_StaticLibrary_PLAINEXT)", \
--with-webp-lib-dir="$(call 
gb_UnpackedTarball_get_dir,libwebp)/src/.libs")) \
-   CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
-   LDFLAGS="$(call 
gb_ExternalProject_get_link_flags,libtiff)" \
+   CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS) 
$(gb_EMSCRIPTEN_CPPFLAGS)" \
+   LDFLAGS="$(call 
gb_ExternalProject_get_link_flags,libtiff) $(gb_EMSCRIPTEN_LDFLAGS)" \
ac_cv_lib_z_inflateEnd=yes \
ac_cv_lib_jpeg_jpeg_read_scanlines=yes \
ac_cv_lib_webp_WebPDecode=yes \


[Libreoffice-commits] core.git: compilerplugins/clang fpicker/source framework/source include/tools include/vcl reportdesign/source sfx2/source solenv/clang-format sw/source vcl/headless vcl/inc vcl/o

2022-06-08 Thread Jan-Marek Glogowski (via logerrit)
 compilerplugins/clang/unusedenumconstants.untouched.results |4 
 compilerplugins/clang/unusedenumconstants.writeonly.results |2 
 fpicker/source/office/RemoteFilesDialog.cxx |2 
 fpicker/source/office/iodlg.cxx |2 
 framework/source/helper/persistentwindowstate.cxx   |2 
 include/tools/gen.hxx   |8 
 include/vcl/WindowPosSize.hxx   |  137 
 include/vcl/syswin.hxx  |6 
 include/vcl/vclenum.hxx |   39 -
 include/vcl/weld.hxx|3 
 include/vcl/windowstate.hxx |   98 ++-
 include/vcl/wrkwin.hxx  |2 
 reportdesign/source/ui/dlg/Formula.cxx  |2 
 reportdesign/source/ui/report/DesignView.cxx|4 
 reportdesign/source/ui/report/ReportController.cxx  |2 
 sfx2/source/appl/childwin.cxx   |8 
 sfx2/source/dialog/basedlgs.cxx |4 
 sfx2/source/dialog/recfloat.cxx |9 
 solenv/clang-format/excludelist |1 
 sw/source/ui/misc/bookmark.cxx  |3 
 sw/source/uibase/envelp/syncbtn.cxx |9 
 vcl/headless/svpframe.cxx   |   76 +-
 vcl/inc/headless/svpframe.hxx   |4 
 vcl/inc/osx/salframe.h  |4 
 vcl/inc/qt5/QtFrame.hxx |4 
 vcl/inc/salframe.hxx|   12 
 vcl/inc/salgeom.hxx |  101 ++-
 vcl/inc/salvtables.hxx  |2 
 vcl/inc/salwtype.hxx|   21 
 vcl/inc/unx/gtk/gtkframe.hxx|6 
 vcl/inc/unx/salframe.h  |4 
 vcl/inc/win/salframe.h  |8 
 vcl/inc/window.h|4 
 vcl/osx/salframe.cxx|  183 ++---
 vcl/osx/salframeview.mm |   34 -
 vcl/osx/salgdiutils.cxx |4 
 vcl/osx/salmenu.cxx |8 
 vcl/osx/salnativewidgets.cxx|4 
 vcl/qt5/QtFrame.cxx |   92 +-
 vcl/qt5/QtMainWindow.cxx|3 
 vcl/qt5/QtWidget.cxx|7 
 vcl/quartz/AquaGraphicsBackend.cxx  |2 
 vcl/source/app/salvtables.cxx   |2 
 vcl/source/gdi/salgdilayout.cxx |4 
 vcl/source/window/dockwin.cxx   |   22 
 vcl/source/window/event.cxx |4 
 vcl/source/window/menu.cxx  |2 
 vcl/source/window/printdlg.cxx  |2 
 vcl/source/window/syswin.cxx|  337 +-
 vcl/source/window/window.cxx|   46 -
 vcl/source/window/winproc.cxx   |4 
 vcl/source/window/wrkwin.cxx|   31 
 vcl/unx/generic/app/wmadaptor.cxx   |   87 +-
 vcl/unx/generic/gdi/gdiimpl.cxx |4 
 vcl/unx/generic/window/salframe.cxx |  378 +---
 vcl/unx/gtk3/gtkframe.cxx   |  204 ++
 vcl/unx/gtk3/gtkinst.cxx|   57 -
 vcl/unx/gtk3/gtksalmenu.cxx |4 
 vcl/win/gdi/gdiimpl.cxx |4 
 vcl/win/window/salframe.cxx |  145 ++--
 60 files changed, 1139 insertions(+), 1128 deletions(-)

New commits:
commit ea5a0918c8c32309821ab239c4b95f4d6a3b5c12
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jun 2 22:42:20 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 8 18:17:17 2022 +0200

VCL add vcl::WindowPosSize abstract class

... and use it to remove a duplicate and simplify code.

Should mostly be a refactoring, which was mainly done by some
larger sed calls, except for the new API calls, which helped
shrinking some LOC. All data is also now private.

Originally two of the "replaced" "classes" had unsigned width
and height and one had signed. Noel pointed out, that during
calculations, the value might get negative temporarly, so this
now settles with signed 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-06-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ced641a34f8312a7fb93ee87bf6f13f30914da3a
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 5 08:55:43 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jun 6 13:36:46 2022 +0200

tdf#137471 Qt return frame pos + client area size

My code comment about "drawable area" and Michaels bug comment
12 about the "frameGeometry()" usage were both half right. LO
expects the window's frame position and the drawable client area
size almost everywhere when "geometry" is involved. The frame's
border is stored in the decorations members of SalFrameGeometry.

Change-Id: Ic00ad1f1d74d7afadcaca0c01e1a41ea7f2833de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135434
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 3f8d3fd4649ef09e86c735617383a4bda0425540)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135375
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 8af59966dcd7..6c5f3b7f0002 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -725,8 +725,8 @@ bool QtFrame::GetWindowState(SalFrameState* pState)
 }
 else
 {
-// geometry() is the drawable area, which is wanted here
-QRect rect = scaledQRect(asChild()->geometry(), devicePixelRatioF());
+// we want the frame position and the client area size
+QRect rect = scaledQRect({ asChild()->pos(), asChild()->size() }, 
devicePixelRatioF());
 pState->mnX = rect.x();
 pState->mnY = rect.y();
 pState->mnWidth = rect.width();


[Libreoffice-commits] core.git: vcl/qt5

2022-06-05 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3f8d3fd4649ef09e86c735617383a4bda0425540
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 5 08:55:43 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sun Jun 5 12:17:45 2022 +0200

tdf#137471 Qt return frame pos + client area size

My code comment about "drawable area" and Michaels bug comment
12 about the "frameGeometry()" usage were both half right. LO
expects the window's frame position and the drawable client area
size almost everywhere when "geometry" is involved. The frame's
border is stored in the decorations members of SalFrameGeometry.

Change-Id: Ic00ad1f1d74d7afadcaca0c01e1a41ea7f2833de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135434
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 4b94273e1cff..3c63060855ab 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -741,8 +741,8 @@ bool QtFrame::GetWindowState(SalFrameState* pState)
 }
 else
 {
-// geometry() is the drawable area, which is wanted here
-QRect rect = scaledQRect(asChild()->geometry(), devicePixelRatioF());
+// we want the frame position and the client area size
+QRect rect = scaledQRect({ asChild()->pos(), asChild()->size() }, 
devicePixelRatioF());
 pState->mnX = rect.x();
 pState->mnY = rect.y();
 pState->mnWidth = rect.width();


[Libreoffice-commits] core.git: vcl/win

2022-06-04 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |   47 
 1 file changed, 18 insertions(+), 29 deletions(-)

New commits:
commit 428cc8da98ddb73f8abeaa3bddb555f3bd896a29
Author: Jan-Marek Glogowski 
AuthorDate: Fri Jun 3 00:24:24 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 4 20:25:54 2022 +0200

WIN refactor geometry updating

Change-Id: I34e710c022e6362dc2381327eb896610c35bcbf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135425
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 6f3b3ca507e5..2ae47ec57630 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -131,6 +131,22 @@ bool WinSalFrame::mbInReparent = false;
 static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
 static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* 
pParentRect = nullptr );
 
+static void UpdateGeometry(WinSalFrame* pFrame, RECT& aRect)
+{
+RECT aRect2 = aRect;
+AdjustWindowRectEx(, GetWindowStyle(pFrame->mhWnd),
+   FALSE, GetWindowExStyle(pFrame->mhWnd));
+tools::Long nTopDeco = abs(aRect.top - aRect2.top);
+tools::Long nLeftDeco = abs(aRect.left - aRect2.left);
+tools::Long nBottomDeco = abs(aRect.bottom - aRect2.bottom);
+tools::Long nRightDeco = abs(aRect.right - aRect2.right);
+
+pFrame->maState.mnX = aRect.left + nLeftDeco;
+pFrame->maState.mnY = aRect.top + nTopDeco;
+pFrame->maState.mnWidth = aRect.right - aRect.left - nLeftDeco - 
nRightDeco;
+pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco - 
nBottomDeco;
+}
+
 static void ImplSaveFrameState( WinSalFrame* pFrame )
 {
 // save position, size and state for GetWindowState()
@@ -154,42 +170,15 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
 WINDOWPLACEMENT aPlacement;
 aPlacement.length = sizeof(aPlacement);
 if( GetWindowPlacement( pFrame->mhWnd,  ) )
-{
-RECT aRect = aPlacement.rcNormalPosition;
-RECT aRect2 = aRect;
-AdjustWindowRectEx( , GetWindowStyle( pFrame->mhWnd ),
-FALSE,  GetWindowExStyle( pFrame->mhWnd ) 
);
-tools::Long nTopDeco = abs( aRect.top - aRect2.top );
-tools::Long nLeftDeco = abs( aRect.left - aRect2.left );
-tools::Long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
-tools::Long nRightDeco = abs( aRect.right - aRect2.right );
-
-pFrame->maState.mnX  = aRect.left + nLeftDeco;
-pFrame->maState.mnY  = aRect.top + nTopDeco;
-pFrame->maState.mnWidth  = aRect.right - aRect.left - 
nLeftDeco - nRightDeco;
-pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco 
- nBottomDeco;
-}
+UpdateGeometry(pFrame, aPlacement.rcNormalPosition);
 }
 else
 {
 RECT aRect;
 GetWindowRect( pFrame->mhWnd,  );
-
-// to be consistent with Unix, the frame state is without(!) 
decoration
-RECT aRect2 = aRect;
-AdjustWindowRectEx( , GetWindowStyle( pFrame->mhWnd ),
-FALSE, GetWindowExStyle( pFrame->mhWnd ) );
-tools::Long nTopDeco = abs( aRect.top - aRect2.top );
-tools::Long nLeftDeco = abs( aRect.left - aRect2.left );
-tools::Long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
-tools::Long nRightDeco = abs( aRect.right - aRect2.right );
+UpdateGeometry(pFrame, aRect);
 
 pFrame->maState.mnState &= 
~WindowStateState(WindowStateState::Minimized | WindowStateState::Maximized);
-// subtract decoration
-pFrame->maState.mnX  = aRect.left+nLeftDeco;
-pFrame->maState.mnY  = aRect.top+nTopDeco;
-pFrame->maState.mnWidth  = 
aRect.right-aRect.left-nLeftDeco-nRightDeco;
-pFrame->maState.mnHeight = 
aRect.bottom-aRect.top-nTopDeco-nBottomDeco;
 if ( bVisible )
 pFrame->mnShowState = SW_SHOWNORMAL;
 pFrame->mbRestoreMaximize = false;


[Libreoffice-commits] core.git: include/tools

2022-06-04 Thread Jan-Marek Glogowski (via logerrit)
 include/tools/gen.hxx |   68 ++
 1 file changed, 36 insertions(+), 32 deletions(-)

New commits:
commit 434d471e9b8e54626af332974268ffd8fce4a78e
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jun 2 22:35:15 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 4 19:30:10 2022 +0200

Rectangle: move inline definition into functions

... and add GetPos() as TopLeft() alias.

Change-Id: Ia2c169d40ed121e829802835011648281f48f585
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135424
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 6d4548065495..20da07cb99af 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -495,7 +495,7 @@ public:
 constexpr Rectangle( tools::Long nLeft, tools::Long nTop );
 constexpr Rectangle( const Point& rLT, const Size& rSize );
 
-inline constexpr static Rectangle Justify(const Point& rLT, const Point& 
rRB);
+constexpr inline static Rectangle Justify(const Point& rLT, const Point& 
rRB);
 
 constexpr tools::Long Left() const { return nLeft; }
 constexpr tools::Long Right() const { return IsWidthEmpty() ? nLeft : 
nRight; }
@@ -531,41 +531,13 @@ public:
 inline void SetPos( const Point& rPoint );
 voidSetSize( const Size& rSize );
 
+constexpr Point GetPos() const { return TopLeft(); }
 constexpr Size GetSize() const { return { GetWidth(), GetHeight() }; }
 
 /// Returns the difference between right and left, assuming the range is 
inclusive.
-constexpr tools::Long GetWidth() const
-{
-tools::Long n = 0;
-
-if (!IsWidthEmpty())
-{
-n = nRight - nLeft;
-if (n < 0)
-n--;
-else
-n++;
-}
-
-return n;
-}
-
+constexpr inline tools::Long GetWidth() const;
 /// Returns the difference between bottom and top, assuming the range is 
inclusive.
-constexpr tools::Long GetHeight() const
-{
-tools::Long n = 0;
-
-if (!IsHeightEmpty())
-{
-n = nBottom - nTop;
-if (n < 0)
-n--;
-else
-n++;
-}
-
-return n;
-}
+constexpr inline tools::Long GetHeight() const;
 
 tools::Rectangle&  Union( const tools::Rectangle& rRect );
 tools::Rectangle&  Intersection( const tools::Rectangle& rRect );
@@ -691,6 +663,38 @@ inline void tools::Rectangle::SetPos( const Point& rPoint )
 SetPosY(rPoint.Y());
 }
 
+constexpr inline tools::Long tools::Rectangle::GetWidth() const
+{
+tools::Long n = 0;
+
+if (!IsWidthEmpty())
+{
+n = nRight - nLeft;
+if (n < 0)
+n--;
+else
+n++;
+}
+
+return n;
+}
+
+constexpr inline tools::Long tools::Rectangle::GetHeight() const
+{
+tools::Long n = 0;
+
+if (!IsHeightEmpty())
+{
+n = nBottom - nTop;
+if (n < 0)
+n--;
+else
+n++;
+}
+
+return n;
+}
+
 inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& 
rRect ) const
 {
 tools::Rectangle aTmpRect( *this );


[Libreoffice-commits] core.git: vcl/qt5

2022-05-31 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtWidget.cxx |   47 ++-
 1 file changed, 22 insertions(+), 25 deletions(-)

New commits:
commit cd2ea94969b9c63b24e35e9b8e546cea0f62340e
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 31 21:03:39 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Jun 1 00:16:32 2022 +0200

Qt just resize the backing store on size change

... and if there is no need to create a Cairo surface if it
doesn't exists, there is no need for a fresh QImage either.

Change-Id: If607e03d246f3c31d66953b1e07a7af55659e64b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135209
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 74adcc4e974c..b2451123e7e6 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -98,38 +98,35 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent)
 
 if (m_rFrame.m_bUseCairo)
 {
-if (m_rFrame.m_pSvpGraphics)
+if (m_rFrame.m_pSurface)
 {
-cairo_surface_t* pSurface
-= cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, 
nHeight);
-cairo_surface_set_user_data(pSurface, 
SvpSalGraphics::getDamageKey(),
-_rFrame.m_aDamageHandler, nullptr);
-m_rFrame.m_pSvpGraphics->setSurface(pSurface, 
basegfx::B2IVector(nWidth, nHeight));
-UniqueCairoSurface old_surface(m_rFrame.m_pSurface.release());
-m_rFrame.m_pSurface.reset(pSurface);
-
-int min_width = 
qMin(cairo_image_surface_get_width(old_surface.get()), nWidth);
-int min_height = 
qMin(cairo_image_surface_get_height(old_surface.get()), nHeight);
-
-SalTwoRect rect(0, 0, min_width, min_height, 0, 0, min_width, 
min_height);
-
-m_rFrame.m_pSvpGraphics->copySource(rect, old_surface.get());
+const int nOldWidth = 
cairo_image_surface_get_width(m_rFrame.m_pSurface.get());
+const int nOldHeight = 
cairo_image_surface_get_height(m_rFrame.m_pSurface.get());
+if (nOldWidth != nWidth || nOldHeight != nHeight)
+{
+cairo_surface_t* pSurface
+= cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, 
nHeight);
+cairo_surface_set_user_data(pSurface, 
SvpSalGraphics::getDamageKey(),
+_rFrame.m_aDamageHandler, 
nullptr);
+m_rFrame.m_pSvpGraphics->setSurface(pSurface, 
basegfx::B2IVector(nWidth, nHeight));
+UniqueCairoSurface old_surface(m_rFrame.m_pSurface.release());
+m_rFrame.m_pSurface.reset(pSurface);
+
+const int nMinWidth = qMin(nOldWidth, nWidth);
+const int nMinHeight = qMin(nOldHeight, nHeight);
+SalTwoRect rect(0, 0, nMinWidth, nMinHeight, 0, 0, nMinWidth, 
nMinHeight);
+m_rFrame.m_pSvpGraphics->copySource(rect, old_surface.get());
+}
 }
 }
 else
 {
-QImage* pImage = nullptr;
-
-if (m_rFrame.m_pQImage)
-pImage = new QImage(m_rFrame.m_pQImage->copy(0, 0, nWidth, 
nHeight));
-else
+if (m_rFrame.m_pQImage && m_rFrame.m_pQImage->size() != QSize(nWidth, 
nHeight))
 {
-pImage = new QImage(nWidth, nHeight, Qt_DefaultFormat32);
-pImage->fill(Qt::transparent);
+QImage* pImage = new QImage(m_rFrame.m_pQImage->copy(0, 0, nWidth, 
nHeight));
+m_rFrame.m_pQtGraphics->ChangeQImage(pImage);
+m_rFrame.m_pQImage.reset(pImage);
 }
-
-m_rFrame.m_pQtGraphics->ChangeQImage(pImage);
-m_rFrame.m_pQImage.reset(pImage);
 }
 
 m_rFrame.CallCallback(SalEvent::Resize, nullptr);


[Libreoffice-commits] core.git: vcl/win

2022-05-31 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salmenu.cxx |   30 ++
 1 file changed, 2 insertions(+), 28 deletions(-)

New commits:
commit 483f3125ecd4744cbcc2f8fd3cdf243d81a601ff
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 31 21:14:00 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue May 31 22:45:40 2022 +0200

WIN drop effectively empty ImplDrawMenuBar

.. as VisibleMenuBar() just always returns false.

Change-Id: Ie793d84d57970cbf08b81b6ec0350b9b5fd4192c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135210
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx
index 6f8dc8bff283..91a15284aeb5 100644
--- a/vcl/win/window/salmenu.cxx
+++ b/vcl/win/window/salmenu.cxx
@@ -96,19 +96,6 @@ std::unique_ptr WinSalInstance::CreateMenuItem( 
const SalItemParams
 return std::unique_ptr(pSalMenuItem);
 }
 
-static void ImplDrawMenuBar( SalMenu *pMenu )
-{
-if( pMenu->VisibleMenuBar() )
-{
-// redrawing the menubar all the time actually seems to be unnecessary 
(it just flickers)
-/*
-WinSalMenu *pMenuBar = ImplFindMenuBar( pMenu );
-if( pMenuBar && pMenuBar->mhWnd )
-::DrawMenuBar( pMenuBar->mhWnd );
-*/
-}
-}
-
 /*
  * WinSalMenu
  */
@@ -166,10 +153,7 @@ void WinSalMenu::InsertItem( SalMenuItem* pSalMenuItem, 
unsigned nPos )
 if(!::InsertMenuItemW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
 else
-{
 pWItem->mpSalMenu = this;
-ImplDrawMenuBar( this );
-}
 }
 }
 
@@ -194,7 +178,6 @@ void WinSalMenu::RemoveItem( unsigned nPos )
 {
 if( pSalMenuItem )
 pSalMenuItem->mpSalMenu = nullptr;
-ImplDrawMenuBar( this );
 }
 }
 }
@@ -220,7 +203,6 @@ static void ImplRemoveItemById( WinSalMenu *pSalMenu, 
unsigned nItemId )
 {
 if( pSalMenuItem )
 pSalMenuItem->mpSalMenu = nullptr;
-ImplDrawMenuBar( pSalMenu );
 }
 }
 
@@ -247,21 +229,17 @@ void WinSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, 
SalMenu* pSubMenu, unsig
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ) )
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 
 void WinSalMenu::CheckItem( unsigned nPos, bool bCheck )
 {
-if( static_cast( -1 ) != ::CheckMenuItem( mhMenu, nPos, 
MF_BYPOSITION|(bCheck ? MF_CHECKED : MF_UNCHECKED) ) )
-ImplDrawMenuBar( this );
+::CheckMenuItem(mhMenu, nPos, MF_BYPOSITION|(bCheck ? MF_CHECKED : 
MF_UNCHECKED));
 }
 
 void WinSalMenu::EnableItem( unsigned nPos, bool bEnable )
 {
-if( -1 != ::EnableMenuItem( mhMenu, nPos, MF_BYPOSITION|(bEnable ? 
MF_ENABLED : (MF_DISABLED|MF_GRAYED) ) ) )
-ImplDrawMenuBar( this );
+::EnableMenuItem(mhMenu, nPos, MF_BYPOSITION|(bEnable ? MF_ENABLED : 
(MF_DISABLED|MF_GRAYED)));
 }
 
 void WinSalMenu::SetItemImage( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, 
const Image& rImage )
@@ -298,8 +276,6 @@ void WinSalMenu::SetItemText( unsigned nPos, SalMenuItem* 
pSalMenuItem, const OU
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 
@@ -323,8 +299,6 @@ void WinSalMenu::SetAccelerator( unsigned nPos, 
SalMenuItem* pSalMenuItem, const
 
 if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, >mInfo ))
 myerr = GetLastError();
-else
-ImplDrawMenuBar( this );
 }
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 4 commits - sw/source vcl/qt5 xmloff/source

2022-05-29 Thread Jan-Marek Glogowski (via logerrit)
 sw/source/core/layout/wsfrm.cxx   |   11 ++-
 vcl/qt5/QtFrame.cxx   |5 -
 vcl/qt5/QtGraphics_GDI.cxx|   66 --
 xmloff/source/text/XMLSectionFootnoteConfigImport.cxx |4 -
 4 files changed, 29 insertions(+), 57 deletions(-)

New commits:
commit e550dc702299fdaa146a24ff872ef3a3b2adeafd
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 27 19:08:41 2022 +0200
Commit: Andras Timar 
CommitDate: Sun May 29 21:39:48 2022 +0200

tdf#144601 Qt fix creating QImage with alpha mask

Rechecking the QImage documentation, this actually can be easily
done; no more bit twiddling, which I got wrong to begin with.

LO's alpha mask is inverted to Qt's expectations, but we have
invertPixels() and then apply it with setAlphaChannel(). And we
can even set the fAlpha using setOpacity()!

Change-Id: If2030d3f87d3a4698d1cd9af005d307c2ee63061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135044
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit 6959a18d1a8fea4d65498083dc3ba05f640d0f39)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135060

diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index f87de50827df..6849a3bc7bde 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -601,55 +601,24 @@ bool QtGraphicsBackend::blendAlphaBitmap(const 
SalTwoRect&, const SalBitmap& /*r
 return false;
 }
 
-static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap,
-  QImage& rAlphaImage)
+static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap)
 {
-if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1)
-{
-SAL_WARN("vcl.gdi", "unsupported alpha depth case: " << 
rAlphaBitmap.GetBitCount());
-return false;
-}
+assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize());
+assert(rAlphaBitmap.GetBitCount() == 8 || rAlphaBitmap.GetBitCount() == 1);
 
-const QImage* pBitmap = static_cast()->GetQImage();
-const QImage* pAlpha = static_cast()->GetQImage();
-rAlphaImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+QImage aAlphaMask = *static_cast()->GetQImage();
+aAlphaMask.invertPixels();
 
-if (rAlphaBitmap.GetBitCount() == 8)
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-image_line[3] = 255 - alpha_line[x];
-}
-}
-else
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-{
-if (x && !(x % 8))
-++alpha_line;
-if (0 != (*alpha_line & (1 << (7 - x % 8
-image_line[3] = 0;
-}
-}
-}
-
-return true;
+const QImage* pBitmap = static_cast()->GetQImage();
+QImage aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+aImage.setAlphaChannel(aAlphaMask);
+return aImage;
 }
 
 bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap)
 {
-QImage aImage;
-if (!getAlphaImage(rSourceBitmap, rAlphaBitmap, aImage))
-return false;
-drawScaledImage(rPosAry, aImage);
+drawScaledImage(rPosAry, getAlphaImage(rSourceBitmap, rAlphaBitmap));
 return true;
 }
 
@@ -659,20 +628,17 @@ bool QtGraphicsBackend::drawTransformedBitmap(const 
basegfx::B2DPoint& rNull,
   const SalBitmap& rSourceBitmap,
   const SalBitmap* pAlphaBitmap, 
double fAlpha)
 {
-if (fAlpha != 1.0)
-return false;
 QImage aImage;
-if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage))
-return false;
+if (!pAlphaBitmap)
+aImage = *static_cast()->GetQImage();
 else
-{
-const QImage* pBitmap = static_cast()->GetQImage();
-aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
-}
+aImage = getAlphaImage(rSourceBitmap, *pAlphaBitmap);
 
-QtPainter aPainter(*this);
 const basegfx::B2DVector aXRel = rX - rNull;
 const basegfx::B2DVector aYRel = rY - rNull;
+
+QtPainter aPainter(*this);
+aPainter.setOpacity(fAlpha);
 aPainter.setTransform(QTransform(aXRel.getX() / aImage.width(), 
aXRel.getY() / aImage.width(),
   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-05-29 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtGraphics_GDI.cxx |   66 ++---
 1 file changed, 16 insertions(+), 50 deletions(-)

New commits:
commit 5758469c11fbe199f0136941f9ffc8c29815f562
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 27 19:08:41 2022 +0200
Commit: Michael Weghorn 
CommitDate: Sun May 29 08:47:03 2022 +0200

tdf#144601 Qt fix creating QImage with alpha mask

Rechecking the QImage documentation, this actually can be easily
done; no more bit twiddling, which I got wrong to begin with.

LO's alpha mask is inverted to Qt's expectations, but we have
invertPixels() and then apply it with setAlphaChannel(). And we
can even set the fAlpha using setOpacity()!

Change-Id: If2030d3f87d3a4698d1cd9af005d307c2ee63061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135044
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit 6959a18d1a8fea4d65498083dc3ba05f640d0f39)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135060

diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index f87de50827df..6849a3bc7bde 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -601,55 +601,24 @@ bool QtGraphicsBackend::blendAlphaBitmap(const 
SalTwoRect&, const SalBitmap& /*r
 return false;
 }
 
-static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap,
-  QImage& rAlphaImage)
+static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap)
 {
-if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1)
-{
-SAL_WARN("vcl.gdi", "unsupported alpha depth case: " << 
rAlphaBitmap.GetBitCount());
-return false;
-}
+assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize());
+assert(rAlphaBitmap.GetBitCount() == 8 || rAlphaBitmap.GetBitCount() == 1);
 
-const QImage* pBitmap = static_cast()->GetQImage();
-const QImage* pAlpha = static_cast()->GetQImage();
-rAlphaImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+QImage aAlphaMask = *static_cast()->GetQImage();
+aAlphaMask.invertPixels();
 
-if (rAlphaBitmap.GetBitCount() == 8)
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-image_line[3] = 255 - alpha_line[x];
-}
-}
-else
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-{
-if (x && !(x % 8))
-++alpha_line;
-if (0 != (*alpha_line & (1 << (7 - x % 8
-image_line[3] = 0;
-}
-}
-}
-
-return true;
+const QImage* pBitmap = static_cast()->GetQImage();
+QImage aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+aImage.setAlphaChannel(aAlphaMask);
+return aImage;
 }
 
 bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap)
 {
-QImage aImage;
-if (!getAlphaImage(rSourceBitmap, rAlphaBitmap, aImage))
-return false;
-drawScaledImage(rPosAry, aImage);
+drawScaledImage(rPosAry, getAlphaImage(rSourceBitmap, rAlphaBitmap));
 return true;
 }
 
@@ -659,20 +628,17 @@ bool QtGraphicsBackend::drawTransformedBitmap(const 
basegfx::B2DPoint& rNull,
   const SalBitmap& rSourceBitmap,
   const SalBitmap* pAlphaBitmap, 
double fAlpha)
 {
-if (fAlpha != 1.0)
-return false;
 QImage aImage;
-if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage))
-return false;
+if (!pAlphaBitmap)
+aImage = *static_cast()->GetQImage();
 else
-{
-const QImage* pBitmap = static_cast()->GetQImage();
-aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
-}
+aImage = getAlphaImage(rSourceBitmap, *pAlphaBitmap);
 
-QtPainter aPainter(*this);
 const basegfx::B2DVector aXRel = rX - rNull;
 const basegfx::B2DVector aYRel = rY - rNull;
+
+QtPainter aPainter(*this);
+aPainter.setOpacity(fAlpha);
 aPainter.setTransform(QTransform(aXRel.getX() / aImage.width(), 
aXRel.getY() / aImage.width(),
  aYRel.getX() / aImage.height(), 
aYRel.getY() / aImage.height(),
  rNull.getX(), rNull.getY()));


[Libreoffice-commits] core.git: vcl/qt5

2022-05-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtGraphics_GDI.cxx |   66 ++---
 1 file changed, 16 insertions(+), 50 deletions(-)

New commits:
commit 6959a18d1a8fea4d65498083dc3ba05f640d0f39
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 27 19:08:41 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sun May 29 00:16:21 2022 +0200

tdf#144601 Qt fix creating QImage with alpha mask

Rechecking the QImage documentation, this actually can be easily
done; no more bit twiddling, which I got wrong to begin with.

LO's alpha mask is inverted to Qt's expectations, but we have
invertPixels() and then apply it with setAlphaChannel(). And we
can even set the fAlpha using setOpacity()!

Change-Id: If2030d3f87d3a4698d1cd9af005d307c2ee63061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135044
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins

diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index f87de50827df..6849a3bc7bde 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -601,55 +601,24 @@ bool QtGraphicsBackend::blendAlphaBitmap(const 
SalTwoRect&, const SalBitmap& /*r
 return false;
 }
 
-static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap,
-  QImage& rAlphaImage)
+static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& 
rAlphaBitmap)
 {
-if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1)
-{
-SAL_WARN("vcl.gdi", "unsupported alpha depth case: " << 
rAlphaBitmap.GetBitCount());
-return false;
-}
+assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize());
+assert(rAlphaBitmap.GetBitCount() == 8 || rAlphaBitmap.GetBitCount() == 1);
 
-const QImage* pBitmap = static_cast()->GetQImage();
-const QImage* pAlpha = static_cast()->GetQImage();
-rAlphaImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+QImage aAlphaMask = *static_cast()->GetQImage();
+aAlphaMask.invertPixels();
 
-if (rAlphaBitmap.GetBitCount() == 8)
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-image_line[3] = 255 - alpha_line[x];
-}
-}
-else
-{
-for (int y = 0; y < rAlphaImage.height(); ++y)
-{
-uchar* image_line = rAlphaImage.scanLine(y);
-const uchar* alpha_line = pAlpha->scanLine(y);
-for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4)
-{
-if (x && !(x % 8))
-++alpha_line;
-if (0 != (*alpha_line & (1 << (7 - x % 8
-image_line[3] = 0;
-}
-}
-}
-
-return true;
+const QImage* pBitmap = static_cast()->GetQImage();
+QImage aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
+aImage.setAlphaChannel(aAlphaMask);
+return aImage;
 }
 
 bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap)
 {
-QImage aImage;
-if (!getAlphaImage(rSourceBitmap, rAlphaBitmap, aImage))
-return false;
-drawScaledImage(rPosAry, aImage);
+drawScaledImage(rPosAry, getAlphaImage(rSourceBitmap, rAlphaBitmap));
 return true;
 }
 
@@ -659,20 +628,17 @@ bool QtGraphicsBackend::drawTransformedBitmap(const 
basegfx::B2DPoint& rNull,
   const SalBitmap& rSourceBitmap,
   const SalBitmap* pAlphaBitmap, 
double fAlpha)
 {
-if (fAlpha != 1.0)
-return false;
 QImage aImage;
-if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage))
-return false;
+if (!pAlphaBitmap)
+aImage = *static_cast()->GetQImage();
 else
-{
-const QImage* pBitmap = static_cast()->GetQImage();
-aImage = pBitmap->convertToFormat(Qt_DefaultFormat32);
-}
+aImage = getAlphaImage(rSourceBitmap, *pAlphaBitmap);
 
-QtPainter aPainter(*this);
 const basegfx::B2DVector aXRel = rX - rNull;
 const basegfx::B2DVector aYRel = rY - rNull;
+
+QtPainter aPainter(*this);
+aPainter.setOpacity(fAlpha);
 aPainter.setTransform(QTransform(aXRel.getX() / aImage.width(), 
aXRel.getY() / aImage.width(),
  aYRel.getX() / aImage.height(), 
aYRel.getY() / aImage.height(),
  rNull.getX(), rNull.getY()));


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-05-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 8e92328c3f7d93810f0b40bafb62b981d8e98f9f
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 27 23:36:20 2022 +0200
Commit: Michael Weghorn 
CommitDate: Sat May 28 20:32:38 2022 +0200

tdf#149329 Qt change cursor via QWidget

... instead of its QWindow

No idea, why my initial implementation used the QWindow. Neither
do I know, why it's now somehow broken. The code is called, but
the cursor doesn't change. But it seems to work via QWidget, so
just do that. IMHO less QWindow is preferable generally; let Qt
handle more of the low-level stuff.

Change-Id: Id23fba719c9a4d7e760991c51e6021c6f89be345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135051
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit caf862fc843c89cceae2121f743a3822e09bbd46)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135080

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index b9a5f40bea91..8af59966dcd7 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -819,14 +819,11 @@ void QtFrame::ToTop(SalFrameToTop nFlags)
 
 void QtFrame::SetPointer(PointerStyle ePointerStyle)
 {
-QWindow* pWindow = m_pQWidget->window()->windowHandle();
-if (!pWindow)
-return;
 if (ePointerStyle == m_ePointerStyle)
 return;
 m_ePointerStyle = ePointerStyle;
 
-
pWindow->setCursor(static_cast(GetSalData())->getCursor(ePointerStyle));
+
m_pQWidget->setCursor(static_cast(GetSalData())->getCursor(ePointerStyle));
 }
 
 void QtFrame::CaptureMouse(bool bMouse)


[Libreoffice-commits] core.git: vcl/qt5

2022-05-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit caf862fc843c89cceae2121f743a3822e09bbd46
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 27 23:36:20 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat May 28 18:41:21 2022 +0200

tdf#149329 Qt change cursor via QWidget

... instead of its QWindow

No idea, why my initial implementation used the QWindow. Neither
do I know, why it's now somehow broken. The code is called, but
the cursor doesn't change. But it seems to work via QWidget, so
just do that. IMHO less QWindow is preferable generally; let Qt
handle more of the low-level stuff.

Change-Id: Id23fba719c9a4d7e760991c51e6021c6f89be345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135051
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 0933bf33b029..4b94273e1cff 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -835,14 +835,11 @@ void QtFrame::ToTop(SalFrameToTop nFlags)
 
 void QtFrame::SetPointer(PointerStyle ePointerStyle)
 {
-QWindow* pWindow = m_pQWidget->window()->windowHandle();
-if (!pWindow)
-return;
 if (ePointerStyle == m_ePointerStyle)
 return;
 m_ePointerStyle = ePointerStyle;
 
-pWindow->setCursor(GetQtData()->getCursor(ePointerStyle));
+m_pQWidget->setCursor(GetQtData()->getCursor(ePointerStyle));
 }
 
 void QtFrame::CaptureMouse(bool bMouse)


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-05-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |   15 +++
 vcl/qt5/QtMenu.cxx |  190 +
 vcl/qt5/QtWidget.cxx   |3 
 3 files changed, 191 insertions(+), 17 deletions(-)

New commits:
commit 9ea767cb568cef1b142190d2adb0e301baa382e2
Author: Jan-Marek Glogowski 
AuthorDate: Thu May 26 13:48:38 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat May 28 15:37:31 2022 +0200

tdf#132350 Qt implement SalMenu button interface

This turned out much more complicated then expected:

1. The QMenuBar needs explicit adjustSize() calls to position a
   changed corner widget (or a resize...).
2. The adjustSize() results in a temporary, minimal QMenuBar
   layout, so GetMenuBarButtonRectPixel needs to account for the
   extra space itself, instead of just a mapTo call.
3. I didn't know, that you can't add shown widgets to a layout,
   but must call show() after add / insert, otherwise they are
   ignored in the layout (but show up as the layout items) and
   are painted in strange positions.

This also includes the transparency flags for our QtWidget, so the
updater "bubble window" is properly alpha-masked / shaped.

And this maybe has too many asserts...

Change-Id: I86a708175e9f9be786f5dc1810ae0197a0d3fc39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135021
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index 11f3f00c5aa6..a1b77687ce86 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -16,11 +16,13 @@
 #include 
 
 class MenuItemList;
+class QAbstractButton;
 class QAction;
 class QActionGroup;
-class QPushButton;
+class QButtonGroup;
 class QMenu;
 class QMenuBar;
+class QPushButton;
 class QtMenuItem;
 class QtFrame;
 
@@ -49,6 +51,7 @@ private:
 std::unique_ptr mpOwnedQMenu;
 // pointer to QMenu owned by the corresponding QtMenuItem or self (-> 
mpOwnedQMenu)
 QMenu* mpQMenu;
+QButtonGroup* m_pButtonGroup;
 
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
@@ -58,7 +61,10 @@ private:
 void ReinitializeActionGroup(unsigned nPos);
 void ResetAllActionGroups();
 void UpdateActionGroupItem(const QtMenuItem* pSalMenuItem);
-bool validateQMenuBar();
+bool validateQMenuBar() const;
+QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& 
rToolTip, int nId);
+void ImplRemoveMenuBarButton(int nId);
+void adjustButtonSizes();
 
 public:
 QtMenu(bool bMenuBar);
@@ -86,6 +92,10 @@ public:
 const vcl::KeyCode& rKeyCode, const OUString& 
rKeyName) override;
 virtual void GetSystemMenuData(SystemMenuData* pData) override;
 virtual void ShowCloseButton(bool bShow) override;
+virtual bool AddMenuBarButton(const SalMenuButtonItem&) override;
+virtual void RemoveMenuBarButton(sal_uInt16 nId) override;
+virtual tools::Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId, 
SalFrame*) override;
+virtual int GetMenuBarHeight() const override;
 
 void SetMenu(Menu* pMenu) { mpVCLMenu = pMenu; }
 Menu* GetMenu() { return mpVCLMenu; }
@@ -97,6 +107,7 @@ private slots:
 static void slotMenuAboutToShow(QtMenuItem* pQItem);
 static void slotMenuAboutToHide(QtMenuItem* pQItem);
 void slotCloseDocument();
+void slotMenuBarButtonClicked(QAbstractButton*);
 };
 
 class QtMenuItem : public SalMenuItem
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index fd38a038..ccd2eb431f7e 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -20,8 +20,11 @@
 #include 
 #endif
 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -33,6 +36,18 @@
 #include 
 #include 
 
+// LO SalMenuButtonItem::mnId is sal_uInt16, so we go with -2, as -1 has a 
special meaning as automatic id
+constexpr int CLOSE_BUTTON_ID = -2;
+const QString gButtonGroupKey("QtMenu::ButtonGroup");
+
+static inline void lcl_force_menubar_layout_update(QMenuBar& rMenuBar)
+{
+// just exists as a function to not comment it everywhere: forces 
reposition of the
+// corner widget after its layout changes, which will otherwise just 
happen on resize.
+// it unfortunatly has additional side effects; see 
QtMenu::GetMenuBarButtonRectPixel.
+rMenuBar.adjustSize();
+}
+
 QtMenu::QtMenu(bool bMenuBar)
 : mpVCLMenu(nullptr)
 , mpParentSalMenu(nullptr)
@@ -40,6 +55,7 @@ QtMenu::QtMenu(bool bMenuBar)
 , mbMenuBar(bMenuBar)
 , mpQMenuBar(nullptr)
 , mpQMenu(nullptr)
+, m_pButtonGroup(nullptr)
 {
 }
 
@@ -430,9 +446,19 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 mpQMenuBar = new QMenuBar();
 pMainWindow->setMenuBar(mpQMenuBar);
 
-QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
-if (pButton)
-connect(pButton, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtObject.hxx |   25 ++
 vcl/qt5/QtObject.cxx |   65 ++-
 2 files changed, 57 insertions(+), 33 deletions(-)

New commits:
commit 70e497f786dad6bda3aa593c07c778b06381c0e4
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 24 11:34:59 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed May 25 16:25:34 2022 +0200

tdf#148864 Qt switch QtObjectWindow to QWidget

... and therefore rename it to QtObjectWidget

Replacement of the QWidget with QWindow originally happened in
commit 56b19f9a814ae5a39ed760ee542d715493cd0bf3 ("tdf#121247,
tdf#121266 KDE5: Add basic support for OpenGL"), but that
unfortunately has a very sparce commit message with no reason
for this change. Then the code was further complicated in commit
25edbded9946801effd117b9c46de0f8b4bc5632 ("tdf#125517 Qt5
implement a minimal Qt5ObjectWindow") and a few follow up fixes
to restore input and focus handling.

But appearingly all this QWindow handling isn't necessary and just
returning to a QWidget based class fixes the problems with the
video overlay (AKA QWidget::winId()) and video playback for good.

The OpenGL Impress transition (Fade) mentioned in the original
tdf#121266 bug still works.

This also adds the previously missing SolarMutexGuard to all the
overridden QtObjectWidget functions, which call the SalObject's
Callback function. I accidently triggered a DBG_TESTSOLARMUTEX
crashing Impress while debugging this.

Change-Id: Ia22cabfd4f3585dc7fa3f9f18a913c5bd1987dd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134864
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit 4366e0605214260e55a937173b0c2e02225dc843)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134903
Reviewed-by: Ilmari Lauhakangas 

diff --git a/vcl/inc/qt5/QtObject.hxx b/vcl/inc/qt5/QtObject.hxx
index 328946e4388e..bc5a8e584b8f 100644
--- a/vcl/inc/qt5/QtObject.hxx
+++ b/vcl/inc/qt5/QtObject.hxx
@@ -24,10 +24,11 @@
 
 #include 
 #include 
-#include 
+#include 
 
 class QtFrame;
-class QWidget;
+class QtObjectWidget;
+class QWindow;
 
 class QtObject final : public QObject, public SalObject
 {
@@ -35,17 +36,18 @@ class QtObject final : public QObject, public SalObject
 
 SystemEnvData m_aSystemData;
 QtFrame* m_pParent;
-QWidget* m_pQWidget; // main widget, container
-QWindow* m_pQWindow; // contained window, used for opengl rendering
+QtObjectWidget* m_pQWidget;
 QRegion m_pRegion;
+bool m_bForwardKey;
 
 public:
 QtObject(QtFrame* pParent, bool bShow);
 ~QtObject() override;
 
 QtFrame* frame() const { return m_pParent; }
-QWidget* widget() const { return m_pQWidget; }
-QWindow* windowHandle() const { return m_pQWindow; }
+inline QWidget* widget() const;
+QWindow* windowHandle() const;
+bool forwardKey() const { return m_bForwardKey; }
 
 virtual void ResetClipRegion() override;
 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
@@ -60,22 +62,25 @@ public:
 virtual void SetForwardKey(bool bEnable) override;
 
 virtual const SystemEnvData* GetSystemData() const override { return 
_aSystemData; }
+
+virtual void Reparent(SalFrame* pFrame) override;
 };
 
-class QtObjectWindow final : public QWindow
+class QtObjectWidget final : public QWidget
 {
 QtObject& m_rParent;
 
-bool event(QEvent*) override;
 void focusInEvent(QFocusEvent*) override;
 void focusOutEvent(QFocusEvent*) override;
 void mousePressEvent(QMouseEvent*) override;
 void mouseReleaseEvent(QMouseEvent*) override;
-// keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment in 
QtWidget::event
+void keyPressEvent(QKeyEvent*) override;
 void keyReleaseEvent(QKeyEvent*) override;
 
 public:
-explicit QtObjectWindow(QtObject& rParent);
+explicit QtObjectWidget(QtObject& rParent);
 };
 
+QWidget* QtObject::widget() const { return m_pQWidget; }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtObject.cxx b/vcl/qt5/QtObject.cxx
index 569586a0dc98..fbdc8e9b625e 100644
--- a/vcl/qt5/QtObject.cxx
+++ b/vcl/qt5/QtObject.cxx
@@ -24,20 +24,18 @@
 #include 
 
 #include 
+#include 
+#include 
 
 QtObject::QtObject(QtFrame* pParent, bool bShow)
 : m_pParent(pParent)
 , m_pQWidget(nullptr)
-, m_pQWindow(nullptr)
+, m_bForwardKey(false)
 {
 if (!m_pParent || !pParent->GetQWidget())
 return;
 
-m_pQWindow = new QtObjectWindow(*this);
-m_pQWidget = QWidget::createWindowContainer(m_pQWindow, 
pParent->GetQWidget());
-m_pQWidget->setAttribute(Qt::WA_NoSystemBackground);
-connect(m_pQWidget, ::destroyed, this, [this]() { m_pQWidget = 
nullptr; });
-
+m_pQWidget = new QtObjectWidget(*this);
 if (bShow)
 m_pQWidget->show();
 
@@ -53,6 +51,11 @@ QtObject::~QtObject()
 

[Libreoffice-commits] core.git: Changes to 'refs/tags/cib-6.4-8'

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
Tag 'cib-6.4-8' created by Thorsten Behrens  at 
2022-05-25 12:54 +

Release LibreOffice powered by CIB 6.4-8
-BEGIN PGP SIGNATURE-

iQKTBAABCgB9FiEEF13c36gxow74AXmeM3dpmHHuF/gFAmKOJxtfFIAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDE3
NUREQ0RGQTgzMUEzMEVGODAxNzk5RTMzNzc2OTk4NzFFRTE3RjgACgkQM3dpmHHu
F/gfWA//XMf2oU9tq39OZiLvIEkPx+q7/4SIMJVkhkqwy/0Y+c14FE3xYcqkwKSn
Q3G1CD6GeQ8X5J6NID45Szvvi3iiEc1fhowPfbQF0LMhy1yXWbaMAryFEBcld5Mt
u4MKYaGf7OXYEonTZUzW1PE1dkbfLy/ZVKPuYEgUnspyrkUwfoLSMJM8QIw3pYtg
zeiJ/tJ7cp+HvLa2h7rML2X6QWYWllo5vJLtS9lpGepSyrXkbIvXWY6ceNlXXoWi
/FTg33MONpn87YvKII6RppA6kHo/ih68Ok9zyEAV6D8+psaT5Ov7f+9w1PgTPtAq
A6fw5uz/aQ53NK86XLNoTJz36/loKZrnENl9Y8qvUhwETlqsy3oJbcd1Q4wmp9Zj
nev4TNseZJMheuZFWwq6WJ9+RcofvZHQd/OSyTZuvAFQ9+wiK1/dx22WlpqDXc/S
Z0AxSV9C9Oku+7NrkU0DeHRX+sdZCs7ijnLPkpA+sB6wOFGLmUhYlisWE16MDF90
plofi5PI9zFfN3bsnpc+p+pnmDGJnC0xeqdSS0ZstD+FdJYRwaR76tskR6Fi595U
Qasdps3p4KOudKPrL2/eMZGK+CCdffQtEm+rtn1fb7Z4bjz1yKMmm5c24m8snxX2
2LiWHSXQST1EJ5EkURrihGAXvCO4SPayA1TFS6BKdCKWFPPN7Ao=
=zlPc
-END PGP SIGNATURE-

Changes since cib-6.4-7-50:
---
 0 files changed
---


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/Library_vclplug_kf5.mk vcl/qt5 vcl/unx

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/Library_vclplug_kf5.mk |1 
 vcl/qt5/QtFrame.cxx|   67 
 vcl/unx/kf5/KF5SalFrame.cxx|  164 -
 vcl/unx/kf5/KF5SalFrame.hxx|   37 -
 vcl/unx/kf5/KF5SalInstance.cxx |   21 -
 vcl/unx/kf5/KF5SalInstance.hxx |3 
 6 files changed, 64 insertions(+), 229 deletions(-)

New commits:
commit 4b37e526d118501ff718b49640938e00fbaea10f
Author: Jan-Marek Glogowski 
AuthorDate: Mon May 2 08:50:33 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed May 25 14:00:11 2022 +0200

tdf#125925 Qt migrate KF5 theme font settings code

Currently all implemented Qt platforms use freetype and fontconfig
to handle the font selection, so just move the font styling code
from the kf5 VCL plugin to qt.

This really minimizes kf5 by just keeping the special file picker
handling in that VCL plugin.

Change-Id: I0bbb2496379396afc46e34fe0d026702dce1492e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134862
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit 7bf9629d4f3e8504b5d09685d7721275b3287443)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134917

diff --git a/vcl/Library_vclplug_kf5.mk b/vcl/Library_vclplug_kf5.mk
index bcf8fb6897ad..15f7e446a903 100644
--- a/vcl/Library_vclplug_kf5.mk
+++ b/vcl/Library_vclplug_kf5.mk
@@ -63,7 +63,6 @@ $(eval $(call gb_Library_use_externals,vclplug_kf5,\
 
 $(eval $(call gb_Library_add_exception_objects,vclplug_kf5,\
 vcl/unx/kf5/KF5FilePicker \
-vcl/unx/kf5/KF5SalFrame \
 vcl/unx/kf5/KF5SalInstance \
 ))
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index f6f4b6c2611d..b9a5f40bea91 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -67,6 +68,8 @@
 #include 
 #include 
 
+#include 
+
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 && 
QT5_HAVE_XCB_ICCCM
 static bool g_bNeedsWmHintsWindowGroup = true;
 static xcb_atom_t g_aXcbClientLeaderAtom = 0;
@@ -1052,12 +1055,51 @@ static Color toColor(const QColor& rColor)
 return Color(rColor.red(), rColor.green(), rColor.blue());
 }
 
+static bool toVclFont(const QFont& rQFont, const css::lang::Locale& rLocale, 
vcl::Font& rVclFont)
+{
+psp::FastPrintFontInfo aInfo;
+QFontInfo qFontInfo(rQFont);
+
+OUString sFamilyName = toOUString(rQFont.family());
+aInfo.m_aFamilyName = sFamilyName;
+aInfo.m_eItalic = QtFontFace::toFontItalic(qFontInfo.style());
+aInfo.m_eWeight = QtFontFace::toFontWeight(qFontInfo.weight());
+aInfo.m_eWidth = QtFontFace::toFontWidth(rQFont.stretch());
+
+psp::PrintFontManager::get().matchFont(aInfo, rLocale);
+SAL_INFO("vcl.qt", "font match result for '"
+   << sFamilyName << "': "
+   << (aInfo.m_nID != 0 ? OUString::Concat("'") + 
aInfo.m_aFamilyName + "'"
+: OUString("failed")));
+
+if (aInfo.m_nID == 0)
+return false;
+
+int nPointHeight = qFontInfo.pointSize();
+if (nPointHeight <= 0)
+nPointHeight = rQFont.pointSize();
+
+vcl::Font aFont(aInfo.m_aFamilyName, Size(0, nPointHeight));
+if (aInfo.m_eWeight != WEIGHT_DONTKNOW)
+aFont.SetWeight(aInfo.m_eWeight);
+if (aInfo.m_eWidth != WIDTH_DONTKNOW)
+aFont.SetWidthType(aInfo.m_eWidth);
+if (aInfo.m_eItalic != ITALIC_DONTKNOW)
+aFont.SetItalic(aInfo.m_eItalic);
+if (aInfo.m_ePitch != PITCH_DONTKNOW)
+aFont.SetPitch(aInfo.m_ePitch);
+
+rVclFont = aFont;
+return true;
+}
+
 void QtFrame::UpdateSettings(AllSettings& rSettings)
 {
 if (QtData::noNativeControls())
 return;
 
 StyleSettings style(rSettings.GetStyleSettings());
+const css::lang::Locale aLocale = rSettings.GetUILanguageTag().getLocale();
 
 // General settings
 QPalette pal = QApplication::palette();
@@ -1142,9 +1184,6 @@ void QtFrame::UpdateSettings(AllSettings& rSettings)
 style.SetHelpTextColor(
 toColor(QToolTip::palette().color(QPalette::Active, 
QPalette::ToolTipText)));
 
-const int flash_time = QApplication::cursorFlashTime();
-style.SetCursorBlinkTime(flash_time != 0 ? flash_time / 2 : 
STYLE_CURSOR_NOBLINKTIME);
-
 // Menu
 std::unique_ptr pMenuBar = std::make_unique();
 QPalette qMenuCG = pMenuBar->palette();
@@ -1180,6 +1219,24 @@ void QtFrame::UpdateSettings(AllSettings& rSettings)
 }
 style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
 
+// Default fonts
+vcl::Font aFont;
+if (toVclFont(QApplication::font(), aLocale, aFont))
+{
+style.BatchSetFonts(aFont, aFont);
+aFont.SetWeight(WEIGHT_BOLD);
+style.SetTitleFont(aFont);
+style.SetFloatTitleFont(aFont);
+}
+
+// Tooltip font
+if 

[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtObject.hxx |   25 ++
 vcl/qt5/QtObject.cxx |   65 ++-
 2 files changed, 57 insertions(+), 33 deletions(-)

New commits:
commit 4366e0605214260e55a937173b0c2e02225dc843
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 24 11:34:59 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed May 25 13:53:46 2022 +0200

tdf#148864 Qt switch QtObjectWindow to QWidget

... and therefore rename it to QtObjectWidget

Replacement of the QWidget with QWindow originally happened in
commit 56b19f9a814ae5a39ed760ee542d715493cd0bf3 ("tdf#121247,
tdf#121266 KDE5: Add basic support for OpenGL"), but that
unfortunately has a very sparce commit message with no reason
for this change. Then the code was further complicated in commit
25edbded9946801effd117b9c46de0f8b4bc5632 ("tdf#125517 Qt5
implement a minimal Qt5ObjectWindow") and a few follow up fixes
to restore input and focus handling.

But appearingly all this QWindow handling isn't necessary and just
returning to a QWidget based class fixes the problems with the
video overlay (AKA QWidget::winId()) and video playback for good.

The OpenGL Impress transition (Fade) mentioned in the original
tdf#121266 bug still works.

This also adds the previously missing SolarMutexGuard to all the
overridden QtObjectWidget functions, which call the SalObject's
Callback function. I accidently triggered a DBG_TESTSOLARMUTEX
crashing Impress while debugging this.

Change-Id: Ia22cabfd4f3585dc7fa3f9f18a913c5bd1987dd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134864
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtObject.hxx b/vcl/inc/qt5/QtObject.hxx
index 328946e4388e..bc5a8e584b8f 100644
--- a/vcl/inc/qt5/QtObject.hxx
+++ b/vcl/inc/qt5/QtObject.hxx
@@ -24,10 +24,11 @@
 
 #include 
 #include 
-#include 
+#include 
 
 class QtFrame;
-class QWidget;
+class QtObjectWidget;
+class QWindow;
 
 class QtObject final : public QObject, public SalObject
 {
@@ -35,17 +36,18 @@ class QtObject final : public QObject, public SalObject
 
 SystemEnvData m_aSystemData;
 QtFrame* m_pParent;
-QWidget* m_pQWidget; // main widget, container
-QWindow* m_pQWindow; // contained window, used for opengl rendering
+QtObjectWidget* m_pQWidget;
 QRegion m_pRegion;
+bool m_bForwardKey;
 
 public:
 QtObject(QtFrame* pParent, bool bShow);
 ~QtObject() override;
 
 QtFrame* frame() const { return m_pParent; }
-QWidget* widget() const { return m_pQWidget; }
-QWindow* windowHandle() const { return m_pQWindow; }
+inline QWidget* widget() const;
+QWindow* windowHandle() const;
+bool forwardKey() const { return m_bForwardKey; }
 
 virtual void ResetClipRegion() override;
 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
@@ -60,22 +62,25 @@ public:
 virtual void SetForwardKey(bool bEnable) override;
 
 virtual const SystemEnvData* GetSystemData() const override { return 
_aSystemData; }
+
+virtual void Reparent(SalFrame* pFrame) override;
 };
 
-class QtObjectWindow final : public QWindow
+class QtObjectWidget final : public QWidget
 {
 QtObject& m_rParent;
 
-bool event(QEvent*) override;
 void focusInEvent(QFocusEvent*) override;
 void focusOutEvent(QFocusEvent*) override;
 void mousePressEvent(QMouseEvent*) override;
 void mouseReleaseEvent(QMouseEvent*) override;
-// keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment in 
QtWidget::event
+void keyPressEvent(QKeyEvent*) override;
 void keyReleaseEvent(QKeyEvent*) override;
 
 public:
-explicit QtObjectWindow(QtObject& rParent);
+explicit QtObjectWidget(QtObject& rParent);
 };
 
+QWidget* QtObject::widget() const { return m_pQWidget; }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtObject.cxx b/vcl/qt5/QtObject.cxx
index 569586a0dc98..fbdc8e9b625e 100644
--- a/vcl/qt5/QtObject.cxx
+++ b/vcl/qt5/QtObject.cxx
@@ -24,20 +24,18 @@
 #include 
 
 #include 
+#include 
+#include 
 
 QtObject::QtObject(QtFrame* pParent, bool bShow)
 : m_pParent(pParent)
 , m_pQWidget(nullptr)
-, m_pQWindow(nullptr)
+, m_bForwardKey(false)
 {
 if (!m_pParent || !pParent->GetQWidget())
 return;
 
-m_pQWindow = new QtObjectWindow(*this);
-m_pQWidget = QWidget::createWindowContainer(m_pQWindow, 
pParent->GetQWidget());
-m_pQWidget->setAttribute(Qt::WA_NoSystemBackground);
-connect(m_pQWidget, ::destroyed, this, [this]() { m_pQWidget = 
nullptr; });
-
+m_pQWidget = new QtObjectWidget(*this);
 if (bShow)
 m_pQWidget->show();
 
@@ -53,6 +51,11 @@ QtObject::~QtObject()
 }
 }
 
+QWindow* QtObject::windowHandle() const
+{
+return m_pQWidget ? m_pQWidget->windowHandle() : nullptr;
+}
+
 void QtObject::ResetClipRegion()
 {
 if 

[Libreoffice-commits] core.git: include/vcl vcl/qt5

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/sysdata.hxx |8 
 vcl/qt5/QtFrame.cxx |   26 --
 2 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 27fb97fbfe3da858cefb830614c90a496dfe3ad6
Author: Jan-Marek Glogowski 
AuthorDate: Tue May 24 18:14:16 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed May 25 08:45:08 2022 +0200

VCL SysEnvData: add Invalid Platform and Toolkit

I accidently almost introduced some subtle sytactic error in Qt,
because the default platform and toolkit values are actually valid.

So add an Invalid value to both enum classes and then sprinkle
some asserts, so these tests aren't working on invalid data.

Thanks Michael Weghorn for catching this in review.

Change-Id: Ic6a0764dfc5168181251023f4d1c66ffa32651d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134882
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index 00cd5142c2e3..07ddea45dae3 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -50,7 +50,7 @@ typedef struct CGContext *CGContextRef;
 
 struct VCL_DLLPUBLIC SystemEnvData
 {
-enum class Toolkit { Gen, Gtk, Qt };
+enum class Toolkit { Invalid, Gen, Gtk, Qt };
 Toolkit toolkit;// the toolkit in use
 #if defined(_WIN32)
 HWNDhWnd;   // the window hwnd
@@ -62,7 +62,7 @@ struct VCL_DLLPUBLIC SystemEnvData
 #elif defined( IOS )
 // Nothing
 #elif defined( UNX )
-enum class Platform { Wayland, Xcb, WASM };
+enum class Platform { Invalid, Wayland, Xcb, WASM };
 
 void*   pDisplay;   // the relevant display connection
 SalFrame*   pSalFrame;  // contains a salframe, if object has 
one
@@ -89,7 +89,7 @@ public:
 #endif
 
 SystemEnvData()
-: toolkit(Toolkit::Gen)
+: toolkit(Toolkit::Invalid)
 #if defined(_WIN32)
 , hWnd(nullptr)
 #elif defined( MACOSX )
@@ -104,7 +104,7 @@ public:
 , pVisual(nullptr)
 , nScreen(0)
 , aShellWindow(0)
-, platform(Platform())
+, platform(Platform::Invalid)
 , aWindow(0)
 #endif
 {
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 6d65aaf6f386..0933bf33b029 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -183,6 +183,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 m_pQWidget->setAttribute(Qt::WA_AlwaysShowToolTips);
 }
 
+FillSystemEnvData(m_aSystemData, reinterpret_cast(this), 
m_pQWidget);
+
 QWindow* pChildWindow = windowHandle();
 connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
 
@@ -193,8 +195,6 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 pChildWindow->setTransientParent(pParentWindow);
 }
 
-FillSystemEnvData(m_aSystemData, reinterpret_cast(this), 
m_pQWidget);
-
 SetIcon(SV_ICON_ID_OFFICE);
 
 fixICCCMwindowGroup();
@@ -204,6 +204,8 @@ void QtFrame::screenChanged(QScreen*) { 
m_pQWidget->fakeResize(); }
 
 void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, 
QWidget* pWidget)
 {
+assert(rData.platform == SystemEnvData::Platform::Invalid);
+assert(rData.toolkit == SystemEnvData::Toolkit::Invalid);
 if (QGuiApplication::platformName() == "wayland")
 rData.platform = SystemEnvData::Platform::Wayland;
 else if (QGuiApplication::platformName() == "xcb")
@@ -233,6 +235,7 @@ void QtFrame::fixICCCMwindowGroup()
 return;
 g_bNeedsWmHintsWindowGroup = false;
 
+assert(m_aSystemData.platform != SystemEnvData::Platform::Invalid);
 if (m_aSystemData.platform != SystemEnvData::Platform::Xcb)
 return;
 if (QVersionNumber::fromString(qVersion()) >= QVersionNumber(5, 12))
@@ -370,10 +373,19 @@ QWindow* QtFrame::windowHandle() const
 // set attribute 'Qt::WA_NativeWindow' first to make sure a window handle 
actually exists
 QWidget* pChild = asChild();
 assert(pChild->window() == pChild);
-#ifndef EMSCRIPTEN
-// no idea, why this breaks the menubar for EMSCRIPTEN
-pChild->setAttribute(Qt::WA_NativeWindow);
-#endif
+switch (m_aSystemData.platform)
+{
+case SystemEnvData::Platform::Wayland:
+case SystemEnvData::Platform::Xcb:
+pChild->setAttribute(Qt::WA_NativeWindow);
+break;
+case SystemEnvData::Platform::WASM:
+// no idea, why Qt::WA_NativeWindow breaks the menubar for 
EMSCRIPTEN
+break;
+case SystemEnvData::Platform::Invalid:
+std::abort();
+break;
+}
 return pChild->windowHandle();
 }
 
@@ -1357,6 +1369,7 @@ void QtFrame::SetScreenNumber(unsigned int nScreen)
 void QtFrame::SetApplicationID(const OUString& rWMClass)
 {
 #if CHECK_QT5_USING_X11
+assert(m_aSystemData.platform != 

[Libreoffice-commits] core.git: vcl/Library_vclplug_kf5.mk vcl/qt5 vcl/unx

2022-05-25 Thread Jan-Marek Glogowski (via logerrit)
 vcl/Library_vclplug_kf5.mk |1 
 vcl/qt5/QtFrame.cxx|   67 
 vcl/unx/kf5/KF5SalFrame.cxx|  164 -
 vcl/unx/kf5/KF5SalFrame.hxx|   37 -
 vcl/unx/kf5/KF5SalInstance.cxx |   21 -
 vcl/unx/kf5/KF5SalInstance.hxx |3 
 6 files changed, 64 insertions(+), 229 deletions(-)

New commits:
commit 7bf9629d4f3e8504b5d09685d7721275b3287443
Author: Jan-Marek Glogowski 
AuthorDate: Mon May 2 08:50:33 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed May 25 08:32:12 2022 +0200

tdf#125925 Qt migrate KF5 theme font settings code

Currently all implemented Qt platforms use freetype and fontconfig
to handle the font selection, so just move the font styling code
from the kf5 VCL plugin to qt.

This really minimizes kf5 by just keeping the special file picker
handling in that VCL plugin.

Change-Id: I0bbb2496379396afc46e34fe0d026702dce1492e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134862
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins

diff --git a/vcl/Library_vclplug_kf5.mk b/vcl/Library_vclplug_kf5.mk
index 9e44e5f182fd..fe89ec00ec05 100644
--- a/vcl/Library_vclplug_kf5.mk
+++ b/vcl/Library_vclplug_kf5.mk
@@ -64,7 +64,6 @@ $(eval $(call gb_Library_use_externals,vclplug_kf5,\
 
 $(eval $(call gb_Library_add_exception_objects,vclplug_kf5,\
 vcl/unx/kf5/KF5FilePicker \
-vcl/unx/kf5/KF5SalFrame \
 vcl/unx/kf5/KF5SalInstance \
 ))
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 440cd8048d76..6d65aaf6f386 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,6 +67,8 @@
 #include 
 #include 
 
+#include 
+
 #if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM
 static bool g_bNeedsWmHintsWindowGroup = true;
 static xcb_atom_t g_aXcbClientLeaderAtom = 0;
@@ -1056,12 +1059,51 @@ static Color toColor(const QColor& rColor)
 return Color(rColor.red(), rColor.green(), rColor.blue());
 }
 
+static bool toVclFont(const QFont& rQFont, const css::lang::Locale& rLocale, 
vcl::Font& rVclFont)
+{
+psp::FastPrintFontInfo aInfo;
+QFontInfo qFontInfo(rQFont);
+
+OUString sFamilyName = toOUString(rQFont.family());
+aInfo.m_aFamilyName = sFamilyName;
+aInfo.m_eItalic = QtFontFace::toFontItalic(qFontInfo.style());
+aInfo.m_eWeight = QtFontFace::toFontWeight(qFontInfo.weight());
+aInfo.m_eWidth = QtFontFace::toFontWidth(rQFont.stretch());
+
+psp::PrintFontManager::get().matchFont(aInfo, rLocale);
+SAL_INFO("vcl.qt", "font match result for '"
+   << sFamilyName << "': "
+   << (aInfo.m_nID != 0 ? OUString::Concat("'") + 
aInfo.m_aFamilyName + "'"
+: OUString("failed")));
+
+if (aInfo.m_nID == 0)
+return false;
+
+int nPointHeight = qFontInfo.pointSize();
+if (nPointHeight <= 0)
+nPointHeight = rQFont.pointSize();
+
+vcl::Font aFont(aInfo.m_aFamilyName, Size(0, nPointHeight));
+if (aInfo.m_eWeight != WEIGHT_DONTKNOW)
+aFont.SetWeight(aInfo.m_eWeight);
+if (aInfo.m_eWidth != WIDTH_DONTKNOW)
+aFont.SetWidthType(aInfo.m_eWidth);
+if (aInfo.m_eItalic != ITALIC_DONTKNOW)
+aFont.SetItalic(aInfo.m_eItalic);
+if (aInfo.m_ePitch != PITCH_DONTKNOW)
+aFont.SetPitch(aInfo.m_ePitch);
+
+rVclFont = aFont;
+return true;
+}
+
 void QtFrame::UpdateSettings(AllSettings& rSettings)
 {
 if (QtData::noNativeControls())
 return;
 
 StyleSettings style(rSettings.GetStyleSettings());
+const css::lang::Locale aLocale = rSettings.GetUILanguageTag().getLocale();
 
 // General settings
 QPalette pal = QApplication::palette();
@@ -1146,9 +1188,6 @@ void QtFrame::UpdateSettings(AllSettings& rSettings)
 style.SetHelpTextColor(
 toColor(QToolTip::palette().color(QPalette::Active, 
QPalette::ToolTipText)));
 
-const int flash_time = QApplication::cursorFlashTime();
-style.SetCursorBlinkTime(flash_time != 0 ? flash_time / 2 : 
STYLE_CURSOR_NOBLINKTIME);
-
 // Menu
 std::unique_ptr pMenuBar = std::make_unique();
 QPalette qMenuCG = pMenuBar->palette();
@@ -1184,6 +1223,24 @@ void QtFrame::UpdateSettings(AllSettings& rSettings)
 }
 style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
 
+// Default fonts
+vcl::Font aFont;
+if (toVclFont(QApplication::font(), aLocale, aFont))
+{
+style.BatchSetFonts(aFont, aFont);
+aFont.SetWeight(WEIGHT_BOLD);
+style.SetTitleFont(aFont);
+style.SetFloatTitleFont(aFont);
+}
+
+// Tooltip font
+if (toVclFont(QToolTip::font(), aLocale, aFont))
+style.SetHelpFont(aFont);
+
+// Menu bar font
+if (toVclFont(pMenuBar->font(), aLocale, aFont))
+

[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - vcl/win

2022-05-23 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/window/salframe.cxx |   57 ++--
 1 file changed, 55 insertions(+), 2 deletions(-)

New commits:
commit 5d15bf26b982953668f5d80f1d8f745d6cc8daf1
Author: Jan-Marek Glogowski 
AuthorDate: Mon Mar 9 15:25:20 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Mon May 23 10:31:34 2022 +0200

WIN add bootstrap var to re-enable foreground hack

We already found a regressed installation from commit
518c0265efebf39ab6d1e90c4ec4e7cf52b701c6 ("WIN prevent deadlock
in SetForegroundWindow").

Finding a real fix might be impossible, so this just adds the
bootstrap.ini boolean variable Win32.EnableAttachThreadInputHack
to re-enable the previous AttachThreadInput hack on demand.

Change-Id: I3b6d770b060b5dee60e02a5aa85efb8a51518c82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90235
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 0997d3de9149..dd5f8fbb8533 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -33,6 +33,12 @@
 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -1924,16 +1930,63 @@ void WinSalFrame::SetAlwaysOnTop( bool bOnTop )
 SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | 
SWP_NOACTIVATE );
 }
 
+static bool EnableAttachThreadInputHack()
+{
+OUString aBootstrapUri;
+if (osl_getProcessWorkingDir() != osl_Process_E_None)
+return false;
+aBootstrapUri += "/bootstrap.ini";
+
+OUString aSystemFileName;
+if (osl::FileBase::getSystemPathFromFileURL(aBootstrapUri, 
aSystemFileName) != osl::FileBase::E_None)
+return false;
+if (aSystemFileName.getLength() > MAX_PATH)
+return false;
+
+// this uses the Boost ini parser, instead of tools::Config, as we already 
use it to read other
+// values from bootstrap.ini in desktop/win32/source/loader.cxx, because 
that watchdog process
+// can't access LO libs. This way the handling is consistent.
+try
+{
+boost::property_tree::ptree pt;
+std::ifstream aFile(o3tl::toW(aSystemFileName.getStr()));
+boost::property_tree::ini_parser::read_ini(aFile, pt);
+const bool bEnabled = pt.get("Win32.EnableAttachThreadInputHack", 
false);
+SAL_WARN_IF(bEnabled, "vcl", "AttachThreadInput hack is enabled. Watch 
out for deadlocks!");
+return bEnabled;
+}
+catch (...)
+{
+return false;
+}
+}
+
 static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
 {
+static const bool bEnableAttachThreadInputHack = 
EnableAttachThreadInputHack();
+
 WinSalFrame* pToTopFrame = GetWindowPtr( hWnd );
 if( pToTopFrame && (pToTopFrame->mnStyle & 
SalFrameStyleFlags::SYSTEMCHILD) )
 BringWindowToTop( hWnd );
 
 if ( nFlags & SalFrameToTop::ForegroundTask )
 {
-// LO used to call AttachThreadInput here, which resulted in deadlocks!
-SetForegroundWindow_Impl(hWnd);
+// LO used to always call AttachThreadInput here, which resulted in 
deadlocks
+// in some installations for unknown reasons!
+if (bEnableAttachThreadInputHack)
+{
+// This magic code is necessary to connect the input focus of the
+// current window thread and the thread which owns the window that
+// should be the new foreground window.
+HWND hCurrWnd = GetForegroundWindow();
+DWORD myThreadID = GetCurrentThreadId();
+DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
+AttachThreadInput(myThreadID, currThreadID, TRUE);
+SetForegroundWindow_Impl(hWnd);
+AttachThreadInput(myThreadID, currThreadID, FALSE);
+}
+else
+SetForegroundWindow_Impl(hWnd);
 }
 
 if ( nFlags & SalFrameToTop::RestoreWhenMin )


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - vcl/source

2022-05-18 Thread Jan-Marek Glogowski (via logerrit)
 vcl/source/gdi/print.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4f9aa74490f12de5d35e8df51add043ce597627f
Author: Jan-Marek Glogowski 
AuthorDate: Wed Oct 6 23:17:43 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Wed May 18 12:37:14 2022 +0200

tdf#144952 VCL fix the Printer graphics release

Regression from commit 1b7c53db87bb67eeb2591fbb186f7ac20eb00c68
("WIN lazy init WinSalInfoPrinter graphics"), which removed the
// HACK to fix an urgent P1 printing issue fast

SalPrinter::StartPage returns a SalGraphics to the VCL Printer
object. On Windows SalPrinter::EndPage deletes the SalPrinter's
SalGraphics. MacOS keeps a single SalGraphics for the whole
SalPrinter lifetime. PspSalPrinter stores it in a unique_ptr
and always resets it in StartPage.

But in any case the VCL Printer's SalGraphics reference must be
freed before calling a function, which might delete it.

Change-Id: Ice528b2bbc89eaadff576420bf210ea4ec1e58d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123199
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 354706e3f5c05294af6ed5b9f814cfe01741)

diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 09f3dbda47e2..d197a636d574 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1599,8 +1599,8 @@ void Printer::ImplEndPage()
 
 if ( mpPrinter )
 {
-mpPrinter->EndPage();
 ReleaseGraphics();
+mpPrinter->EndPage();
 mbDevOutput = false;
 
 mpJobGraphics = nullptr;


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - vcl/win

2022-05-18 Thread Jan-Marek Glogowski (via logerrit)
 vcl/win/gdi/salfont.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 2c1d1b32f4ddfdffedb27bec5c906c7c8cb26cd6
Author: Jan-Marek Glogowski 
AuthorDate: Mon Sep 27 18:26:17 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Wed May 18 12:33:50 2022 +0200

tdf#144754 WIN de-assert ReleaseFonts / setFont

DeInitGraphics might already have reset the default HDC font,
while the WinSalGraphics still has a font fallback stack. Not
sure why this didn't trigger the existing assert before.
Quite probably there was an existing lifecycle bug.

Regression from commit 42f9d4335bfa4b7299224801fd7ccdd97ae92fbf
("WIN always (de-)init WinSalGraphics")

Change-Id: Ie5826e632310a0d69e8f9617cf6f3629bc31f152
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122726
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 3476106890ea2a00e6f949c918f6c05e17c66a36)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134516
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 9d8439c7387c..1f0db745639e 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -896,16 +896,22 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern 
const & i_rFont,
 
 void WinSalGraphics::SetFont(LogicalFontInstance* pFont, int nFallbackLevel)
 {
+// check that we don't change the first font while ScopedFont has replaced 
HFONT
+assert(!mpWinFontEntry[0].is() || nFallbackLevel != 0 || 
mpWinFontEntry[0]->GetHFONT());
+assert(nFallbackLevel >= 0 && nFallbackLevel < MAX_FALLBACK);
+
 // return early if there is no new font
 if( !pFont )
 {
 if (!mpWinFontEntry[nFallbackLevel].is())
 return;
 
-// select original DC font
-assert(mhDefFont);
-::SelectFont(getHDC(), mhDefFont);
-mhDefFont = nullptr;
+// DeInitGraphics doesn't free the cached fonts, so mhDefFont might be 
nullptr
+if (mhDefFont)
+{
+::SelectFont(getHDC(), mhDefFont);
+mhDefFont = nullptr;
+}
 
 // release no longer referenced font handles
 for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - include/vcl vcl/inc vcl/source vcl/win

2022-05-18 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/print.hxx|1 
 vcl/inc/win/salprn.h |   13 +++---
 vcl/source/gdi/print.cxx |   15 +---
 vcl/win/gdi/salprn.cxx   |   57 ---
 4 files changed, 47 insertions(+), 39 deletions(-)

New commits:
commit 3571b8e600b24e2e1109cd4c64b615937d3e2cb7
Author: Jan-Marek Glogowski 
AuthorDate: Mon Sep 20 17:55:37 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Wed May 18 12:33:19 2022 +0200

WIN lazy init WinSalInfoPrinter graphics

... and while at it make stuff private and add _ to the newly
private member variables.

The new assert revealed a bug in the SalGraphics refcounting,
because the virtual ReleaseGraphics is called from the
destructor, which was probably also the reason for the HACK
and comment in Printer::ImplReleaseFonts.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122371
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 1b7c53db87bb67eeb2591fbb186f7ac20eb00c68)

 Conflicts:
vcl/win/gdi/salprn.cxx

Change-Id: I7af0bda19be6810dd8c0ea5b74604381e2047407
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134515
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index fbdf9c9e19cb..5beb2d964c83 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -226,6 +226,7 @@ public:
 protected:
 virtual boolAcquireGraphics() const override;
 virtual voidReleaseGraphics( bool bRelease = true ) 
override;
+void ImplReleaseGraphics(bool bRelease = true);
 virtual voidImplReleaseFonts() override;
 
 virtual longGetGradientStepCount( long nMinRect ) override;
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index c0c6e7fb7932..9e921dd3090e 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -40,19 +40,24 @@ struct SalDriverData
 
 class WinSalGraphics;
 
-class WinSalInfoPrinter : public SalInfoPrinter
+class WinSalInfoPrinter final : public SalInfoPrinter
 {
 public:
-WinSalGraphics*mpGraphics; // current Printer graphics
 OUString   maDriverName;   // printer driver name
 OUString   maDeviceName;   // printer device name
 OUString   maPortName; // printer port name
-HDCmhDC;   // printer hdc
-bool   mbGraphics; // is Graphics used
+
+private:
+HDC m_hDC;///< printer hdc
+WinSalGraphics* m_pGraphics;  ///< current Printer graphics
+bool m_bGraphics; ///< is Graphics used
+
 public:
 WinSalInfoPrinter();
 virtual ~WinSalInfoPrinter() override;
 
+void setHDC(HDC);
+
 virtual SalGraphics*AcquireGraphics() override;
 virtual voidReleaseGraphics( SalGraphics* pGraphics ) 
override;
 virtual boolSetup( weld::Window* pFrame, ImplJobSetup* 
pSetupData ) override;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 0cf07a6ac578..09f3dbda47e2 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -547,13 +547,7 @@ bool Printer::AcquireGraphics() const
 
 void Printer::ImplReleaseFonts()
 {
-#ifdef UNX
-// HACK to fix an urgent P1 printing issue fast
-// WinSalPrinter does not respect GetGraphics/ReleaseGraphics conventions
-// so Printer::mpGraphics often points to a dead WinSalGraphics
-// TODO: fix WinSalPrinter's GetGraphics/ReleaseGraphics handling
 mpGraphics->ReleaseFonts();
-#endif
 mbNewFont = true;
 mbInitFont = true;
 
@@ -562,7 +556,7 @@ void Printer::ImplReleaseFonts()
 mpDeviceFontSizeList.reset();
 }
 
-void Printer::ReleaseGraphics( bool bRelease )
+void Printer::ImplReleaseGraphics(bool bRelease)
 {
 DBG_TESTSOLARMUTEX();
 
@@ -615,6 +609,11 @@ void Printer::ReleaseGraphics( bool bRelease )
 mpNextGraphics  = nullptr;
 }
 
+void Printer::ReleaseGraphics(bool bRelease)
+{
+ImplReleaseGraphics(bRelease);
+}
+
 void Printer::ImplInit( SalPrinterQueueInfo* pInfo )
 {
 ImplSVData* pSVData = ImplGetSVData();
@@ -909,7 +908,7 @@ void Printer::dispose()
 
 mpPrinterOptions.reset();
 
-ReleaseGraphics();
+ImplReleaseGraphics();
 if ( mpInfoPrinter )
 ImplGetSVData()->mpDefInst->DestroyInfoPrinter( mpInfoPrinter );
 if ( mpDisplayDev )
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index adb9f0e102d0..1fe4968690bd 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1040,17 +1040,8 @@ static bool ImplUpdateSalPrnIC( WinSalInfoPrinter* 
pPrinter, const ImplJobSetup*
 if ( !hNewDC )
 return FALSE;
 
-if ( pPrinter->mpGraphics )
-{
-assert(pPrinter->mpGraphics->getHDC() == 

[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - vcl/inc vcl/win

2022-05-18 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/win/salgdi.h|7 ---
 vcl/win/gdi/salgdi.cxx  |   24 
 vcl/win/gdi/salprn.cxx  |   36 
 vcl/win/gdi/salvd.cxx   |   13 +++--
 vcl/win/window/salframe.cxx |4 +---
 5 files changed, 48 insertions(+), 36 deletions(-)

New commits:
commit d0e734297046eb0470fdf58f9ad3c001214a797f
Author: Jan-Marek Glogowski 
AuthorDate: Wed Sep 15 17:24:48 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Wed May 18 12:32:55 2022 +0200

WIN always (de-)init WinSalGraphics

Originally I thought the whole (de-)initialization was some kind
of lazy SalGraphics init stuff. But reading the existing code
proved me wrong and every InitGraphics came a few lines after a
setHDC call and DeInitGraphics before deletion or setHDC(nullptr).

$ git grep -n "delete.*pGraph\|setHDC\|InitGraphics" vcl/win/

So just make (De-)Init part of setHDC and drop all the other calls
to (De-)InitGraphics, adding a setHDC(nullptr) to the destructor.

I've also added some questionable asserts, like

assert(pPrinter->mpGraphics->getHDC() == pPrinter->mhDC);

As I read the code, you can have a printer object initialized with
a DC but without graphics, which will be initialized on demand.

But AFAIK it's invalid to have a printer DC != graphics DC.

Then there was the hDC check in WinSalPrinter::EndPage, which is
IMHO not needed. AFAIK there is no way the graphics DC might be
"magically" invalidated, so restoring the old DC values should
always work.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122157
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 42f9d4335bfa4b7299224801fd7ccdd97ae92fbf)

 Conflicts:
vcl/inc/win/salgdi.h
vcl/win/gdi/salprn.cxx

Change-Id: I1b961cfa733263ce773575a728bcce5c7d3e97ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134514
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index d6d8dea14c24..5c83afae34b7 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -170,20 +170,21 @@ private:
 
 bool CacheGlyphs(const GenericSalLayout& rLayout);
 bool DrawCachedGlyphs(const GenericSalLayout& rLayout);
+// just call both from setHDC!
+void InitGraphics();
+void DeInitGraphics();
 
 public:
 HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const 
PhysicalFontFace * i_pFontFace, float& o_rFontScale, HFONT& o_rOldFont);
 
 HDC getHDC() const { return mhLocalDC; }
-void setHDC(HDC aNew) { mhLocalDC = aNew; }
+void setHDC(HDC aNew);
 
 HPALETTE getDefPal() const;
 void setDefPal(HPALETTE hDefPal);
 
 HRGN getRegion() const;
 
-void InitGraphics();
-void DeInitGraphics();
 
 enum Type
 {
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 2d4a283bb818..328f7c247599 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -449,6 +449,9 @@ void ImplUpdateSysColorEntries()
 
 void WinSalGraphics::InitGraphics()
 {
+if (!getHDC())
+return;
+
 // calculate the minimal line width for the printer
 if ( isPrinter() )
 {
@@ -468,19 +471,38 @@ void WinSalGraphics::InitGraphics()
 
 void WinSalGraphics::DeInitGraphics()
 {
+if (!getHDC())
+return;
+
 // clear clip region
 SelectClipRgn( getHDC(), nullptr );
 // select default objects
 if ( mhDefPen )
+{
 SelectPen( getHDC(), mhDefPen );
+mhDefPen = nullptr;
+}
 if ( mhDefBrush )
+{
 SelectBrush( getHDC(), mhDefBrush );
+mhDefBrush = nullptr;
+}
 if ( mhDefFont )
+{
 SelectFont( getHDC(), mhDefFont );
+mhDefFont = nullptr;
+}
 
 mpImpl->DeInit();
 }
 
+void WinSalGraphics::setHDC(HDC aNew)
+{
+DeInitGraphics();
+mhLocalDC = aNew;
+InitGraphics();
+}
+
 HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
 {
 SalData*pSalData = GetSalData();
@@ -638,6 +660,8 @@ WinSalGraphics::~WinSalGraphics()
 
 // delete cache data
 delete [] reinterpret_cast(mpStdClipRgnData);
+
+setHDC(nullptr);
 }
 
 SalGraphicsImpl* WinSalGraphics::GetImpl() const
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 83d5aa749e14..adb9f0e102d0 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1031,7 +1031,6 @@ static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
 WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, 
false, nullptr, /* CHECKME */ nullptr);
 pGraphics->SetLayout( SalLayoutFlags::NONE );
 pGraphics->setHDC(hDC);
-pGraphics->InitGraphics();
 return pGraphics;
 }
 
@@ -1043,9 +1042,9 @@ static bool ImplUpdateSalPrnIC( WinSalInfoPrinter* 
pPrinter, const ImplJobSetup*
 
 if ( 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - vcl/headless vcl/inc vcl/qt5 vcl/skia vcl/source vcl/unx

2022-04-28 Thread Jan-Marek Glogowski (via logerrit)
 vcl/headless/svpvd.cxx  |5 ---
 vcl/inc/headless/svpvd.hxx  |1 
 vcl/inc/qt5/QtGraphics_Controls.hxx |3 +-
 vcl/inc/qt5/QtSvpVirtualDevice.hxx  |2 -
 vcl/inc/qt5/QtVirtualDevice.hxx |1 
 vcl/inc/salvd.hxx   |2 -
 vcl/inc/skia/x11/salvd.hxx  |2 -
 vcl/inc/unx/salvd.h |1 
 vcl/qt5/QtGraphics.cxx  |   10 ---
 vcl/qt5/QtGraphics_Controls.cxx |   14 +-
 vcl/qt5/QtSvpGraphics.cxx   |   27 +++
 vcl/qt5/QtSvpVirtualDevice.cxx  |   10 ---
 vcl/qt5/QtVirtualDevice.cxx |8 -
 vcl/qt5/QtWidget.cxx|8 -
 vcl/skia/x11/salvd.cxx  |4 --
 vcl/source/image/ImplImage.cxx  |2 -
 vcl/source/window/window.cxx|4 +-
 vcl/unx/generic/gdi/gdiimpl.cxx |   29 +
 vcl/unx/generic/gdi/gdiimpl.hxx |6 
 vcl/unx/generic/gdi/salgdi.cxx  |4 ++
 vcl/unx/generic/gdi/salvd.cxx   |9 +-
 vcl/unx/generic/window/salframe.cxx |   49 +---
 22 files changed, 56 insertions(+), 145 deletions(-)

New commits:
commit a45277a271b943cfa929670223ddf0447c968269
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 28 18:53:47 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 28 18:53:47 2022 +0200

Todys work, actully working correctly

diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index c27ff3baa917..bf02c6ac7e44 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -64,11 +64,6 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* 
pGraphics )
 delete pGraphics;
 }
 
-void SvpSalVirtualDevice::SetScalePercentage(sal_Int32 nScale)
-{
-CreateSurface(0, 0, nullptr, nScale);
-}
-
 void SvpSalVirtualDevice::CreateSurface(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8 *const pBuffer, sal_Int32 nScalePercentage)
 {
 double fXScale, fYScale;
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 7c4f1024d536..c1b68a138e69 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -54,7 +54,6 @@ public:
 virtual boolSetSizeUsingBuffer( sal_Int32 nNewDX, sal_Int32 nNewDY,
 sal_uInt8 * pBuffer, sal_Int32 
nScale = 100
   ) override;
-virtual void SetScalePercentage(sal_Int32) override;
 
 cairo_surface_t* GetSurface() const { return m_pSurface; }
 
diff --git a/vcl/inc/qt5/QtGraphics_Controls.hxx 
b/vcl/inc/qt5/QtGraphics_Controls.hxx
index 15931d6d18ba..5611706a4b76 100644
--- a/vcl/inc/qt5/QtGraphics_Controls.hxx
+++ b/vcl/inc/qt5/QtGraphics_Controls.hxx
@@ -38,9 +38,10 @@ class QtGraphics_Controls final : public 
vcl::WidgetDrawInterface
 std::unique_ptr m_image;
 QRect m_lastPopupRect;
 SalGraphics const& m_rGraphics;
+qreal m_fDevicePixelRatio;
 
 public:
-QtGraphics_Controls(const SalGraphics& rGraphics, sal_Int32 nScale);
+QtGraphics_Controls(const SalGraphics& rGraphics, sal_Int32 
nScalePercentage);
 
 QImage* getImage() { return m_image.get(); }
 
diff --git a/vcl/inc/qt5/QtSvpVirtualDevice.hxx 
b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
index 5d80ba8c0dbf..9da7c640ee6f 100644
--- a/vcl/inc/qt5/QtSvpVirtualDevice.hxx
+++ b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
@@ -15,7 +15,7 @@ class QtSvpGraphics;
 
 class VCL_DLLPUBLIC QtSvpVirtualDevice final : public SvpSalVirtualDevice
 {
-QtSvpGraphics& m_rRefGraphics;
+sal_Int32 m_nScalePercentage;
 
 public:
 QtSvpVirtualDevice(QtSvpGraphics& rGraphics, cairo_surface_t* 
pPreExistingTarget);
diff --git a/vcl/inc/qt5/QtVirtualDevice.hxx b/vcl/inc/qt5/QtVirtualDevice.hxx
index dc5846a57307..9f86dac0938f 100644
--- a/vcl/inc/qt5/QtVirtualDevice.hxx
+++ b/vcl/inc/qt5/QtVirtualDevice.hxx
@@ -47,7 +47,6 @@ public:
 
 // SalGeometryProvider
 virtual sal_Int32 GetSgpMetric(vcl::SGPmetric eMetric) const override;
-virtual void SetScalePercentage(sal_Int32) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx
index 213cc81c3673..bf3c8cf69c83 100644
--- a/vcl/inc/salvd.hxx
+++ b/vcl/inc/salvd.hxx
@@ -44,8 +44,6 @@ public:
 
 // Set new size using a buffer at the given address
 virtual bool SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8*, sal_Int32 nScale = 100) = 0;
-
-virtual void SetScalePercentage(sal_Int32 nScale) = 0;
 };
 
 void SalVirtualDevice::FixSetSizeParams(sal_Int32& nDX, sal_Int32& nDY, 
sal_Int32& nScale)
diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx
index b2ce698de77b..7ef6f9dd3a1d 100644
--- a/vcl/inc/skia/x11/salvd.hxx
+++ b/vcl/inc/skia/x11/salvd.hxx
@@ -38,8 +38,6 @@ public:
 
 // Set new size, without saving the old contents
 virtual bool SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8*, sal_Int32 = 100) 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - include/vcl vcl/headless vcl/inc vcl/Library_vclplug_gen.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_qt6.mk vcl/qt5 v

2022-04-28 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/GeometryProvider.hxx|2 
 vcl/Library_vclplug_gen.mk  |1 
 vcl/Library_vclplug_qt5.mk  |1 
 vcl/Library_vclplug_qt6.mk  |1 
 vcl/headless/CairoCommon.cxx|   41 ++
 vcl/headless/SvpGraphicsBackend.cxx |   15 -
 vcl/headless/svpbmp.cxx |   31 +++
 vcl/headless/svpvd.cxx  |   28 ++
 vcl/inc/headless/CairoCommon.hxx|7 ++
 vcl/inc/headless/SvpGraphicsBackend.hxx |4 -
 vcl/inc/headless/svpbmp.hxx |4 -
 vcl/inc/headless/svpgdi.hxx |2 
 vcl/inc/headless/svpvd.hxx  |1 
 vcl/inc/qt5/QtBitmap.hxx|3 -
 vcl/inc/qt5/QtGraphics.hxx  |4 -
 vcl/inc/qt5/QtGraphics_Controls.hxx |2 
 vcl/inc/qt5/QtSvpGraphics.hxx   |5 +
 vcl/inc/qt5/QtSvpVirtualDevice.hxx  |   18 ++
 vcl/inc/quartz/salgdi.h |7 +-
 vcl/inc/salbmp.hxx  |5 -
 vcl/inc/salgdi.hxx  |8 --
 vcl/inc/salgdiimpl.hxx  |4 -
 vcl/inc/skia/gdiimpl.hxx|7 --
 vcl/inc/skia/salbmp.hxx |3 -
 vcl/inc/unx/GenPspGfxBackend.hxx|7 +-
 vcl/inc/unx/salbmp.h|3 -
 vcl/inc/unx/salgdi.h|3 -
 vcl/inc/win/salgdi.h|   10 +--
 vcl/qt5/QtBitmap.cxx|   16 +
 vcl/qt5/QtFrame.cxx |8 +-
 vcl/qt5/QtGraphics.cxx  |9 +--
 vcl/qt5/QtGraphics_Controls.cxx |   11 ++-
 vcl/qt5/QtGraphics_GDI.cxx  |4 -
 vcl/qt5/QtInstance.cxx  |7 +-
 vcl/qt5/QtSvpGraphics.cxx   |   45 ++--
 vcl/qt5/QtSvpVirtualDevice.cxx  |   31 +++
 vcl/qt5/QtTools.cxx |8 +-
 vcl/skia/gdiimpl.cxx|4 -
 vcl/skia/salbmp.cxx |   17 +-
 vcl/skia/x11/salvd.cxx  |1 
 vcl/source/gdi/salgdilayout.cxx |2 
 vcl/source/image/ImplImageTree.cxx  |2 
 vcl/source/outdev/mask.cxx  |2 
 vcl/source/outdev/text.cxx  |2 
 vcl/unx/generic/gdi/gdiimpl.cxx |8 +-
 vcl/unx/generic/gdi/gdiimpl.hxx |9 +--
 vcl/unx/generic/gdi/salbmp.cxx  |   37 +++--
 vcl/unx/generic/gdi/salgdi.cxx  |   70 +++--
 vcl/unx/generic/gdi/salgdi2.cxx |   89 
 vcl/unx/generic/gdi/salvd.cxx   |8 ++
 vcl/unx/generic/window/salframe.cxx |2 
 51 files changed, 276 insertions(+), 343 deletions(-)

New commits:
commit e01de62ccaa8d77534bb1b7dd8ea952aac531d6c
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 28 11:55:35 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 28 11:55:35 2022 +0200

Yesterdays work, more real

diff --git a/include/vcl/GeometryProvider.hxx b/include/vcl/GeometryProvider.hxx
index bbd7d37e2c3d..8a4bc7b01532 100644
--- a/include/vcl/GeometryProvider.hxx
+++ b/include/vcl/GeometryProvider.hxx
@@ -42,6 +42,8 @@ public:
 {
 return Size(GetSgpMetric(SGPmetric::Width), 
GetSgpMetric(SGPmetric::Height));
 }
+// alias for SalBitmap
+Size GetSize() const { return GetSizePixel(); }
 
 virtual sal_Int32 GetSgpMetric(SGPmetric eMetric) const = 0;
 };
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index 2cefd3f76856..374353e0fe71 100644
--- a/vcl/Library_vclplug_gen.mk
+++ b/vcl/Library_vclplug_gen.mk
@@ -101,7 +101,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl \
 vcl/unx/generic/gdi/gdiimpl \
 vcl/unx/generic/gdi/salbmp \
-vcl/unx/generic/gdi/salgdi2 \
 vcl/unx/generic/gdi/font \
 vcl/unx/generic/gdi/salgdi \
 vcl/unx/generic/gdi/salvd \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index d21f7d989410..d6096c934594 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -99,6 +99,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
 vcl/qt5/QtPrinter \
 vcl/qt5/QtSvpGraphics \
 vcl/qt5/QtSvpSurface \
+vcl/qt5/QtSvpVirtualDevice \
 vcl/qt5/QtSystem \
 vcl/qt5/QtTimer \
 vcl/qt5/QtTools \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index 9a4e627f3e22..6bdae75c7919 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -98,6 +98,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
 vcl/qt6/QtPrinter \
 vcl/qt6/QtSvpGraphics \
 vcl/qt6/QtSvpSurface \
+vcl/qt6/QtSvpVirtualDevice \
 vcl/qt6/QtSystem \
 vcl/qt6/QtTimer \
 vcl/qt6/QtTools \
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 107f6a0b1948..f9677f3e8db6 100644
--- 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - 94 commits - android/source basegfx/source basic/source bridges/source chart2/IwyuFilter_chart2.yaml chart2/source comphelp

2022-04-28 Thread Jan-Marek Glogowski (via logerrit)
Rebased ref, commits from common ancestor:
commit 5bee79b22699da428c57d9e79ef3b5fdbe936cc2
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 28 11:07:56 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 28 11:07:56 2022 +0200

Yesterdays work

diff --git a/vcl/qt6/QtSvpVirtualDevice.hxx b/vcl/qt6/QtSvpVirtualDevice.cxx
similarity index 90%
rename from vcl/qt6/QtSvpVirtualDevice.hxx
rename to vcl/qt6/QtSvpVirtualDevice.cxx
index 1639ab1a2256..bbed3a54525a 100644
--- a/vcl/qt6/QtSvpVirtualDevice.hxx
+++ b/vcl/qt6/QtSvpVirtualDevice.cxx
@@ -7,6 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "../qt5/QtSvpVirtualDevice.hxx"
+#include "../qt5/QtSvpVirtualDevice.cxx"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ec517c18b51a48afdaaf85e1038321eed8344b29
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 28 10:50:08 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 28 10:50:08 2022 +0200

More work

diff --git a/vcl/inc/qt5/QtSvpVirtualDevice.hxx 
b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
new file mode 100644
index ..4718148ad657
--- /dev/null
+++ b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include 
+
+class VCL_DLLPUBLIC QtSvpVirtualDevice : public SvpSalVirtualDevice
+{
+public:
+QtSvpVirtualDevice(SalGraphics& rGraphics, cairo_surface_t* 
pPreExistingTarget);
+SalGraphics* AcquireGraphics() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtSvpVirtualDevice.hxx b/vcl/qt5/QtSvpVirtualDevice.cxx
similarity index 100%
rename from vcl/qt5/QtSvpVirtualDevice.hxx
rename to vcl/qt5/QtSvpVirtualDevice.cxx
commit 4492c1695b2966a378189bc76c6a82beb495ed98
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 26 19:39:44 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 27 09:53:37 2022 +0200

More work on per-window native scaling

diff --git a/framework/inc/uiconfiguration/imagemanager.hxx 
b/framework/inc/uiconfiguration/imagemanager.hxx
index aacc8bbd3c72..5b6ef4dd3d38 100644
--- a/framework/inc/uiconfiguration/imagemanager.hxx
+++ b/framework/inc/uiconfiguration/imagemanager.hxx
@@ -22,7 +22,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -32,10 +32,10 @@
 namespace framework
 {
 class ImageManagerImpl;
-class ImageManager final : public ::cppu::WeakImplHelper< 
css::ui::XImageManager, css::lang::XServiceInfo>
+class ImageManager final : public ::cppu::WeakImplHelper< 
css::ui::XImageManager2, css::lang::XServiceInfo>
 {
 public:
-ImageManager( const css::uno::Reference< 
css::uno::XComponentContext >& rxContext, bool bForModule );
+ImageManager(const 
css::uno::Reference& rxContext, bool bForModule, 
sal_Int32 nScale = 100);
 virtual ~ImageManager() override;
 
 virtual OUString SAL_CALL getImplementationName() override
@@ -82,6 +82,9 @@ namespace framework
 virtual sal_Bool SAL_CALL isModified() override;
 virtual sal_Bool SAL_CALL isReadOnly() override;
 
+// XImageManager2
+virtual sal_Int32 SAL_CALL scalePercentage() override;
+
 // Non-UNO methods
 /// @throws css::uno::RuntimeException
 void setStorage( const css::uno::Reference< css::embed::XStorage 
>& Storage );
diff --git a/framework/inc/uielement/menubarmanager.hxx 
b/framework/inc/uielement/menubarmanager.hxx
index 710c788f2dcc..b0e8cb3e778a 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -186,6 +186,7 @@ class MenuBarManager final :
 css::uno::Reference< css::container::XIndexAccess >  
m_xDeferredItemContainer;
 OUString 
m_sIconTheme;
 Timer
m_aAsyncSettingsTimer;
+sal_Int32 m_nScalePercentage;
 };
 
 } // namespace
diff --git a/framework/inc/uielement/toolbarmanager.hxx 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-3' - vcl/inc vcl/qt5

2022-04-27 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtInstance.hxx |6 ++
 vcl/inc/qt5/QtWidget.hxx   |1 +
 vcl/qt5/QtInstance.cxx |7 +++
 vcl/qt5/QtWidget.cxx   |   20 
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 6603bd259d6e8abbb6af68fae0eba3f4d876b4f8
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 21 10:56:42 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Apr 27 12:49:39 2022 +0200

tdf#148699 Qt track the active / shown popup

I have no idea, if there can be multiple active popups in LO in
some way. There can be multiple FloatingWindow and gtk does count
them in m_nFloats... There is a whole lot going on in gtk3 related
to isFloatGrabWindow(), with "funny" comments like:

// FIXME: find out who the hell steals the focus from our frame

So this goes with some "optimistic" approach: there is just one
active popup, so we can track it in QtInstance. It WFM...

Change-Id: I9778587696e1ad9e641dba4f102e2e921266eee6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133249
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 347622a98f512dae709f938a85498dcdcf9f225a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133260
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 06c51d61e4a16057f945effe85b1ff9457f8cffb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133276
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index 9a9853a7a2ce..fd111bb22abe 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -35,6 +35,7 @@
 
 #include "QtFilePicker.hxx"
 
+class QtFrame;
 class QtTimer;
 
 class QApplication;
@@ -67,6 +68,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
 Timer m_aUpdateStyleTimer;
 bool m_bUpdateFonts;
 
+QtFrame* m_pActivePopup;
+
 DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void);
 void AfterAppInit() override;
 
@@ -172,6 +175,9 @@ public:
 void UpdateStyle(bool bFontsChanged);
 
 void* CreateGStreamerSink(const SystemChildWindow*) override;
+
+QtFrame* activePopup() const { return m_pActivePopup; }
+void setActivePopup(QtFrame*);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 878c8b1229ce..9482d8c7b205 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -72,6 +72,7 @@ class QtWidget : public QWidget
 virtual void paintEvent(QPaintEvent*) override;
 virtual void resizeEvent(QResizeEvent*) override;
 virtual void showEvent(QShowEvent*) override;
+virtual void hideEvent(QHideEvent*) override;
 virtual void wheelEvent(QWheelEvent*) override;
 virtual void closeEvent(QCloseEvent*) override;
 virtual void changeEvent(QEvent*) override;
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index d252109e122a..247001443020 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -223,6 +223,7 @@ QtInstance::QtInstance(std::unique_ptr& 
pQApp, bool bUseCairo)
 , m_pQApplication(std::move(pQApp))
 , m_aUpdateStyleTimer("vcl::qt5 m_aUpdateStyleTimer")
 , m_bUpdateFonts(false)
+, m_pActivePopup(nullptr)
 {
 ImplSVData* pSVData = ImplGetSVData();
 const OUString sToolkit = "qt" + OUString::number(QT_VERSION_MAJOR);
@@ -722,6 +723,12 @@ std::unique_ptr 
QtInstance::CreateQApplication(int& nArgc, char**
 return pQApp;
 }
 
+void QtInstance::setActivePopup(QtFrame* pFrame)
+{
+assert(!pFrame || pFrame->isPopup());
+m_pActivePopup = pFrame;
+}
+
 extern "C" {
 VCLPLUG_QT_PUBLIC SalInstance* create_SalInstance()
 {
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 017249b05434..663e9b531dbc 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -282,9 +282,21 @@ void QtWidget::showEvent(QShowEvent*)
 // sequence from QtFrame::SetModal, if the frame was already set visible,
 // resulting in a hidden / unmapped window
 SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height());
+if (m_rFrame.isPopup())
+{
+auto* pQtInst(static_cast(GetSalData()->m_pInstance));
+pQtInst->setActivePopup(_rFrame);
+}
 m_rFrame.CallCallback(SalEvent::Paint, );
 }
 
+void QtWidget::hideEvent(QHideEvent*)
+{
+auto* pQtInst(static_cast(GetSalData()->m_pInstance));
+if (m_rFrame.isPopup() && pQtInst->activePopup() == _rFrame)
+pQtInst->setActivePopup(nullptr);
+}
+
 void QtWidget::closeEvent(QCloseEvent* /*pEvent*/)
 {
 m_rFrame.CallCallback(SalEvent::Close, nullptr);
@@ -592,11 +604,11 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& 
rWidget, QEvent* pEvent)
 }
 else if (pEvent->type() == QEvent::ToolTip)
 {
-// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Qt's POV 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - framework/inc framework/source include/vcl offapi/com offapi/UnoApi_offapi.mk vcl/inc vcl/qt5 vcl/source

2022-04-26 Thread Jan-Marek Glogowski (via logerrit)
 framework/inc/uiconfiguration/imagemanager.hxx|9 +
 framework/inc/uielement/menubarmanager.hxx|1 
 framework/inc/uielement/toolbarmanager.hxx|1 
 framework/source/uiconfiguration/CommandImageResolver.cxx |   15 ++
 framework/source/uiconfiguration/CommandImageResolver.hxx |6 -
 framework/source/uiconfiguration/ImageList.cxx|6 -
 framework/source/uiconfiguration/ImageList.hxx|5 
 framework/source/uiconfiguration/imagemanager.cxx |9 +
 framework/source/uiconfiguration/imagemanagerimpl.cxx |   18 ++-
 framework/source/uiconfiguration/imagemanagerimpl.hxx |   13 +-
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   58 
++
 framework/source/uiconfiguration/uiconfigurationmanager.cxx   |6 -
 framework/source/uielement/menubarmanager.cxx |   16 ++
 framework/source/uielement/toolbarmanager.cxx |   13 ++
 include/vcl/image.hxx |2 
 offapi/UnoApi_offapi.mk   |2 
 offapi/com/sun/star/ui/ImageManager.idl   |4 
 offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl   |4 
 offapi/com/sun/star/ui/UIConfigurationManager.idl |4 
 offapi/com/sun/star/ui/XImageManager.idl  |2 
 offapi/com/sun/star/ui/XImageManager2.idl |   42 
+++
 offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl |   39 ++
 offapi/com/sun/star/ui/XUIConfigurationManager3.idl   |   10 -
 vcl/inc/image.h   |5 
 vcl/qt5/QtMenu.cxx|3 
 vcl/source/helper/commandinfoprovider.cxx |   43 
++-
 vcl/source/image/Image.cxx|   12 ++
 vcl/source/image/ImplImage.cxx|   32 +++--
 vcl/source/image/ImplImageTree.cxx|3 
 29 files changed, 297 insertions(+), 86 deletions(-)

New commits:
commit 445d634cc63dd3f4541da9564a6cfbc36c25433c
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 26 19:39:44 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Apr 26 19:39:44 2022 +0200

More work on per-window native scaling

diff --git a/framework/inc/uiconfiguration/imagemanager.hxx 
b/framework/inc/uiconfiguration/imagemanager.hxx
index aacc8bbd3c72..5b6ef4dd3d38 100644
--- a/framework/inc/uiconfiguration/imagemanager.hxx
+++ b/framework/inc/uiconfiguration/imagemanager.hxx
@@ -22,7 +22,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -32,10 +32,10 @@
 namespace framework
 {
 class ImageManagerImpl;
-class ImageManager final : public ::cppu::WeakImplHelper< 
css::ui::XImageManager, css::lang::XServiceInfo>
+class ImageManager final : public ::cppu::WeakImplHelper< 
css::ui::XImageManager2, css::lang::XServiceInfo>
 {
 public:
-ImageManager( const css::uno::Reference< 
css::uno::XComponentContext >& rxContext, bool bForModule );
+ImageManager(const 
css::uno::Reference& rxContext, bool bForModule, 
sal_Int32 nScale = 100);
 virtual ~ImageManager() override;
 
 virtual OUString SAL_CALL getImplementationName() override
@@ -82,6 +82,9 @@ namespace framework
 virtual sal_Bool SAL_CALL isModified() override;
 virtual sal_Bool SAL_CALL isReadOnly() override;
 
+// XImageManager2
+virtual sal_Int32 SAL_CALL scalePercentage() override;
+
 // Non-UNO methods
 /// @throws css::uno::RuntimeException
 void setStorage( const css::uno::Reference< css::embed::XStorage 
>& Storage );
diff --git a/framework/inc/uielement/menubarmanager.hxx 
b/framework/inc/uielement/menubarmanager.hxx
index 710c788f2dcc..b0e8cb3e778a 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -186,6 +186,7 @@ class MenuBarManager final :
 css::uno::Reference< css::container::XIndexAccess >  
m_xDeferredItemContainer;
 OUString 
m_sIconTheme;
 Timer
m_aAsyncSettingsTimer;
+sal_Int32 m_nScalePercentage;
 };
 
 } // namespace
diff --git a/framework/inc/uielement/toolbarmanager.hxx 
b/framework/inc/uielement/toolbarmanager.hxx
index a12528415184..886c775294fa 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -241,6 +241,7 @@ class ToolBarManager final : public ToolbarManager_Base
 OUString

[Libreoffice-commits] core.git: Branch 'feature/wasm' - 718 commits - accessibility/source android/Bootstrap android/default-document android/Makefile android/source avmedia/source basctl/source baseg

2022-04-26 Thread Jan-Marek Glogowski (via logerrit)
Rebased ref, commits from common ancestor:
commit bfb3a2466a2fa627551b0af483c59430aa966e49
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 26 18:11:55 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Apr 26 18:12:52 2022 +0200

WASM HACK fix NEH build

Workaround a toolchain bug. Also see comment in ~Desktop().

Change-Id: I158877b78794d81ccdc74e4d5fc023e2061c1d96

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 3372e751dbf1..8eb71d3b13b5 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -166,7 +166,7 @@ class Desktop final : public Application
 BootstrapStatus m_aBootstrapStatus;
 
 std::unique_ptr m_xLockfile;
-Timer   m_firstRunTimer;
+Timer   *m_firstRunTimer;
 std::thread m_aUpdateThread;
 };
 
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index a45ce9f82a51..e61ee9653697 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -426,14 +426,16 @@ Desktop::Desktop()
 , m_bServicesRegistered(false)
 , m_aBootstrapError(BE_OK)
 , m_aBootstrapStatus(BS_OK)
-, m_firstRunTimer( "desktop::Desktop m_firstRunTimer" )
+, m_firstRunTimer(new Timer("desktop::Desktop m_firstRunTimer"))
 {
-m_firstRunTimer.SetTimeout(3000); // 3 sec.
-m_firstRunTimer.SetInvokeHandler(LINK(this, Desktop, AsyncInitFirstRun));
+m_firstRunTimer->SetTimeout(3000); // 3 sec.
+m_firstRunTimer->SetInvokeHandler(LINK(this, Desktop, AsyncInitFirstRun));
 }
 
 Desktop::~Desktop()
 {
+// Uncommenting this delete breaks the WASM output with a runtime error
+//delete m_firstRunTimer;
 }
 
 void Desktop::Init()
@@ -2556,7 +2558,7 @@ void Desktop::CheckFirstRun( )
 
 // use VCL timer, which won't trigger during shutdown if the
 // application exits before timeout
-m_firstRunTimer.Start();
+m_firstRunTimer->Start();
 
 #ifdef _WIN32
 // Check if Quickstarter should be started (on Windows only)
diff --git a/external/redland/ExternalProject_raptor.mk 
b/external/redland/ExternalProject_raptor.mk
index 324d231c5073..b3ae74c10b61 100644
--- a/external/redland/ExternalProject_raptor.mk
+++ b/external/redland/ExternalProject_raptor.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build):
LDFLAGS=" \
$(if $(filter LINUX 
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin 
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX 
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
-   CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include)" \
+   CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include) 
$(gb_EMSCRIPTEN_CPPFLAGS)" \
$(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \
 --enable-parsers="rdfxml ntriples turtle trig guess 
rss-tag-soup" \
--with-www=xml \
diff --git a/external/redland/ExternalProject_rasqal.mk 
b/external/redland/ExternalProject_rasqal.mk
index dd8887c669c8..e7d1fdb1195d 100644
--- a/external/redland/ExternalProject_rasqal.mk
+++ b/external/redland/ExternalProject_rasqal.mk
@@ -22,7 +22,7 @@ $(eval $(call gb_ExternalProject_register_targets,rasqal,\
 $(call gb_ExternalProject_get_state_target,rasqal,build):
$(call gb_Trace_StartRange,rasqal,EXTERNAL)
$(call gb_ExternalProject_run,build,\
-   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,rasqal)" \
+   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,rasqal) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if $(filter LINUX 
FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin 
-Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN") \
$(if $(SYSBASE),$(if $(filter LINUX 
SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \
diff --git a/external/redland/ExternalProject_redland.mk 
b/external/redland/ExternalProject_redland.mk
index d4dd34519670..d92c642b9cd1 100644
--- a/external/redland/ExternalProject_redland.mk
+++ b/external/redland/ExternalProject_redland.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_ExternalProject_register_targets,redland,\
 $(call gb_ExternalProject_get_state_target,redland,build):
$(call gb_Trace_StartRange,redland,EXTERNAL)
$(call gb_ExternalProject_run,build,\
-   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,redland)" \
+   CFLAGS="$(CFLAGS) $(if $(filter 
TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden) $(call 
gb_ExternalProject_get_build_flags,redland) $(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS=" \
$(if 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - framework/IwyuFilter_framework.yaml framework/source include/vcl offapi/com offapi/UnoApi_offapi.mk vcl/source

2022-04-25 Thread Jan-Marek Glogowski (via logerrit)
 framework/IwyuFilter_framework.yaml |2 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx |   54 +++-
 include/vcl/image.hxx   |1 
 include/vcl/outdev.hxx  |   10 +-
 offapi/UnoApi_offapi.mk |1 
 offapi/com/sun/star/ui/XUIConfigurationManager3.idl |   49 ++
 vcl/source/control/button.cxx   |2 
 vcl/source/gdi/virdev.cxx   |1 
 vcl/source/image/Image.cxx  |6 +
 vcl/source/image/ImplImageTree.cxx  |1 
 vcl/source/outdev/outdev.cxx|   28 ++
 vcl/source/window/toolbox.cxx   |2 
 vcl/source/window/window.cxx|   50 +++
 13 files changed, 151 insertions(+), 56 deletions(-)

New commits:
commit cff1843fae96e240fff2a6ef4f5e1688a6182cc3
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 25 17:21:16 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 25 17:21:16 2022 +0200

more work

diff --git a/framework/IwyuFilter_framework.yaml 
b/framework/IwyuFilter_framework.yaml
index 88b8dfae4ae3..441e1fbe2a77 100644
--- a/framework/IwyuFilter_framework.yaml
+++ b/framework/IwyuFilter_framework.yaml
@@ -41,6 +41,8 @@ excludelist:
 framework/source/fwe/helper/configimporter.cxx:
 # Actually used
 - com/sun/star/ui/XUIConfigurationManager2.hpp
+# Actually used
+- com/sun/star/ui/XUIConfigurationManager3.hpp
 framework/source/fwe/helper/undomanagerhelper.cxx:
 # Actually used
 - com/sun/star/document/XUndoManager.hpp
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index b3b443b99d5c..881bd2b8f490 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -71,7 +71,7 @@ namespace {
 
 class UIConfigurationManager :   public ::cppu::WeakImplHelper<
 css::lang::XServiceInfo  ,
-css::ui::XUIConfigurationManager2 >
+css::ui::XUIConfigurationManager3 >
 {
 public:
 virtual OUString SAL_CALL getImplementationName() override
@@ -124,6 +124,9 @@ public:
 virtual void SAL_CALL setStorage( const css::uno::Reference< 
css::embed::XStorage >& Storage ) override;
 virtual sal_Bool SAL_CALL hasStorage() override;
 
+// XUIConfigurationManager3
+virtual css::uno::Reference SAL_CALL 
getScaledImageManager(::sal_Int16 nScalePercentage) override;
+
 private:
 // private data types
 enum NotifyOp
@@ -193,7 +196,7 @@ private:
 std::mutexm_mutex;
 comphelper::OInterfaceContainerHelper4  
 m_aEventListeners;
 comphelper::OInterfaceContainerHelper4  
 m_aConfigListeners;
-rtl::Reference< ImageManager >m_xImageManager;
+std::unordered_map> 
m_xImageManagers;
 css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAccConfig;
 };
 
@@ -698,16 +701,17 @@ void SAL_CALL UIConfigurationManager::dispose()
 
 {
 SolarMutexGuard g;
-try
-{
-if ( m_xImageManager.is() )
-m_xImageManager->dispose();
-}
-catch ( const Exception& )
-{
-}
+for (auto xImageManager : m_xImageManagers)
+try
+{
+if (xImageManager.second.is())
+ xImageManager.second->dispose();
+}
+catch (const Exception&)
+{
+}
 
-m_xImageManager.clear();
+m_xImageManagers.clear();
 m_aUIElements.clear();
 m_xDocConfigStorage.clear();
 m_bModified = false;
@@ -1115,14 +1119,18 @@ void SAL_CALL UIConfigurationManager::insertSettings( 
const OUString& NewResourc
 }
 }
 
-Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager()
+Reference< XInterface > SAL_CALL 
UIConfigurationManager::getScaledImageManager(sal_Int16 nScaleFactor)
 {
 if ( m_bDisposed )
 throw DisposedException();
 
-if ( !m_xImageManager.is() )
+rtl::Reference xImageManager;
+
+auto const & aManagerIter = m_xImageManagers.find(nScaleFactor);
+if (aManagerIter == m_xImageManagers.end())
 {
-m_xImageManager = new ImageManager( m_xContext, /*bForModule*/false );
+xImageManager = new ImageManager(m_xContext, /*bForModule*/ false);
+m_xImageManagers[nScaleFactor] = xImageManager;
 
 Sequence 

[Libreoffice-commits] core.git: Branch 'feature/scaling-geometry-provider' - 3 commits - include/vcl README.md svtools/source vcl/android vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/qt5 vcl/sk

2022-04-25 Thread Jan-Marek Glogowski (via logerrit)
Rebased ref, commits from common ancestor:
commit d3c22b713a37126b9a736520da35c7bb2616ea30
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 25 12:47:57 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 25 12:48:19 2022 +0200

Add branch info to README.md

Change-Id: I94e48d767e2717bef55195e81ff6938fd2b746be

diff --git a/README.md b/README.md
index 96fde564a842..bbe872b7eedb 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,17 @@
+# Branch info
+
+This basically tries to fix tdf#141578. So every frame gets some scaling 
factor.
+Same for all the stuff buffering some output. The main functionality is 
extending
+SalGeometryProvider and then inheriting it from various classes.
+
+Problems:
+  * Refresh layout when moving a window to a screen with different scaling
+  * In theory, the SalEvent::Resize is sufficient, but an extra 
SalEvent::ScaleChanged should be better
+  * VirtualDevices are independent. These need to be created with a reference 
window
+  * A lot of code uses "Application::GetDefaultDevice()"
+  * The font preview can just cache a single scale size.
+
+
 # LibreOffice
 [![Coverity Scan Build 
Status](https://scan.coverity.com/projects/211/badge.svg)](https://scan.coverity.com/projects/211)
 [![CII Best 
Practices](https://bestpractices.coreinfrastructure.org/projects/307/badge)](https://bestpractices.coreinfrastructure.org/projects/307)
 [![Translation 
status](https://weblate.documentfoundation.org/widgets/libo_ui-master/-/svg-badge.svg)](https://weblate.documentfoundation.org/engage/libo_ui-master/?utm_source=widget)
 
commit b8101f62822fca4cfd1e90e1f7d7df5cc781e14b
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 25 12:15:17 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 25 12:48:19 2022 +0200

more work

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index 6ac1588597fb..570c3075869c 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -112,9 +112,10 @@ public:
 
 void RunInMainThread(std::function func);
 
-virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags 
nStyle, vcl::Window&) override;
-virtual SalFrame* CreateChildFrame(SystemParentData* pParent,
-   SalFrameStyleFlags nStyle, 
vcl::Window&) override;
+virtual SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle,
+  vcl::Window&) override;
+virtual SalFrame* CreateChildFrame(SystemParentData* pParent, 
SalFrameStyleFlags nStyle,
+   vcl::Window&) override;
 virtual void DestroyFrame(SalFrame* pFrame) override;
 
 virtual SalObject* CreateObject(SalFrame* pParent, SystemWindowData* 
pWindowData,
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 1234cbc0c9ec..1fb5d9de0489 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -297,7 +297,8 @@ void QtInstance::localeChanged()
 
 void QtInstance::deleteObjectLater(QObject* pObject) { pObject->deleteLater(); 
}
 
-SalFrame* QtInstance::CreateChildFrame(SystemParentData* /*pParent*/, 
SalFrameStyleFlags nStyle, vcl::Window& rWin)
+SalFrame* QtInstance::CreateChildFrame(SystemParentData* /*pParent*/, 
SalFrameStyleFlags nStyle,
+   vcl::Window& rWin)
 {
 SalFrame* pRet(nullptr);
 RunInMainThread([&, this]() { pRet = new QtFrame(nullptr, nStyle, rWin, 
useCairo()); });
@@ -310,8 +311,9 @@ SalFrame* QtInstance::CreateFrame(SalFrame* pParent, 
SalFrameStyleFlags nStyle,
 assert(!pParent || dynamic_cast(pParent));
 
 SalFrame* pRet(nullptr);
-RunInMainThread(
-[&, this]() { pRet = new QtFrame(static_cast(pParent), 
nStyle, rWin, useCairo()); });
+RunInMainThread([&, this]() {
+pRet = new QtFrame(static_cast(pParent), nStyle, rWin, 
useCairo());
+});
 assert(pRet);
 return pRet;
 }
@@ -344,9 +346,10 @@ void QtInstance::DestroyObject(SalObject* pObject)
 }
 }
 
-std::unique_ptr
-QtInstance::CreateVirtualDevice(SalGraphics& rGraphics, sal_Int32& nDX, 
sal_Int32& nDY,
-DeviceFormat /*eFormat*/, const 
SystemGraphicsData* pGd)
+std::unique_ptr QtInstance::CreateVirtualDevice(SalGraphics& 
rGraphics,
+  sal_Int32& 
nDX, sal_Int32& nDY,
+  DeviceFormat 
/*eFormat*/,
+  const 
SystemGraphicsData* pGd)
 {
 if (m_bUseCairo)
 {
@@ -362,7 +365,8 @@ QtInstance::CreateVirtualDevice(SalGraphics& rGraphics, 
sal_Int32& nDX, sal_Int3
 }
 else
 {
-std::unique_ptr pVD(new QtVirtualDevice(nDX, nDY, 
rGraphics.GetDPIScalePercentage()));
+std::unique_ptr pVD(
+new QtVirtualDevice(nDX, nDY, rGraphics.GetDPIScalePercentage()));
 return pVD;
 }
 }
diff --git 

[Libreoffice-commits] core.git: Changes to 'feature/scaling-geometry-provider'

2022-04-25 Thread Jan-Marek Glogowski (via logerrit)
New branch 'feature/scaling-geometry-provider' available with the following 
commits:
commit 92bce29af3a9fd166e432706cd1d9fa9e95cc088
Author: Jan-Marek Glogowski 
Date:   Mon Apr 25 12:15:17 2022 +0200

more work

commit 50a7b0d41f0e2e229246c9c9a14652aef3b64f26
Author: Jan-Marek Glogowski 
Date:   Wed Apr 20 16:58:34 2022 +0200

WIP force running UNO components out-of-process

I tried to find some better way to start the uno executable, maybe
somewhere "near" cppuhelper::ServiceManager::loadImplementation,
where the internal component loaded, but processPackage_ stores
the context per URL in the BackendImpl already for really new
components at runtime.

Currently this simply re-registers the component. One optimisation
is at least to just return the state from isRegistered_, instead
of beans::Optional< beans::Ambiguous > and skip the real
registration after the context creation in processPackage_.

Change-Id: I76bf17a9512414b67dbd20daee25a6d29c05f9d9

commit 37de9aef2979d5536cc75b65e2609cbbd9a760a4
Author: Jan-Marek Glogowski 
Date:   Wed Apr 20 12:27:53 2022 +0200

SalGeometryProvider base for scaling

commit 540f886f539310f2c413be8234453992870a01cb
Author: Jan-Marek Glogowski 
Date:   Mon Apr 25 12:19:02 2022 +0200

Add extended tooltips to expert config dialog

Change-Id: Iaa87ed7c1bca9ab32a89a7dab742faab8bef1870



[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-7-3+backports' - connectivity/source sc/source solenv/bin

2022-04-22 Thread Jan-Marek Glogowski (via logerrit)
 connectivity/source/drivers/file/FDatabaseMetaData.cxx |2 ++
 connectivity/source/manager/mdrivermanager.cxx |   15 ++-
 sc/source/core/data/documen3.cxx   |6 +-
 solenv/bin/native-code.py  |1 +
 4 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 6662eec377c02290de369f8a4f1a385d9f13352a
Author: Jan-Marek Glogowski 
AuthorDate: Fri Dec 24 02:37:33 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Apr 22 15:09:49 2022 +0200

oss-fuzz: fix some compiler warnings

Some unused functions and variables and many missing
HAVE_FEATURE_NSS warnings, because the native-code.py
stubs were missing the config_crypto.h header.

Change-Id: I88ff7d8f96e7382027a21f205db982fd797bd6af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127392
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit fa5db38ae5bbe9abfd41b6765074ca1200b8def2)

diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx 
b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index f6480744e665..6d0a4f2fe0b1 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -73,6 +73,7 @@ Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getColumns(
 
 namespace
 {
+#if !ENABLE_FUZZERS
 sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, 
std::u16string_view _rDocName )
 {
 sal_Int16 nIsCS = 1;
@@ -151,6 +152,7 @@ namespace
 
 return nIsCS;
 }
+#endif
 }
 
 
diff --git a/connectivity/source/manager/mdrivermanager.cxx 
b/connectivity/source/manager/mdrivermanager.cxx
index bef3c8d74eaa..6bf98cab693e 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -102,8 +102,8 @@ Any SAL_CALL ODriverEnumeration::nextElement(  )
 return makeAny( *m_aPos++ );
 }
 
-namespace {
-
+namespace
+{
 /// an STL functor which ensures that a SdbcDriver described by a 
DriverAccess is loaded
 struct EnsureDriver
 {
@@ -174,9 +174,8 @@ Any SAL_CALL ODriverEnumeration::nextElement(  )
 }
 };
 
-}
-
-static sal_Int32 lcl_getDriverPrecedence( const 
Reference& _rContext, Sequence< OUString >& _rPrecedence )
+#if !ENABLE_FUZZERS
+sal_Int32 lcl_getDriverPrecedence( const Reference& 
_rContext, Sequence< OUString >& _rPrecedence )
 {
 _rPrecedence.realloc( 0 );
 try
@@ -210,8 +209,7 @@ Any SAL_CALL ODriverEnumeration::nextElement(  )
 
 return _rPrecedence.getLength();
 }
-
-namespace {
+#endif
 
 /// an STL argorithm compatible predicate comparing two DriverAccess 
instances by their implementation names
 struct CompareDriverAccessByName
@@ -234,8 +232,7 @@ Any SAL_CALL ODriverEnumeration::nextElement(  )
 return lhs.sImplementationName == m_sImplName;
 }
 };
-
-}
+}
 
 OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& 
_rxContext )
 :OSDBCDriverManager_Base(m_aMutex)
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 420befae37d2..930539455ead 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -575,8 +575,11 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const 
OUString& aDocTab,
 }
 rTab = 0;
 #if ENABLE_FUZZERS
+(void)aDocTab;
+(void)aFileName;
+(void)aTabName;
 return false;
-#endif
+#else
 OUString  aFilterName; // Is filled by the Loader
 OUString  aOptions; // Filter options
 sal_uInt32 nLinkCnt = pExtDocOptions ? 
pExtDocOptions->GetDocSettings().mnLinkCnt : 0;
@@ -618,6 +621,7 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const 
OUString& aDocTab,
 pBindings->Invalidate( SID_LINKS );
 }
 return true;
+#endif
 }
 
 ScExternalRefManager* ScDocument::GetExternalRefManager() const
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index be0802de9a32..b1a006e6b701 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -854,6 +854,7 @@ print ("""/*
  * File generated by solenv/bin/native-code.py
  */
 
+#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-7-3+backports' - 15 commits - android/Bootstrap android/default-document android/source cppuhelper/source sw/source ucb/source vcl/inc vc

2022-04-21 Thread Jan-Marek Glogowski (via logerrit)
 android/Bootstrap/src/org/libreoffice/kit/LibreOfficeKit.java |1 
 android/default-document/example.odt  |binary
 android/source/res/layout/activity_document_browser.xml   |4 
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |   88 
--
 cppuhelper/source/exc_thrower.cxx |   19 +-
 sw/source/core/doc/docbm.cxx  |5 
 sw/source/core/inc/layfrm.hxx |1 
 sw/source/core/layout/findfrm.cxx |   21 ++
 sw/source/core/layout/pagechg.cxx |2 
 ucb/source/ucp/webdav-curl/CurlSession.cxx|7 
 vcl/inc/qt5/QtInstance.hxx|6 
 vcl/inc/qt5/QtWidget.hxx  |8 
 vcl/qt5/QtInstance.cxx|7 
 vcl/qt5/QtWidget.cxx  |   55 
+-
 14 files changed, 159 insertions(+), 65 deletions(-)

New commits:
commit 8d1304d602d67c695f3de6f2aea74a1ca2419fcf
Author: Jan-Marek Glogowski 
AuthorDate: Wed Nov 17 01:24:22 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Apr 22 07:14:24 2022 +0200

Convert example document from cz to en-us

Change-Id: Ia757491ce8802ec9deec9e75c65c6ae1c8ff2c79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126460
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 7a4a13517dc464ed409be0b9c36b2a32a4027c98)

diff --git a/android/default-document/example.odt 
b/android/default-document/example.odt
index 2da7ce6e84d1..3aa6bb5119e9 100644
Binary files a/android/default-document/example.odt and 
b/android/default-document/example.odt differ
commit 5c2b5e77da29edfcbdb0b3f534bbed077842b327
Author: Michael Weghorn 
AuthorDate: Thu Apr 21 17:01:55 2022 +0200
Commit: Michael Weghorn 
CommitDate: Fri Apr 22 07:13:48 2022 +0200

android: Show file chooser despite package visibility filtering in API 30

While it was working just fine in my x86_64 AVD with API level 31,
opening the the file chooser on a real HW aarch64 device running
Android 12 no longer worked by tapping on the TextView in
`LibreOfficeUIActivity` after updating target API from 28
to 31 in

commit 2ab389b251744fa7f3f6b060c09746e59d87f3b1
Date:   Tue Apr 19 10:33:27 2022 +0200

android: Update compileSdkVersion/targetSdkVersion to 31

The

intent.resolveActivity(getPackageManager()) != null

check was failing there, so the Activity with
`Intent.ACTION_OPEN_DOCUMENT` wasn't started there.

This looks like an issue due to package visibility filtering
introduced in target API level 30. Quoting from [1]:

> When an app targets Android 11 (API level 30) or higher and queries for
> information about the other apps that are installed on a device, the
> system filters this information by default. The limited package
> visibility reduces the number of apps that appear to be installed on a
> device, from your app's perspective.
>
> [...]
>
> The limited app visibility affects the return results of methods that
> give information about other apps, such as queryIntentActivities(),
> getPackageInfo(), and getInstalledApplications(). The limited
> visibility also affects explicit interactions with other apps, such
> as starting another app's service.

From how I understand it, the check is used to make sure that
there is an app that can handle the Intent, as e.g. the
"Android fundamentals 02.3: Implicit intents" tutorial [2]
mentions it for the example using an `Intent.ACTION_VIEW`:

> Use the resolveActivity() method and the Android package manager to find
> an Activity that can handle your implicit Intent. Make sure that the
> request resolved successfully.
>
> if (intent.resolveActivity(getPackageManager()) != null) {
> }
>
> This request matches your Intent action and data with the Intent filters
> for installed apps on the device. You use it to make sure there is at
> least one Activity that can handle your requests.

While that sounds reasonable to make sure there is an app that can
view specific data passed *from* the app (and [3] describes how to add
a corresponding `` element to make this use case work),
it seems to be unnecessary for `Intent.ACTION_OPEN_DOCUMENT`,
since that causes the system to "display the various DocumentsProvider
instances installed on the device, letting the user navigate through
them" and Android presumably at least provides a provider for
handling local files by itself in any case.

The 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-21 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtInstance.hxx |6 ++
 vcl/inc/qt5/QtWidget.hxx   |1 +
 vcl/qt5/QtInstance.cxx |7 +++
 vcl/qt5/QtWidget.cxx   |   20 
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 06c51d61e4a16057f945effe85b1ff9457f8cffb
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 21 10:56:42 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 21 18:57:05 2022 +0200

tdf#148699 Qt track the active / shown popup

I have no idea, if there can be multiple active popups in LO in
some way. There can be multiple FloatingWindow and gtk does count
them in m_nFloats... There is a whole lot going on in gtk3 related
to isFloatGrabWindow(), with "funny" comments like:

// FIXME: find out who the hell steals the focus from our frame

So this goes with some "optimistic" approach: there is just one
active popup, so we can track it in QtInstance. It WFM...

Change-Id: I9778587696e1ad9e641dba4f102e2e921266eee6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133249
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 347622a98f512dae709f938a85498dcdcf9f225a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133260
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index 9a9853a7a2ce..fd111bb22abe 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -35,6 +35,7 @@
 
 #include "QtFilePicker.hxx"
 
+class QtFrame;
 class QtTimer;
 
 class QApplication;
@@ -67,6 +68,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
 Timer m_aUpdateStyleTimer;
 bool m_bUpdateFonts;
 
+QtFrame* m_pActivePopup;
+
 DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void);
 void AfterAppInit() override;
 
@@ -172,6 +175,9 @@ public:
 void UpdateStyle(bool bFontsChanged);
 
 void* CreateGStreamerSink(const SystemChildWindow*) override;
+
+QtFrame* activePopup() const { return m_pActivePopup; }
+void setActivePopup(QtFrame*);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 4a40589b16ba..8f7f6cc319e1 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -73,6 +73,7 @@ class QtWidget : public QWidget
 virtual void paintEvent(QPaintEvent*) override;
 virtual void resizeEvent(QResizeEvent*) override;
 virtual void showEvent(QShowEvent*) override;
+virtual void hideEvent(QHideEvent*) override;
 virtual void wheelEvent(QWheelEvent*) override;
 virtual void closeEvent(QCloseEvent*) override;
 virtual void changeEvent(QEvent*) override;
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index d252109e122a..247001443020 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -223,6 +223,7 @@ QtInstance::QtInstance(std::unique_ptr& 
pQApp, bool bUseCairo)
 , m_pQApplication(std::move(pQApp))
 , m_aUpdateStyleTimer("vcl::qt5 m_aUpdateStyleTimer")
 , m_bUpdateFonts(false)
+, m_pActivePopup(nullptr)
 {
 ImplSVData* pSVData = ImplGetSVData();
 const OUString sToolkit = "qt" + OUString::number(QT_VERSION_MAJOR);
@@ -722,6 +723,12 @@ std::unique_ptr 
QtInstance::CreateQApplication(int& nArgc, char**
 return pQApp;
 }
 
+void QtInstance::setActivePopup(QtFrame* pFrame)
+{
+assert(!pFrame || pFrame->isPopup());
+m_pActivePopup = pFrame;
+}
+
 extern "C" {
 VCLPLUG_QT_PUBLIC SalInstance* create_SalInstance()
 {
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 5f07974600e8..8c545fd13377 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -317,9 +317,21 @@ void QtWidget::showEvent(QShowEvent*)
 // sequence from QtFrame::SetModal, if the frame was already set visible,
 // resulting in a hidden / unmapped window
 SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height());
+if (m_rFrame.isPopup())
+{
+auto* pQtInst(static_cast(GetSalData()->m_pInstance));
+pQtInst->setActivePopup(_rFrame);
+}
 m_rFrame.CallCallback(SalEvent::Paint, );
 }
 
+void QtWidget::hideEvent(QHideEvent*)
+{
+auto* pQtInst(static_cast(GetSalData()->m_pInstance));
+if (m_rFrame.isPopup() && pQtInst->activePopup() == _rFrame)
+pQtInst->setActivePopup(nullptr);
+}
+
 void QtWidget::closeEvent(QCloseEvent* /*pEvent*/)
 {
 m_rFrame.CallCallback(SalEvent::Close, nullptr);
@@ -627,11 +639,11 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& 
rWidget, QEvent* pEvent)
 }
 else if (pEvent->type() == QEvent::ToolTip)
 {
-// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Qt's POV on the active popup is wrong due to our fake popup, so 
check LO's state.
 // Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
-const vcl::Window* pFocusWin = 

[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-21 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtInstance.hxx |6 ++
 vcl/inc/qt5/QtWidget.hxx   |1 +
 vcl/qt5/QtInstance.cxx |7 +++
 vcl/qt5/QtWidget.cxx   |   15 +++
 4 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 347622a98f512dae709f938a85498dcdcf9f225a
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 21 10:56:42 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 21 14:02:20 2022 +0200

tdf#148699 Qt track the active / shown popup

I have no idea, if there can be multiple active popups in LO in
some way. There can be multiple FloatingWindow and gtk does count
them in m_nFloats... There is a whole lot going on in gtk3 related
to isFloatGrabWindow(), with "funny" comments like:

// FIXME: find out who the hell steals the focus from our frame

So this goes with some "optimistic" approach: there is just one
active popup, so we can track it in QtInstance. It WFM...

Change-Id: I9778587696e1ad9e641dba4f102e2e921266eee6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133249
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index 2d246c0bd92d..df6c4ec5af86 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -35,6 +35,7 @@
 
 #include "QtFilePicker.hxx"
 
+class QtFrame;
 class QtTimer;
 
 class QApplication;
@@ -67,6 +68,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
 Timer m_aUpdateStyleTimer;
 bool m_bUpdateFonts;
 
+QtFrame* m_pActivePopup;
+
 DECL_DLLPRIVATE_LINK(updateStyleHdl, Timer*, void);
 void AfterAppInit() override;
 
@@ -177,6 +180,9 @@ public:
 
 bool DoExecute(int& nExitCode) override;
 void DoQuit() override;
+
+QtFrame* activePopup() const { return m_pActivePopup; }
+void setActivePopup(QtFrame*);
 };
 
 inline QtInstance* GetQtInstance() { return 
static_cast(GetSalInstance()); }
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 4a40589b16ba..8f7f6cc319e1 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -73,6 +73,7 @@ class QtWidget : public QWidget
 virtual void paintEvent(QPaintEvent*) override;
 virtual void resizeEvent(QResizeEvent*) override;
 virtual void showEvent(QShowEvent*) override;
+virtual void hideEvent(QHideEvent*) override;
 virtual void wheelEvent(QWheelEvent*) override;
 virtual void closeEvent(QCloseEvent*) override;
 virtual void changeEvent(QEvent*) override;
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index a52f6529c3bc..5522ea15c31a 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -225,6 +225,7 @@ QtInstance::QtInstance(std::unique_ptr& 
pQApp, bool bUseCairo)
 , m_pQApplication(std::move(pQApp))
 , m_aUpdateStyleTimer("vcl::qt5 m_aUpdateStyleTimer")
 , m_bUpdateFonts(false)
+, m_pActivePopup(nullptr)
 {
 ImplSVData* pSVData = ImplGetSVData();
 const OUString sToolkit = "qt" + OUString::number(QT_VERSION_MAJOR);
@@ -740,6 +741,12 @@ void QtInstance::DoQuit()
 QApplication::quit();
 }
 
+void QtInstance::setActivePopup(QtFrame* pFrame)
+{
+assert(!pFrame || pFrame->isPopup());
+m_pActivePopup = pFrame;
+}
+
 extern "C" {
 VCLPLUG_QT_PUBLIC SalInstance* create_SalInstance()
 {
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 235e85103d50..04a3af5dac23 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -316,9 +316,17 @@ void QtWidget::showEvent(QShowEvent*)
 // sequence from QtFrame::SetModal, if the frame was already set visible,
 // resulting in a hidden / unmapped window
 SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height());
+if (m_rFrame.isPopup())
+GetQtInstance()->setActivePopup(_rFrame);
 m_rFrame.CallCallback(SalEvent::Paint, );
 }
 
+void QtWidget::hideEvent(QHideEvent*)
+{
+if (m_rFrame.isPopup() && GetQtInstance()->activePopup() == _rFrame)
+GetQtInstance()->setActivePopup(nullptr);
+}
+
 void QtWidget::closeEvent(QCloseEvent* /*pEvent*/)
 {
 m_rFrame.CallCallback(SalEvent::Close, nullptr);
@@ -627,11 +635,10 @@ bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& 
rWidget, QEvent* pEvent)
 }
 else if (pEvent->type() == QEvent::ToolTip)
 {
-// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Qt's POV on the active popup is wrong due to our fake popup, so 
check LO's state.
 // Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
-const vcl::Window* pFocusWin = Application::GetFocusWindow();
-if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin
-&& pFocusWin->GetFrameWindow() == rFrame.GetWindow())
+const QtFrame* pPopupFrame = GetQtInstance()->activePopup();
+if (!rFrame.m_aTooltipText.isEmpty() && (!pPopupFrame || pPopupFrame 
== ))
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-21 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |7 +++
 vcl/qt5/QtWidget.cxx |   35 +++
 2 files changed, 42 insertions(+)

New commits:
commit 00f9671624e676f34c9039d7b0b0ebba6034f05c
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 19 16:03:56 2022 +0200
Commit: Michael Weghorn 
CommitDate: Thu Apr 21 11:31:13 2022 +0200

tdf#140463 Qt handle mouse enter+leave events

Currently just implemented for the QtWidget, but still as a static
function, so it may be used for QtObject at some point too.

But there is no (mouse) enter or leave event function in QWindow,
so no way to handle these there. And since we can't modify the
returned QWidget from QWidget::createWindowContainer, the only way
would be to expand the static QtWidget::handleEvent used by
QtObjectWindow::event ... if it's actually needed at some point.

Includes squashed commit 5d56255c22c79b72c1cedb48cfe0a200f89bdc66
("qt6: Fix build (QtWidget::enterEvent)").

Change-Id: If9009e5dfca508acd1e702df1a17eb8ad7c29690
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133190
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit dc886bc6de2c0061a840bea2426663c3be2ecd26)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133149
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 878c8b1229ce..4a40589b16ba 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -51,6 +51,7 @@ class QtWidget : public QWidget
 static void commitText(QtFrame&, const QString& aText);
 static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*, const 
ButtonKeyState);
 static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*, 
const ButtonKeyState);
+static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
 static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
   const QPoint& rPos, Qt::MouseButtons 
eButtons, int nWidth,
   SalAbstractMouseEvent& aSalEvent);
@@ -75,6 +76,12 @@ class QtWidget : public QWidget
 virtual void wheelEvent(QWheelEvent*) override;
 virtual void closeEvent(QCloseEvent*) override;
 virtual void changeEvent(QEvent*) override;
+virtual void leaveEvent(QEvent*) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+virtual void enterEvent(QEnterEvent*) override;
+#else
+virtual void enterEvent(QEvent*) override;
+#endif
 
 void inputMethodEvent(QInputMethodEvent*) override;
 QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 017249b05434..5f07974600e8 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -208,6 +208,41 @@ void QtWidget::mouseMoveEvent(QMouseEvent* pEvent)
 pEvent->accept();
 }
 
+void QtWidget::handleMouseEnterLeaveEvents(const QtFrame& rFrame, QEvent* 
pQEvent)
+{
+const qreal fRatio = rFrame.devicePixelRatioF();
+const QWidget* pWidget = rFrame.GetQWidget();
+const Point aPos = toPoint(pWidget->mapFromGlobal(QCursor::pos()) * 
fRatio);
+
+SalMouseEvent aEvent;
+aEvent.mnX
+= QGuiApplication::isLeftToRight() ? aPos.X() : round(pWidget->width() 
* fRatio) - aPos.X();
+aEvent.mnY = aPos.Y();
+aEvent.mnTime = 0;
+aEvent.mnButton = 0;
+aEvent.mnCode = GetKeyModCode(QGuiApplication::keyboardModifiers())
+| GetMouseModCode(QGuiApplication::mouseButtons());
+
+SalEvent nEventType;
+if (pQEvent->type() == QEvent::Enter)
+nEventType = SalEvent::MouseMove;
+else
+nEventType = SalEvent::MouseLeave;
+rFrame.CallCallback(nEventType, );
+pQEvent->accept();
+}
+
+void QtWidget::leaveEvent(QEvent* pEvent) { 
handleMouseEnterLeaveEvents(m_rFrame, pEvent); }
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+void QtWidget::enterEvent(QEnterEvent* pEvent)
+#else
+void QtWidget::enterEvent(QEvent* pEvent)
+#endif
+{
+handleMouseEnterLeaveEvents(m_rFrame, pEvent);
+}
+
 void QtWidget::wheelEvent(QWheelEvent* pEvent)
 {
 SalWheelMouseEvent aEvent;


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-20 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |3 +++
 vcl/qt5/QtWidget.cxx |   28 
 2 files changed, 31 insertions(+)

New commits:
commit dc886bc6de2c0061a840bea2426663c3be2ecd26
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 19 16:03:56 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 20 19:37:41 2022 +0200

tdf#140463 Qt handle mouse enter+leave events

Currently just implemented for the QtWidget, but still as a static
function, so it may be used for QtObject at some point too.

But there is no (mouse) enter or leave event function in QWindow,
so no way to handle these there. And since we can't modify the
returned QWidget from QWidget::createWindowContainer, the only way
would be to expand the static QtWidget::handleEvent used by
QtObjectWindow::event ... if it's actually needed at some point.

Change-Id: If9009e5dfca508acd1e702df1a17eb8ad7c29690
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133190
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 878c8b1229ce..2ebe83fcbae1 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -51,6 +51,7 @@ class QtWidget : public QWidget
 static void commitText(QtFrame&, const QString& aText);
 static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*, const 
ButtonKeyState);
 static void handleMouseButtonEvent(const QtFrame&, const QMouseEvent*, 
const ButtonKeyState);
+static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
 static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
   const QPoint& rPos, Qt::MouseButtons 
eButtons, int nWidth,
   SalAbstractMouseEvent& aSalEvent);
@@ -75,6 +76,8 @@ class QtWidget : public QWidget
 virtual void wheelEvent(QWheelEvent*) override;
 virtual void closeEvent(QCloseEvent*) override;
 virtual void changeEvent(QEvent*) override;
+virtual void leaveEvent(QEvent*) override;
+virtual void enterEvent(QEvent*) override;
 
 void inputMethodEvent(QInputMethodEvent*) override;
 QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 33320c577f94..2ac27548ac6a 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -207,6 +207,34 @@ void QtWidget::mouseMoveEvent(QMouseEvent* pEvent)
 pEvent->accept();
 }
 
+void QtWidget::handleMouseEnterLeaveEvents(const QtFrame& rFrame, QEvent* 
pQEvent)
+{
+const qreal fRatio = rFrame.devicePixelRatioF();
+const QWidget* pWidget = rFrame.GetQWidget();
+const Point aPos = toPoint(pWidget->mapFromGlobal(QCursor::pos()) * 
fRatio);
+
+SalMouseEvent aEvent;
+aEvent.mnX
+= QGuiApplication::isLeftToRight() ? aPos.X() : round(pWidget->width() 
* fRatio) - aPos.X();
+aEvent.mnY = aPos.Y();
+aEvent.mnTime = 0;
+aEvent.mnButton = 0;
+aEvent.mnCode = GetKeyModCode(QGuiApplication::keyboardModifiers())
+| GetMouseModCode(QGuiApplication::mouseButtons());
+
+SalEvent nEventType;
+if (pQEvent->type() == QEvent::Enter)
+nEventType = SalEvent::MouseMove;
+else
+nEventType = SalEvent::MouseLeave;
+rFrame.CallCallback(nEventType, );
+pQEvent->accept();
+}
+
+void QtWidget::leaveEvent(QEvent* pEvent) { 
handleMouseEnterLeaveEvents(m_rFrame, pEvent); }
+
+void QtWidget::enterEvent(QEvent* pEvent) { 
handleMouseEnterLeaveEvents(m_rFrame, pEvent); }
+
 void QtWidget::wheelEvent(QWheelEvent* pEvent)
 {
 SalWheelMouseEvent aEvent;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-3' - vcl/inc vcl/qt5

2022-04-19 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |3 +++
 vcl/inc/qt5/QtWidget.hxx |2 +-
 vcl/qt5/QtFrame.cxx  |8 +++-
 vcl/qt5/QtWidget.cxx |   19 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 421abb60875e88432f5d0c6ad4d6dbd8e483647f
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 12 00:29:56 2022 +0200
Commit: Michael Weghorn 
CommitDate: Tue Apr 19 12:58:53 2022 +0200

tdf#148115 Qt handle tooltips via event loop

Instead of calling QToolTip::showText directly from LO, this
defers showing the tooltip to the QEvent processing, which takes
the tooltip timeouts into account. So tooltips are shown with
a slight delay, therefore they happen less fast on mouse move,
reducing / avoiding artifacts of fast changing windows.

This unfortunately comes with yet an other hack in the area of
our fake popup windows...

New handling is based on the code of the Qt Tool Tips example.

Change-Id: I42634ad36dd12171c30f52f07a02a88d3c48a718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132841
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit af6dd54d53eee0d0de1164bff0a77c6b433b3935)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132864
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 7fc871299080427587307932c505d3ae93d6a357)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133040
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 5ffaacf3ad94..23a4fd9887f1 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -111,6 +111,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 LanguageType m_nInputLanguage;
 
+OUString m_aTooltipText;
+QRect m_aTooltipArea;
+
 void SetDefaultPos();
 Size CalcDefaultSize();
 void SetDefaultSize();
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 575cef11014f..878c8b1229ce 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -87,7 +87,7 @@ public:
 void endExtTextInput();
 void fakeResize();
 
-static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
+static bool handleEvent(QtFrame&, QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
 static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, 
QKeyEvent*);
 // mouse events are always accepted
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index c78417b3070a..f6f4b6c2611d 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -175,7 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 m_pTopLevel->setFocusProxy(m_pQWidget);
 }
 else
+{
 m_pQWidget = new QtWidget(*this, aWinFlags);
+// from Qt's POV the popup window doesn't have the input focus, so we 
must force tooltips...
+if (isPopup())
+m_pQWidget->setAttribute(Qt::WA_AlwaysShowToolTips);
+}
 
 QWindow* pChildWindow = windowHandle();
 connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
@@ -855,7 +860,8 @@ bool QtFrame::ShowTooltip(const OUString& rText, const 
tools::Rectangle& rHelpAr
 QRect aHelpArea(toQRect(rHelpArea));
 if (QGuiApplication::isRightToLeft())
 aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - 
aHelpArea.left() - 1);
-QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, 
aHelpArea);
+m_aTooltipText = rText;
+m_aTooltipArea = aHelpArea;
 return true;
 }
 
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 1fe2ce9a7159..017249b05434 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -562,7 +563,7 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const 
QWidget& rWidget, QKeyEvent
 return bStopProcessingKey;
 }
 
-bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& rWidget, QEvent* 
pEvent)
+bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent)
 {
 if (pEvent->type() == QEvent::ShortcutOverride)
 {
@@ -589,6 +590,22 @@ bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& 
rWidget, QEvent* pEve
ButtonKeyState::Pressed))
 return true;
 }
+else if (pEvent->type() == QEvent::ToolTip)
+{
+// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
+const vcl::Window* pFocusWin = Application::GetFocusWindow();
+if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin
+&& pFocusWin->GetFrameWindow() == rFrame.GetWindow())
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-13 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |3 +++
 vcl/inc/qt5/QtWidget.hxx |2 +-
 vcl/qt5/QtFrame.cxx  |8 +++-
 vcl/qt5/QtWidget.cxx |   19 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 7fc871299080427587307932c505d3ae93d6a357
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 12 00:29:56 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 13 22:31:30 2022 +0200

tdf#148115 Qt handle tooltips via event loop

Instead of calling QToolTip::showText directly from LO, this
defers showing the tooltip to the QEvent processing, which takes
the tooltip timeouts into account. So tooltips are shown with
a slight delay, therefore they happen less fast on mouse move,
reducing / avoiding artifacts of fast changing windows.

This unfortunately comes with yet an other hack in the area of
our fake popup windows...

New handling is based on the code of the Qt Tool Tips example.

Change-Id: I42634ad36dd12171c30f52f07a02a88d3c48a718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132841
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit af6dd54d53eee0d0de1164bff0a77c6b433b3935)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132864
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 5ffaacf3ad94..23a4fd9887f1 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -111,6 +111,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 LanguageType m_nInputLanguage;
 
+OUString m_aTooltipText;
+QRect m_aTooltipArea;
+
 void SetDefaultPos();
 Size CalcDefaultSize();
 void SetDefaultSize();
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 575cef11014f..878c8b1229ce 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -87,7 +87,7 @@ public:
 void endExtTextInput();
 void fakeResize();
 
-static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
+static bool handleEvent(QtFrame&, QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
 static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, 
QKeyEvent*);
 // mouse events are always accepted
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index c78417b3070a..f6f4b6c2611d 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -175,7 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 m_pTopLevel->setFocusProxy(m_pQWidget);
 }
 else
+{
 m_pQWidget = new QtWidget(*this, aWinFlags);
+// from Qt's POV the popup window doesn't have the input focus, so we 
must force tooltips...
+if (isPopup())
+m_pQWidget->setAttribute(Qt::WA_AlwaysShowToolTips);
+}
 
 QWindow* pChildWindow = windowHandle();
 connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
@@ -855,7 +860,8 @@ bool QtFrame::ShowTooltip(const OUString& rText, const 
tools::Rectangle& rHelpAr
 QRect aHelpArea(toQRect(rHelpArea));
 if (QGuiApplication::isRightToLeft())
 aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - 
aHelpArea.left() - 1);
-QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, 
aHelpArea);
+m_aTooltipText = rText;
+m_aTooltipArea = aHelpArea;
 return true;
 }
 
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 1fe2ce9a7159..017249b05434 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -562,7 +563,7 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const 
QWidget& rWidget, QKeyEvent
 return bStopProcessingKey;
 }
 
-bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& rWidget, QEvent* 
pEvent)
+bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent)
 {
 if (pEvent->type() == QEvent::ShortcutOverride)
 {
@@ -589,6 +590,22 @@ bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& 
rWidget, QEvent* pEve
ButtonKeyState::Pressed))
 return true;
 }
+else if (pEvent->type() == QEvent::ToolTip)
+{
+// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
+const vcl::Window* pFocusWin = Application::GetFocusWindow();
+if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin
+&& pFocusWin->GetFrameWindow() == rFrame.GetWindow())
+QToolTip::showText(QCursor::pos(), 
toQString(rFrame.m_aTooltipText), ,
+   rFrame.m_aTooltipArea);
+else
+{
+QToolTip::hideText();
+pEvent->ignore();
+}
+return true;
+}
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |1 -
 vcl/qt5/QtMenu.cxx |8 +---
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 664ea7545a62e1329eb1761caea25b7f31cafa7a
Author: Jan-Marek Glogowski 
AuthorDate: Wed Apr 6 16:42:24 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Apr 12 20:18:41 2022 +0200

tdf#148491 Qt reconnect the QMenuBar close button

When the QMenuBar of a QMainWindow is replaced, an existing
corner widget is preserved / transferred, but its connections
are still severed; a bit unexpected...

The documentation for QMenuBar::setCornerWidget is not really
clear what is happening, but the code has this nice comment:
"// Reparent corner widgets before we delete the old menu".
At least there is no need to explicitly delete the button.

Still we must reconnect an existing button on each SetFrame.

Regression from commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60
("tdf#145954 Qt unshare QMenubar usage").

This includes commit 4a537cf77affc4f1f2e2e5be9ff0b1ff11724509
("Qt drop unused QtMenu::mpCloseButton").

Change-Id: I13c31734e665b78231a08cd76ca6305122e08879
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132836
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit f751417b77e6573a0c639778e76ec943449f4573)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132894
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index f39be7e8d506..11f3f00c5aa6 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -49,7 +49,6 @@ private:
 std::unique_ptr mpOwnedQMenu;
 // pointer to QMenu owned by the corresponding QtMenuItem or self (-> 
mpOwnedQMenu)
 QMenu* mpQMenu;
-QPushButton* mpCloseButton;
 
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index 44873ce3384d..9400f5e129bf 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -40,7 +40,6 @@ QtMenu::QtMenu(bool bMenuBar)
 , mbMenuBar(bMenuBar)
 , mpQMenuBar(nullptr)
 , mpQMenu(nullptr)
-, mpCloseButton(nullptr)
 {
 }
 
@@ -431,7 +430,9 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 mpQMenuBar = new QMenuBar();
 pMainWindow->setMenuBar(mpQMenuBar);
 
-mpCloseButton = nullptr;
+QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+if (pButton)
+connect(pButton, ::clicked, this, 
::slotCloseDocument);
 mpQMenu = nullptr;
 
 DoFullMenuUpdate(mpVCLMenu);
@@ -650,6 +651,8 @@ void QtMenu::ShowCloseButton(bool bShow)
 return;
 
 QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+if (!pButton && !bShow)
+return;
 if (!pButton)
 {
 QIcon aIcon;
@@ -665,7 +668,6 @@ void QtMenu::ShowCloseButton(bool bShow)
 pButton->setToolTip(toQString(VclResId(SV_HELPTEXT_CLOSEDOCUMENT)));
 mpQMenuBar->setCornerWidget(pButton, Qt::TopRightCorner);
 connect(pButton, ::clicked, this, 
::slotCloseDocument);
-mpCloseButton = pButton;
 }
 
 if (bShow)


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |3 +++
 vcl/inc/qt5/QtWidget.hxx |2 +-
 vcl/qt5/QtFrame.cxx  |8 +++-
 vcl/qt5/QtWidget.cxx |   19 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit af6dd54d53eee0d0de1164bff0a77c6b433b3935
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 12 00:29:56 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Apr 12 14:09:00 2022 +0200

tdf#148115 Qt handle tooltips via event loop

Instead of calling QToolTip::showText directly from LO, this
defers showing the tooltip to the QEvent processing, which takes
the tooltip timeouts into account. So tooltips are shown with
a slight delay, therefore they happen less fast on mouse move,
reducing / avoiding artifacts of fast changing windows.

This unfortunately comes with yet an other hack in the area of
our fake popup windows...

New handling is based on the code of the Qt Tool Tips example.

Change-Id: I42634ad36dd12171c30f52f07a02a88d3c48a718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132841
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index a873cec76ad6..2d7c5718d6cf 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -110,6 +110,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 LanguageType m_nInputLanguage;
 
+OUString m_aTooltipText;
+QRect m_aTooltipArea;
+
 void SetDefaultPos();
 Size CalcDefaultSize();
 void SetDefaultSize();
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 575cef11014f..878c8b1229ce 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -87,7 +87,7 @@ public:
 void endExtTextInput();
 void fakeResize();
 
-static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
+static bool handleEvent(QtFrame&, QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
 static inline bool handleKeyReleaseEvent(QtFrame&, const QWidget&, 
QKeyEvent*);
 // mouse events are always accepted
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 91361311d60e..440cd8048d76 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -173,7 +173,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 m_pTopLevel->setFocusProxy(m_pQWidget);
 }
 else
+{
 m_pQWidget = new QtWidget(*this, aWinFlags);
+// from Qt's POV the popup window doesn't have the input focus, so we 
must force tooltips...
+if (isPopup())
+m_pQWidget->setAttribute(Qt::WA_AlwaysShowToolTips);
+}
 
 QWindow* pChildWindow = windowHandle();
 connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
@@ -859,7 +864,8 @@ bool QtFrame::ShowTooltip(const OUString& rText, const 
tools::Rectangle& rHelpAr
 QRect aHelpArea(toQRect(rHelpArea));
 if (QGuiApplication::isRightToLeft())
 aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - 
aHelpArea.left() - 1);
-QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, 
aHelpArea);
+m_aTooltipText = rText;
+m_aTooltipArea = aHelpArea;
 return true;
 }
 
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 612682ae987f..33320c577f94 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -562,7 +563,7 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const 
QWidget& rWidget, QKeyEvent
 return bStopProcessingKey;
 }
 
-bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& rWidget, QEvent* 
pEvent)
+bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent)
 {
 if (pEvent->type() == QEvent::ShortcutOverride)
 {
@@ -589,6 +590,22 @@ bool QtWidget::handleEvent(QtFrame& rFrame, const QWidget& 
rWidget, QEvent* pEve
ButtonKeyState::Pressed))
 return true;
 }
+else if (pEvent->type() == QEvent::ToolTip)
+{
+// Qt's POV on focus is wrong for our fake popup windows, so check 
LO's state.
+// Otherwise Qt will continue handling ToolTip events from the 
"parent" window.
+const vcl::Window* pFocusWin = Application::GetFocusWindow();
+if (!rFrame.m_aTooltipText.isEmpty() && pFocusWin
+&& pFocusWin->GetFrameWindow() == rFrame.GetWindow())
+QToolTip::showText(QCursor::pos(), 
toQString(rFrame.m_aTooltipText), ,
+   rFrame.m_aTooltipArea);
+else
+{
+QToolTip::hideText();
+pEvent->ignore();
+}
+return true;
+}
 return false;
 }
 


[Libreoffice-commits] core.git: vcl/qt5

2022-04-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtMenu.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit f751417b77e6573a0c639778e76ec943449f4573
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 11 17:56:16 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Apr 12 12:24:29 2022 +0200

tdf#148491 Qt reconnect the QMenuBar close button

When the QMenuBar of a QMainWindow is replaced, an existing
corner widget is preserved / transferred, but its connections
are still severed; a bit unexpected...

The documentation for QMenuBar::setCornerWidget is not really
clear what is happening, but the code has this nice comment:
"// Reparent corner widgets before we delete the old menu".
At least there is no need to explicitly delete the button.

Still we must reconnect an existing button on each SetFrame.

Regression from commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60
("tdf#145954 Qt unshare QMenubar usage").

Change-Id: I13c31734e665b78231a08cd76ca6305122e08879
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132836
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index 50cb1d057431..fd38a038 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -429,6 +429,10 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 
 mpQMenuBar = new QMenuBar();
 pMainWindow->setMenuBar(mpQMenuBar);
+
+QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+if (pButton)
+connect(pButton, ::clicked, this, 
::slotCloseDocument);
 mpQMenu = nullptr;
 
 DoFullMenuUpdate(mpVCLMenu);
@@ -647,6 +651,8 @@ void QtMenu::ShowCloseButton(bool bShow)
 return;
 
 QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+if (!pButton && !bShow)
+return;
 if (!pButton)
 {
 QIcon aIcon;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-04-11 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtData.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8a62db9759696cd3e5ba980f687c9be91490b4a5
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 11 17:07:36 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Apr 12 07:48:54 2022 +0200

tdf#148481 Map RefHand cursor to Qt::PointingHand

Change-Id: I79c7008655f22737f92a4a6430f1380e81c1c386
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132833
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 9ae398054833120df36bf51738cc4cfd7efb3fdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132713
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qt5/QtData.cxx b/vcl/qt5/QtData.cxx
index e67abdd76224..a4b9141e43db 100644
--- a/vcl/qt5/QtData.cxx
+++ b/vcl/qt5/QtData.cxx
@@ -228,7 +228,7 @@ QCursor& QtData::getCursor(PointerStyle ePointerStyle)
 MAP_BUILTIN(PointerStyle::HSizeBar, Qt::SizeHorCursor);
 MAP_BUILTIN(PointerStyle::VSizeBar, Qt::SizeVerCursor);
 
-MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor);
+MAP_BUILTIN(PointerStyle::RefHand, Qt::PointingHandCursor);
 MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor);
 #if 0
 MAP_BUILTIN( PointerStyle::Pen, GDK_PENCIL );


[Libreoffice-commits] core.git: vcl/qt5

2022-04-11 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtData.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9ae398054833120df36bf51738cc4cfd7efb3fdc
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 11 17:07:36 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 11 20:30:51 2022 +0200

tdf#148481 Map RefHand cursor to Qt::PointingHand

Change-Id: I79c7008655f22737f92a4a6430f1380e81c1c386
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132833
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/qt5/QtData.cxx b/vcl/qt5/QtData.cxx
index 8b60fc46ed56..7d2d0418e80e 100644
--- a/vcl/qt5/QtData.cxx
+++ b/vcl/qt5/QtData.cxx
@@ -228,7 +228,7 @@ QCursor& QtData::getCursor(PointerStyle ePointerStyle)
 MAP_BUILTIN(PointerStyle::HSizeBar, Qt::SizeHorCursor);
 MAP_BUILTIN(PointerStyle::VSizeBar, Qt::SizeVerCursor);
 
-MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor);
+MAP_BUILTIN(PointerStyle::RefHand, Qt::PointingHandCursor);
 MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor);
 #if 0
 MAP_BUILTIN( PointerStyle::Pen, GDK_PENCIL );


[Libreoffice-commits] core.git: unoidl/Module_unoidl.mk

2022-04-10 Thread Jan-Marek Glogowski (via logerrit)
 unoidl/Module_unoidl.mk |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 6f39602ecb9b90795bfd4101273f90b16f17b6d6
Author: Jan-Marek Glogowski 
AuthorDate: Fri Apr 8 02:27:15 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sun Apr 10 23:34:57 2022 +0200

Move unoidl-write from cross-tooling to default

Fixes the ODK cross-build used for Windows Arm64.

Regression from commit 40f2aee6584eafcf4cd1d95fcf1f775e5435440d
("Provide unoidl-write also for the SDK").

Change-Id: I54d2732358ed1d48911e206ed02bfca2d3a78782
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132718
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/unoidl/Module_unoidl.mk b/unoidl/Module_unoidl.mk
index e900fbd78e39..15533717748d 100644
--- a/unoidl/Module_unoidl.mk
+++ b/unoidl/Module_unoidl.mk
@@ -17,14 +17,12 @@ $(eval $(call gb_Module_add_targets,unoidl, \
 $(if $(filter DESKTOP,$(BUILD_TYPE)), \
 Executable_unoidl-read) \
 $(if $(or $(filter ODK,$(BUILD_TYPE)),$(call gb_not,$(CROSS_COMPILING))), \
-Executable_unoidl-check) \
+Executable_unoidl-check \
+Executable_unoidl-write \
+) \
 Library_unoidl \
 ))
 
-$(eval $(call gb_Module_add_targets_for_build,unoidl, \
-Executable_unoidl-write \
-))
-
 $(eval $(call gb_Module_add_check_targets,unoidl, \
 CustomTarget_unoidl-write_test \
 $(if $(filter ODK,$(BUILD_TYPE)),CustomTarget_unoidl-check_test) \


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 18 commits - external/nss oox/source solenv/flatpak-manifest.in sw/inc sw/qa sw/source sw/uiconfig vcl/inc vcl/qt5 vcl/unx writerfi

2022-04-09 Thread Jan-Marek Glogowski (via logerrit)
 external/nss/ExternalProject_nss.mk   |4 
 oox/source/export/shapes.cxx  |3 
 solenv/flatpak-manifest.in|1 
 sw/inc/IDocumentMarkAccess.hxx|5 
 sw/qa/core/data/rtf/pass/forcepoint104.rtf|  571 
++
 sw/qa/core/doc/doc.cxx|   28 
 sw/qa/extras/ooxmlexport/data/TestPuzzleExport.odt|binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|   30 
 sw/qa/extras/rtfexport/data/tdf95706.rtf  |   36 
 sw/qa/extras/rtfexport/rtfexport4.cxx |   61 +
 sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt |  270 

 sw/qa/extras/uiwriter/uiwriter.cxx|4 
 sw/qa/extras/uiwriter/uiwriter3.cxx   |   73 +
 sw/source/core/doc/DocumentFieldsManager.cxx  |   25 
 sw/source/core/doc/docbm.cxx  |   22 
 sw/source/core/doc/docfld.cxx |   45 
 sw/source/core/doc/docfly.cxx |2 
 sw/source/core/docnode/node2lay.cxx   |   77 +
 sw/source/core/fields/expfld.cxx  |3 
 sw/source/core/inc/MarkManager.hxx|2 
 sw/source/core/inc/docfld.hxx |   11 
 sw/source/core/inc/node2lay.hxx   |6 
 sw/source/core/undo/unbkmk.cxx|2 
 sw/source/core/undo/undobj.cxx|2 
 sw/source/ui/dbui/mmoutputtypepage.cxx|4 
 sw/source/ui/dbui/mmresultdialogs.cxx |3 
 sw/source/ui/misc/bookmark.cxx|2 
 sw/source/uibase/dochdl/swdtflvr.cxx  |4 
 sw/source/uibase/shells/textsh1.cxx   |4 
 sw/source/uibase/utlui/content.cxx|2 
 sw/uiconfig/swriter/ui/exchangedatabases.ui   |  150 +-
 vcl/inc/qt5/QtFrame.hxx   |7 
 vcl/inc/qt5/QtMenu.hxx|2 
 vcl/inc/qt5/QtTransferable.hxx|2 
 vcl/inc/qt5/QtWidget.hxx  |4 
 vcl/qt5/QtFrame.cxx   |   99 -
 vcl/qt5/QtMenu.cxx|   38 
 vcl/qt5/QtTransferable.cxx|   25 
 vcl/qt5/QtWidget.cxx  |   32 
 vcl/unx/gtk3/gtkframe.cxx |   20 
 vcl/unx/gtk3/gtkinst.cxx  |4 
 writerfilter/source/rtftok/rtfcharsets.cxx|9 
 writerfilter/source/rtftok/rtfcharsets.hxx|   13 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|   39 
 44 files changed, 1491 insertions(+), 255 deletions(-)

New commits:
commit a191e68148206ef736ce80fa336be462f5bcb50b
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 7 01:07:43 2022 +0200
Commit: Andras Timar 
CommitDate: Sat Apr 9 12:31:13 2022 +0200

tdf#141578 Qt handle QtFrame screen changes

LO doesn't provide any way to notify screen changes / scaling
factors of a window and in fact doesn't really handle scaling
factors in VCL. The QWidget doesn't receive a resize event,
because it's size doesn't change, just the scaling factor.
So we trigger a faked resize on QWindow::screenChanged signal.

Change-Id: I6928c4c62d1c0995c70fea0088cff17849bcd1d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132650
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit 881cfbf77567194f5016a961d1c3db869734d68b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132740
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 59ec093a2ed6..5ffaacf3ad94 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include "QtTools.hxx"
+#include "QtWidget.hxx"
 
 #include 
 #include 
@@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 friend class QtWidget;
 
-QWidget* m_pQWidget;
+QtWidget* m_pQWidget;
 QtMainWindow* m_pTopLevel;
 
 const bool m_bUseCairo;

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |6 +-
 vcl/inc/qt5/QtWidget.hxx |1 +
 vcl/qt5/QtFrame.cxx  |   21 ++---
 vcl/qt5/QtWidget.cxx |6 ++
 4 files changed, 26 insertions(+), 8 deletions(-)

New commits:
commit 76de12a19bd90c0ed0d7a6a85502d3dccdbeba4e
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 7 01:07:43 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Apr 8 19:48:56 2022 +0200

tdf#141578 Qt handle QtFrame screen changes

LO doesn't provide any way to notify screen changes / scaling
factors of a window and in fact doesn't really handle scaling
factors in VCL. The QWidget doesn't receive a resize event,
because it's size doesn't change, just the scaling factor.
So we trigger a faked resize on QWindow::screenChanged signal.

Change-Id: I6928c4c62d1c0995c70fea0088cff17849bcd1d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132650
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit 881cfbf77567194f5016a961d1c3db869734d68b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132740
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 59ec093a2ed6..5ffaacf3ad94 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include "QtTools.hxx"
+#include "QtWidget.hxx"
 
 #include 
 #include 
@@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 friend class QtWidget;
 
-QWidget* m_pQWidget;
+QtWidget* m_pQWidget;
 QtMainWindow* m_pTopLevel;
 
 const bool m_bUseCairo;
@@ -134,6 +135,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 void fixICCCMwindowGroup();
 
+private Q_SLOTS:
+void screenChanged(QScreen*);
+
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
 virtual ~QtFrame() override;
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e2a22d3c9f18..575cef11014f 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -85,6 +85,7 @@ public:
 
 QtFrame& frame() const { return m_rFrame; }
 void endExtTextInput();
+void fakeResize();
 
 static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index bcd95494dabd..c78417b3070a 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -178,10 +177,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else
 m_pQWidget = new QtWidget(*this, aWinFlags);
 
+QWindow* pChildWindow = windowHandle();
+connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
+
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
-QWindow* pParentWindow = 
pParent->GetQWidget()->window()->windowHandle();
-QWindow* pChildWindow = asChild()->window()->windowHandle();
+QWindow* pParentWindow = pParent->windowHandle();
 if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
 pChildWindow->setTransientParent(pParentWindow);
 }
@@ -193,6 +194,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 fixICCCMwindowGroup();
 }
 
+void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); }
+
 void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, 
QWidget* pWidget)
 {
 if (QGuiApplication::platformName() == "wayland")
@@ -343,7 +346,12 @@ bool QtFrame::PostEvent(std::unique_ptr pData)
 return true;
 }
 
-QWidget* QtFrame::asChild() const { return m_pTopLevel ? m_pTopLevel : 
m_pQWidget; }
+QWidget* QtFrame::asChild() const
+{
+if (m_pTopLevel)
+return m_pTopLevel;
+return m_pQWidget;
+}
 
 qreal QtFrame::devicePixelRatioF() const { return 
asChild()->devicePixelRatioF(); }
 
@@ -864,9 +872,8 @@ void QtFrame::SetInputContext(SalInputContext* pContext)
 
 void QtFrame::EndExtTextInput(EndExtTextInputFlags /*nFlags*/)
 {
-QtWidget* pQtWidget = static_cast(m_pQWidget);
-if (pQtWidget)
-pQtWidget->endExtTextInput();
+if (m_pQWidget)
+m_pQWidget->endExtTextInput();
 }
 
 OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode)
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index ab8bf2dc0017..1fe2ce9a7159 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -135,6 +135,12 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent)
 m_rFrame.CallCallback(SalEvent::Resize, nullptr);
 }
 
+void QtWidget::fakeResize()
+{
+QResizeEvent aEvent(size(), QSize());
+resizeEvent();
+}
+
 void QtWidget::fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
  

[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |6 +-
 vcl/inc/qt5/QtWidget.hxx |1 +
 vcl/qt5/QtFrame.cxx  |   19 +--
 vcl/qt5/QtWidget.cxx |6 ++
 4 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 881cfbf77567194f5016a961d1c3db869734d68b
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 7 01:07:43 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Apr 8 17:55:58 2022 +0200

tdf#141578 Qt handle QtFrame screen changes

LO doesn't provide any way to notify screen changes / scaling
factors of a window and in fact doesn't really handle scaling
factors in VCL. The QWidget doesn't receive a resize event,
because it's size doesn't change, just the scaling factor.
So we trigger a faked resize on QWindow::screenChanged signal.

Change-Id: I6928c4c62d1c0995c70fea0088cff17849bcd1d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132650
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index c6edaa58304d..a873cec76ad6 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include "QtTools.hxx"
+#include "QtWidget.hxx"
 
 #include 
 #include 
@@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 friend class QtWidget;
 
-QWidget* m_pQWidget;
+QtWidget* m_pQWidget;
 QtMainWindow* m_pTopLevel;
 
 const bool m_bUseCairo;
@@ -133,6 +134,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 void fixICCCMwindowGroup();
 
+private Q_SLOTS:
+void screenChanged(QScreen*);
+
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
 virtual ~QtFrame() override;
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e2a22d3c9f18..575cef11014f 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -85,6 +85,7 @@ public:
 
 QtFrame& frame() const { return m_rFrame; }
 void endExtTextInput();
+void fakeResize();
 
 static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index b8f649e64b78..91361311d60e 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -176,10 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else
 m_pQWidget = new QtWidget(*this, aWinFlags);
 
+QWindow* pChildWindow = windowHandle();
+connect(pChildWindow, ::screenChanged, this, 
::screenChanged);
+
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
 QWindow* pParentWindow = pParent->windowHandle();
-QWindow* pChildWindow = windowHandle();
 if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
 pChildWindow->setTransientParent(pParentWindow);
 }
@@ -191,6 +192,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 fixICCCMwindowGroup();
 }
 
+void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); }
+
 void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, 
QWidget* pWidget)
 {
 if (QGuiApplication::platformName() == "wayland")
@@ -343,7 +346,12 @@ bool QtFrame::PostEvent(std::unique_ptr pData)
 return true;
 }
 
-QWidget* QtFrame::asChild() const { return m_pTopLevel ? m_pTopLevel : 
m_pQWidget; }
+QWidget* QtFrame::asChild() const
+{
+if (m_pTopLevel)
+return m_pTopLevel;
+return m_pQWidget;
+}
 
 qreal QtFrame::devicePixelRatioF() const { return 
asChild()->devicePixelRatioF(); }
 
@@ -868,9 +876,8 @@ void QtFrame::SetInputContext(SalInputContext* pContext)
 
 void QtFrame::EndExtTextInput(EndExtTextInputFlags /*nFlags*/)
 {
-QtWidget* pQtWidget = static_cast(m_pQWidget);
-if (pQtWidget)
-pQtWidget->endExtTextInput();
+if (m_pQWidget)
+m_pQWidget->endExtTextInput();
 }
 
 OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode)
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index cd47492808cc..612682ae987f 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -134,6 +134,12 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent)
 m_rFrame.CallCallback(SalEvent::Resize, nullptr);
 }
 
+void QtWidget::fakeResize()
+{
+QResizeEvent aEvent(size(), QSize());
+resizeEvent();
+}
+
 void QtWidget::fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
  const QPoint& rPos, Qt::MouseButtons 
eButtons, int nWidth,
  SalAbstractMouseEvent& aSalEvent)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |3 +++
 vcl/qt5/QtFrame.cxx  |5 +++--
 vcl/qt5/QtWidget.cxx |   18 +-
 3 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit a174fe91987160c0d57099d0aaf49dcc8e036f5b
Author: Jan-Marek Glogowski 
AuthorDate: Wed Apr 6 18:59:10 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Apr 8 08:19:42 2022 +0200

tdf#143135 Qt break recursive IM QueryCursorRect

To reproduce the Impress crash, you need an IM, e.g. fcitx / ibus.
This is triggered by having an active input, like double-clicking
one of a presentations text fields, then leaving the window and
switching back to it.

This results in a stack exhaustion in a few seconds. The backtrace
is basically:

QWidget::setFocus
QtFrame::ToTop
sd::Window::GrabFocus
ImplHandleExtTextInputPos
QtWidget::inputMethodQuery
QInputMethod::cursorRectangle
QWidget::setFocus
QApplication::setActiveWindow
QtInstance::DoYield
main

I scratched my head over the longer backtrace for while, but there
seems to be no good way to prevent this from LO's POV. The only
alternative from the Qt VCL plugin is QtFrame::ToTop. That code
is less ugly (no mutable or cached result), but QtWidget::
inputMethodQuery is earlier in the backtrace.

Change-Id: Ief3a8e44bca295cc676e75050d52d70a1da98a88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132643
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit e81385277c091dabb1f6542a94229d7dcc77289b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132612

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 801cd290ff88..e2a22d3c9f18 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 
@@ -36,6 +37,8 @@ class QtWidget : public QWidget
 
 QtFrame& m_rFrame;
 bool m_bNonEmptyIMPreeditSeen;
+mutable bool m_bInInputMethodQueryCursorRectangle;
+mutable QRect m_aImCursorRectangle;
 int m_nDeltaX;
 int m_nDeltaY;
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index ad9c03d0bfa1..bcd95494dabd 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -795,8 +795,9 @@ void QtFrame::ToTop(SalFrameToTop nFlags)
 pWidget->activateWindow();
 else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & 
SalFrameToTop::GrabFocusOnly))
 {
-pWidget->activateWindow();
-pWidget->setFocus();
+if (!(nFlags & SalFrameToTop::GrabFocusOnly))
+pWidget->activateWindow();
+pWidget->setFocus(Qt::OtherFocusReason);
 }
 }
 
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 86431a3488b1..ab8bf2dc0017 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -623,6 +623,7 @@ QtWidget::QtWidget(QtFrame& rFrame, Qt::WindowFlags f)
 : QWidget(Q_NULLPTR, f)
 , m_rFrame(rFrame)
 , m_bNonEmptyIMPreeditSeen(false)
+, m_bInInputMethodQueryCursorRectangle(false)
 , m_nDeltaX(0)
 , m_nDeltaY(0)
 {
@@ -796,11 +797,18 @@ QVariant QtWidget::inputMethodQuery(Qt::InputMethodQuery 
property) const
 }
 case Qt::ImCursorRectangle:
 {
-const qreal fRatio = m_rFrame.devicePixelRatioF();
-SalExtTextInputPosEvent aPosEvent;
-m_rFrame.CallCallback(SalEvent::ExtTextInputPos, );
-return QVariant(QRect(aPosEvent.mnX / fRatio, aPosEvent.mnY / 
fRatio,
-  aPosEvent.mnWidth / fRatio, 
aPosEvent.mnHeight / fRatio));
+if (!m_bInInputMethodQueryCursorRectangle)
+{
+m_bInInputMethodQueryCursorRectangle = true;
+SalExtTextInputPosEvent aPosEvent;
+m_rFrame.CallCallback(SalEvent::ExtTextInputPos, );
+const qreal fRatio = m_rFrame.devicePixelRatioF();
+m_aImCursorRectangle.setRect(aPosEvent.mnX / fRatio, 
aPosEvent.mnY / fRatio,
+ aPosEvent.mnWidth / fRatio,
+ aPosEvent.mnHeight / fRatio);
+m_bInInputMethodQueryCursorRectangle = false;
+}
+return QVariant(m_aImCursorRectangle);
 }
 case Qt::ImAnchorPosition:
 {


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-07 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |3 +++
 vcl/qt5/QtFrame.cxx  |5 +++--
 vcl/qt5/QtWidget.cxx |   18 +-
 3 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit e81385277c091dabb1f6542a94229d7dcc77289b
Author: Jan-Marek Glogowski 
AuthorDate: Wed Apr 6 18:59:10 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Thu Apr 7 15:04:22 2022 +0200

tdf#143135 Qt break recursive IM QueryCursorRect

To reproduce the Impress crash, you need an IM, e.g. fcitx / ibus.
This is triggered by having an active input, like double-clicking
one of a presentations text fields, then leaving the window and
switching back to it.

This results in a stack exhaustion in a few seconds. The backtrace
is basically:

QWidget::setFocus
QtFrame::ToTop
sd::Window::GrabFocus
ImplHandleExtTextInputPos
QtWidget::inputMethodQuery
QInputMethod::cursorRectangle
QWidget::setFocus
QApplication::setActiveWindow
QtInstance::DoYield
main

I scratched my head over the longer backtrace for while, but there
seems to be no good way to prevent this from LO's POV. The only
alternative from the Qt VCL plugin is QtFrame::ToTop. That code
is less ugly (no mutable or cached result), but QtWidget::
inputMethodQuery is earlier in the backtrace.

Change-Id: Ief3a8e44bca295cc676e75050d52d70a1da98a88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132643
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 801cd290ff88..e2a22d3c9f18 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 
@@ -36,6 +37,8 @@ class QtWidget : public QWidget
 
 QtFrame& m_rFrame;
 bool m_bNonEmptyIMPreeditSeen;
+mutable bool m_bInInputMethodQueryCursorRectangle;
+mutable QRect m_aImCursorRectangle;
 int m_nDeltaX;
 int m_nDeltaY;
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 2e396fa8ce07..b8f649e64b78 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -799,8 +799,9 @@ void QtFrame::ToTop(SalFrameToTop nFlags)
 pWidget->activateWindow();
 else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & 
SalFrameToTop::GrabFocusOnly))
 {
-pWidget->activateWindow();
-pWidget->setFocus();
+if (!(nFlags & SalFrameToTop::GrabFocusOnly))
+pWidget->activateWindow();
+pWidget->setFocus(Qt::OtherFocusReason);
 }
 }
 
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 6362a1353d54..cd47492808cc 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -625,6 +625,7 @@ QtWidget::QtWidget(QtFrame& rFrame, Qt::WindowFlags f)
 : QWidget(Q_NULLPTR, f)
 , m_rFrame(rFrame)
 , m_bNonEmptyIMPreeditSeen(false)
+, m_bInInputMethodQueryCursorRectangle(false)
 , m_nDeltaX(0)
 , m_nDeltaY(0)
 {
@@ -800,11 +801,18 @@ QVariant QtWidget::inputMethodQuery(Qt::InputMethodQuery 
property) const
 }
 case Qt::ImCursorRectangle:
 {
-const qreal fRatio = m_rFrame.devicePixelRatioF();
-SalExtTextInputPosEvent aPosEvent;
-m_rFrame.CallCallback(SalEvent::ExtTextInputPos, );
-return QVariant(QRect(aPosEvent.mnX / fRatio, aPosEvent.mnY / 
fRatio,
-  aPosEvent.mnWidth / fRatio, 
aPosEvent.mnHeight / fRatio));
+if (!m_bInInputMethodQueryCursorRectangle)
+{
+m_bInInputMethodQueryCursorRectangle = true;
+SalExtTextInputPosEvent aPosEvent;
+m_rFrame.CallCallback(SalEvent::ExtTextInputPos, );
+const qreal fRatio = m_rFrame.devicePixelRatioF();
+m_aImCursorRectangle.setRect(aPosEvent.mnX / fRatio, 
aPosEvent.mnY / fRatio,
+ aPosEvent.mnWidth / fRatio,
+ aPosEvent.mnHeight / fRatio);
+m_bInInputMethodQueryCursorRectangle = false;
+}
+return QVariant(m_aImCursorRectangle);
 }
 case Qt::ImAnchorPosition:
 {


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |1 -
 vcl/qt5/QtMenu.cxx |4 
 2 files changed, 5 deletions(-)

New commits:
commit 4a537cf77affc4f1f2e2e5be9ff0b1ff11724509
Author: Jan-Marek Glogowski 
AuthorDate: Wed Apr 6 16:42:24 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 6 17:39:10 2022 +0200

Qt drop unused QtMenu::mpCloseButton

Change-Id: I988cabf4c07d5efd298c53b696f6d114f4f594bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132637
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index f39be7e8d506..11f3f00c5aa6 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -49,7 +49,6 @@ private:
 std::unique_ptr mpOwnedQMenu;
 // pointer to QMenu owned by the corresponding QtMenuItem or self (-> 
mpOwnedQMenu)
 QMenu* mpQMenu;
-QPushButton* mpCloseButton;
 
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index 71b81c22ba3e..50cb1d057431 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -40,7 +40,6 @@ QtMenu::QtMenu(bool bMenuBar)
 , mbMenuBar(bMenuBar)
 , mpQMenuBar(nullptr)
 , mpQMenu(nullptr)
-, mpCloseButton(nullptr)
 {
 }
 
@@ -430,8 +429,6 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 
 mpQMenuBar = new QMenuBar();
 pMainWindow->setMenuBar(mpQMenuBar);
-
-mpCloseButton = nullptr;
 mpQMenu = nullptr;
 
 DoFullMenuUpdate(mpVCLMenu);
@@ -665,7 +662,6 @@ void QtMenu::ShowCloseButton(bool bShow)
 pButton->setToolTip(toQString(VclResId(SV_HELPTEXT_CLOSEDOCUMENT)));
 mpQMenuBar->setCornerWidget(pButton, Qt::TopRightCorner);
 connect(pButton, ::clicked, this, 
::slotCloseDocument);
-mpCloseButton = pButton;
 }
 
 if (bShow)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |2 +-
 vcl/qt5/QtMenu.cxx |   38 --
 2 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 45d7a65f3d3dadcd71807a290fc11ff546aa5ba7
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 5 16:49:38 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 6 15:16:47 2022 +0200

tdf#145954 Qt unshare QMenubar usage

The Qt code was sharing the menu bar from the top level frame, but
LO expects independent menu bars per SetFrame calls. So instead of
showing the new bar and then hiding the old one, this was always
show and hiding the same menu bar, resulting in a hidden menu bar.

As a result of unsharing, LO now must check that its menu bar
pointer is still valid for usage. The QMainWindows takes ownership
when a QMenuBar is assigned and destroy old ones.

Change-Id: I2c6b12199a1e17a5d9f88686a4b27b1413beda47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132581
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132604
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index 55275ae6e099..f39be7e8d506 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -50,7 +50,6 @@ private:
 // pointer to QMenu owned by the corresponding QtMenuItem or self (-> 
mpOwnedQMenu)
 QMenu* mpQMenu;
 QPushButton* mpCloseButton;
-QMetaObject::Connection maCloseButtonConnection;
 
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
@@ -60,6 +59,7 @@ private:
 void ReinitializeActionGroup(unsigned nPos);
 void ResetAllActionGroups();
 void UpdateActionGroupItem(const QtMenuItem* pSalMenuItem);
+bool validateQMenuBar();
 
 public:
 QtMenu(bool bMenuBar);
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index c6224b137665..44873ce3384d 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -59,7 +59,7 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem, 
unsigned nPos)
 if (mbMenuBar)
 {
 // top-level menu
-if (mpQMenuBar)
+if (validateQMenuBar())
 {
 QMenu* pQMenu = new QMenu(toQString(aText), nullptr);
 pSalMenuItem->mpMenu.reset(pQMenu);
@@ -428,20 +428,10 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 if (!pMainWindow)
 return;
 
-mpQMenuBar = pMainWindow->menuBar();
-if (mpQMenuBar)
-{
-mpQMenuBar->clear();
-QPushButton* pButton
-= 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
-if (pButton && ((mpCloseButton != pButton) || 
!maCloseButtonConnection))
-{
-maCloseButtonConnection
-= connect(pButton, ::clicked, this, 
::slotCloseDocument);
-mpCloseButton = pButton;
-}
-}
+mpQMenuBar = new QMenuBar();
+pMainWindow->setMenuBar(mpQMenuBar);
 
+mpCloseButton = nullptr;
 mpQMenu = nullptr;
 
 DoFullMenuUpdate(mpVCLMenu);
@@ -565,9 +555,22 @@ QtMenu* QtMenu::GetTopLevel()
 return pMenu;
 }
 
+bool QtMenu::validateQMenuBar()
+{
+if (!mpQMenuBar)
+return false;
+assert(mpFrame);
+QtMainWindow* pMainWindow = mpFrame->GetTopLevelWindow();
+assert(pMainWindow);
+const bool bValid = mpQMenuBar == pMainWindow->menuBar();
+if (!bValid)
+mpQMenuBar = nullptr;
+return bValid;
+}
+
 void QtMenu::ShowMenuBar(bool bVisible)
 {
-if (mpQMenuBar)
+if (validateQMenuBar())
 mpQMenuBar->setVisible(bVisible);
 }
 
@@ -643,7 +646,7 @@ void QtMenu::slotCloseDocument()
 
 void QtMenu::ShowCloseButton(bool bShow)
 {
-if (!mpQMenuBar)
+if (!validateQMenuBar())
 return;
 
 QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
@@ -661,8 +664,7 @@ void QtMenu::ShowCloseButton(bool bShow)
 pButton->setFocusPolicy(Qt::NoFocus);
 pButton->setToolTip(toQString(VclResId(SV_HELPTEXT_CLOSEDOCUMENT)));
 mpQMenuBar->setCornerWidget(pButton, Qt::TopRightCorner);
-maCloseButtonConnection
-= connect(pButton, ::clicked, this, 
::slotCloseDocument);
+connect(pButton, ::clicked, this, 
::slotCloseDocument);
 mpCloseButton = pButton;
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx |1 
 vcl/qt5/QtFrame.cxx |   73 +++-
 vcl/qt5/QtWidget.cxx|8 +
 3 files changed, 15 insertions(+), 67 deletions(-)

New commits:
commit c309ddb6d9cd61f3024ffeee33fce1a0e173d9cc
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 4 18:02:28 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Apr 6 14:49:52 2022 +0200

tdf#144585 Qt fix Wayland LO fake popups

So Michael Weghorn was somehow reminded of an abandoned
commit from me ("Qt5 rework parent handling") archived in
https://gerrit.libreoffice.org/c/core/+/73463.

The bug introducing the new QWidget parenting, tdf#145363, was
resolved in a better way by explicitly setting parents for the
modal dialogs, so LO doesn't break Qt anymore. The actual problem
is, that an additional modal dialog needs to be stacked to the
previous modal dialog; no "parallel" modal dialogs are allowed,
which my original fix tried to enforce by reparenting.

Then there is the problem with Qt::Popup's focus grabbing on show,
which breaks LO's editable ComboBox. So LO's popup / FLOAT windows
are mapped to Qt::ToolTip, which are automatically advertised as
tooltips via accessibility. For X11 / xcb, Qt:Window with the
Qt::BypassWindowManagerHint works well enough as an alternative,
but WASM and Wayland don't seem to implement it correctly, so this
just handles popups as Qt::ToolTip on all platforms.

This reverts commit b00a68a8e19370e106cd76258a3c1825f43613ee
("tdf#145363 Qt reparent modal dialogs on show").
In addition the popup widgets are switched back to Qt::ToolTip.

Change-Id: If726771b4e9cc3f639f21cf502b3ec5985873643
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132526
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit fbf739198aa7f02975d531521c6525073783c7f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132625

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index dbf54079313d..59ec093a2ed6 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -133,7 +133,6 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 int menuBarOffset() const;
 
 void fixICCCMwindowGroup();
-void modalReparent(bool bVisible);
 
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 10b7e46909c5..ad9c03d0bfa1 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -149,11 +149,14 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 aWinFlags = Qt::Tool | Qt::FramelessWindowHint;
 else if (nStyle & SalFrameStyleFlags::TOOLTIP)
 aWinFlags = Qt::ToolTip;
-// Can't use Qt::Popup, because it grabs the input focus and generates
-// a focus-out event, reaching the combo box. This used to map to
-// Qt::ToolTip, which doesn't feel that correct...
+// Can't use Qt::Popup, because it grabs the input focus and generates 
a focus-out event,
+// instantly auto-closing the LO's editable ComboBox popup.
+// On X11, the alternative Qt::Window | Qt::FramelessWindowHint | 
Qt::BypassWindowManagerHint
+// seems to work well enough, but at least on Wayland and WASM, this 
results in problems.
+// So while using Qt::ToolTip, the popups are wrongly advertised via 
accessibility, at least
+// the GUI seems to work on all platforms... what a mess.
 else if (isPopup())
-aWinFlags = Qt::Window | Qt::FramelessWindowHint | 
Qt::BypassWindowManagerHint;
+aWinFlags = Qt::ToolTip | Qt::FramelessWindowHint;
 else if (nStyle & SalFrameStyleFlags::TOOLWINDOW)
 aWinFlags = Qt::Tool;
 // top level windows can't be transient in Qt, so make them dialogs, 
if they have a parent. At least
@@ -168,7 +171,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 if (aWinFlags == Qt::Window)
 {
 m_pTopLevel = new QtMainWindow(*this, aWinFlags);
-m_pQWidget = new QtWidget(*this, aWinFlags);
+m_pQWidget = new QtWidget(*this);
 m_pTopLevel->setCentralWidget(m_pQWidget);
 m_pTopLevel->setFocusProxy(m_pQWidget);
 }
@@ -417,38 +420,6 @@ void QtFrame::DrawMenuBar() { /* not needed */}
 
 void QtFrame::SetExtendedFrameStyle(SalExtStyle /*nExtStyle*/) { /* not needed 
*/}
 
-void QtFrame::modalReparent(bool bVisible)
-{
-#ifndef NDEBUG
-auto* pSalInst(static_cast(GetSalData()->m_pInstance));
-assert(pSalInst);
-assert(pSalInst->IsMainThread());
-assert(!asChild()->isVisible());
-assert(asChild()->isModal());
-#endif
-
-if (!bVisible)
-{
-m_pQWidget->setParent(m_pParent ? m_pParent->asChild() : 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 31 commits - chart2/Library_chartcore.mk chart2/source configure.ac connectivity/source cui/source download.lst extensions/source e

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 chart2/Library_chartcore.mk  |1 
 chart2/source/model/filter/XMLFilter.cxx |   10 
 configure.ac |6 
 connectivity/source/drivers/firebird/PreparedStatement.cxx   |4 
 cui/source/dialogs/FontFeaturesDialog.cxx|2 
 download.lst |8 
 extensions/source/propctrlr/formcomponenthandler.cxx |4 
 external/liborcus/UnpackedTarball_liborcus.mk|   17 
 external/liborcus/forcepoint-83.patch.1  |   16 
 external/liborcus/forcepoint-84.patch.1  |   16 
 external/liborcus/forcepoint-87.patch.1  |   27 +
 external/liborcus/forcepoint-88.patch.1  |   42 ++
 external/liborcus/forcepoint-95.patch.1  |   11 
 external/nss/ExternalProject_nss.mk  |3 
 external/zlib/UnpackedTarball_zlib.mk|4 
 external/zlib/ubsan.patch|   11 
 include/xmloff/SchXMLImportHelper.hxx|3 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs   |   10 
 oox/source/export/drawingml.cxx  |4 
 reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx  |8 
 reportdesign/source/filter/xml/xmlImportDocumentHandler.hxx  |3 
 reportdesign/source/ui/inspection/DataProviderHandler.cxx|3 
 sd/qa/unit/data/odp/tdf53970_linked.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   27 +
 sfx2/source/appl/newhelp.cxx |   17 
 sfx2/source/appl/newhelp.hxx |1 
 solenv/flatpak-manifest.in   |2 
 svl/source/passwordcontainer/passwordcontainer.cxx   |  115 
--
 svl/source/passwordcontainer/passwordcontainer.hxx   |   61 ++-
 sw/inc/unoprnms.hxx  |1 
 sw/qa/core/data/rtf/pass/forcepoint-96.rtf   |8 
 sw/qa/extras/layout/data/forcepoint100.html  |binary
 sw/qa/extras/layout/data/forcepoint102.rtf   |  178 
++
 sw/qa/extras/layout/data/forcepoint103.html  |binary
 sw/qa/extras/layout/data/forcepoint89.html   |binary
 sw/qa/extras/layout/data/forcepoint91.html   |binary
 sw/qa/extras/layout/data/forcepoint98.html   |binary
 sw/qa/extras/layout/data/forcepoint99.html   |binary
 sw/qa/extras/layout/data/tdf147485-forcepoint.doc|binary
 sw/qa/extras/layout/layout.cxx   |   55 ++-
 sw/qa/extras/odfimport/data/forcepoint101.fodt   |   13 
 sw/qa/extras/odfimport/odfimport.cxx |6 
 sw/qa/extras/ooxmlexport/data/tdf148273_sectionBulletFormatLeak.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf148361.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   33 +
 sw/qa/extras/uiwriter/uiwriter3.cxx  |   53 ++
 sw/qa/extras/uiwriter/uiwriter4.cxx  |   35 +
 sw/source/core/doc/DocumentContentOperationsManager.cxx  |   31 +
 sw/source/core/layout/layact.cxx |   12 
 sw/source/core/layout/sectfrm.cxx|3 
 sw/source/core/layout/tabfrm.cxx |   45 +-
 sw/source/core/text/itrform2.cxx |   15 
 sw/source/core/text/itrform2.hxx |2 
 sw/source/core/text/porlay.cxx   |4 
 sw/source/core/text/txtfrm.cxx   |8 
 sw/source/core/unocore/unodraw.cxx   |4 
 sw/source/core/unocore/unoframe.cxx  |1 
 sw/source/core/unocore/unoobj.cxx|9 
 sw/source/ui/dbui/mmoutputtypepage.cxx   |9 
 sw/source/uibase/app/docsh2.cxx  |   42 ++
 sw/source/uibase/dbui/mailmergehelper.cxx|7 
 sw/source/uibase/shells/annotsh.cxx  |3 
 vcl/qt5/QtFrame.cxx  |6 
 writerfilter/source/dmapper/DomainMapper.cxx   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a81c6d0634fbe0a4aa5836f277e4a8065d9a9b19
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jan 9 01:01:49 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 6 13:16:58 2022 +0200

Qt use platform-independent visibility functions

show() isn't just some conveniently renamed setVisible(true), but
presents a window in a platform-dependant way, which - at least
for WASM - means maximized and without a title bar. This is not
really expected and WASM can also use multiple windows.

Change-Id: I3fbaec1dfc2cd32bf3a90a94dcee01ebc88e58c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128179
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit f7346dc88200fa2160d39b4e4b4ae31fcad59a8c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132624
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 76e89ecdb76b..10b7e46909c5 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -461,7 +461,7 @@ void QtFrame::Show(bool bVisible, bool bNoActivate)
 if (!bVisible) // hide
 {
 pSalInst->RunInMainThread([this]() {
-asChild()->hide();
+asChild()->setVisible(false);
 if (m_pQWidget->isModal())
 modalReparent(false);
 });
@@ -475,7 +475,7 @@ void QtFrame::Show(bool bVisible, bool bNoActivate)
 QWidget* const pChild = asChild();
 if (m_pQWidget->isModal())
 modalReparent(true);
-pChild->show();
+pChild->setVisible(true);
 pChild->raise();
 if (!bNoActivate && !isPopup())
 {


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |2 +-
 vcl/qt5/QtMenu.cxx |   38 --
 2 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60
Author: Jan-Marek Glogowski 
AuthorDate: Tue Apr 5 16:49:38 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 6 11:27:35 2022 +0200

tdf#145954 Qt unshare QMenubar usage

The Qt code was sharing the menu bar from the top level frame, but
LO expects independent menu bars per SetFrame calls. So instead of
showing the new bar and then hiding the old one, this was always
show and hiding the same menu bar, resulting in a hidden menu bar.

As a result of unsharing, LO now must check that its menu bar
pointer is still valid for usage. The QMainWindows takes ownership
when a QMenuBar is assigned and destroy old ones.

Change-Id: I2c6b12199a1e17a5d9f88686a4b27b1413beda47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132581
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index 55275ae6e099..f39be7e8d506 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -50,7 +50,6 @@ private:
 // pointer to QMenu owned by the corresponding QtMenuItem or self (-> 
mpOwnedQMenu)
 QMenu* mpQMenu;
 QPushButton* mpCloseButton;
-QMetaObject::Connection maCloseButtonConnection;
 
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
@@ -60,6 +59,7 @@ private:
 void ReinitializeActionGroup(unsigned nPos);
 void ResetAllActionGroups();
 void UpdateActionGroupItem(const QtMenuItem* pSalMenuItem);
+bool validateQMenuBar();
 
 public:
 QtMenu(bool bMenuBar);
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index d9279fb9389a..71b81c22ba3e 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -59,7 +59,7 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem, 
unsigned nPos)
 if (mbMenuBar)
 {
 // top-level menu
-if (mpQMenuBar)
+if (validateQMenuBar())
 {
 QMenu* pQMenu = new QMenu(toQString(aText), nullptr);
 pSalMenuItem->mpMenu.reset(pQMenu);
@@ -428,20 +428,10 @@ void QtMenu::SetFrame(const SalFrame* pFrame)
 if (!pMainWindow)
 return;
 
-mpQMenuBar = pMainWindow->menuBar();
-if (mpQMenuBar)
-{
-mpQMenuBar->clear();
-QPushButton* pButton
-= 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
-if (pButton && ((mpCloseButton != pButton) || 
!maCloseButtonConnection))
-{
-maCloseButtonConnection
-= connect(pButton, ::clicked, this, 
::slotCloseDocument);
-mpCloseButton = pButton;
-}
-}
+mpQMenuBar = new QMenuBar();
+pMainWindow->setMenuBar(mpQMenuBar);
 
+mpCloseButton = nullptr;
 mpQMenu = nullptr;
 
 DoFullMenuUpdate(mpVCLMenu);
@@ -565,9 +555,22 @@ QtMenu* QtMenu::GetTopLevel()
 return pMenu;
 }
 
+bool QtMenu::validateQMenuBar()
+{
+if (!mpQMenuBar)
+return false;
+assert(mpFrame);
+QtMainWindow* pMainWindow = mpFrame->GetTopLevelWindow();
+assert(pMainWindow);
+const bool bValid = mpQMenuBar == pMainWindow->menuBar();
+if (!bValid)
+mpQMenuBar = nullptr;
+return bValid;
+}
+
 void QtMenu::ShowMenuBar(bool bVisible)
 {
-if (mpQMenuBar)
+if (validateQMenuBar())
 mpQMenuBar->setVisible(bVisible);
 }
 
@@ -643,7 +646,7 @@ void QtMenu::slotCloseDocument()
 
 void QtMenu::ShowCloseButton(bool bShow)
 {
-if (!mpQMenuBar)
+if (!validateQMenuBar())
 return;
 
 QPushButton* pButton = 
static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
@@ -661,8 +664,7 @@ void QtMenu::ShowCloseButton(bool bShow)
 pButton->setFocusPolicy(Qt::NoFocus);
 pButton->setToolTip(toQString(VclResId(SV_HELPTEXT_CLOSEDOCUMENT)));
 mpQMenuBar->setCornerWidget(pButton, Qt::TopRightCorner);
-maCloseButtonConnection
-= connect(pButton, ::clicked, this, 
::slotCloseDocument);
+connect(pButton, ::clicked, this, 
::slotCloseDocument);
 mpCloseButton = pButton;
 }
 


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx |1 
 vcl/qt5/QtFrame.cxx |   77 ++--
 vcl/qt5/QtWidget.cxx|8 +---
 3 files changed, 13 insertions(+), 73 deletions(-)

New commits:
commit fbf739198aa7f02975d531521c6525073783c7f1
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 4 18:02:28 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Wed Apr 6 09:52:11 2022 +0200

tdf#144585 Qt fix Wayland LO fake popups

So Michael Weghorn was somehow reminded of an abandoned
commit from me ("Qt5 rework parent handling") archived in
https://gerrit.libreoffice.org/c/core/+/73463.

The bug introducing the new QWidget parenting, tdf#145363, was
resolved in a better way by explicitly setting parents for the
modal dialogs, so LO doesn't break Qt anymore. The actual problem
is, that an additional modal dialog needs to be stacked to the
previous modal dialog; no "parallel" modal dialogs are allowed,
which my original fix tried to enforce by reparenting.

Then there is the problem with Qt::Popup's focus grabbing on show,
which breaks LO's editable ComboBox. So LO's popup / FLOAT windows
are mapped to Qt::ToolTip, which are automatically advertised as
tooltips via accessibility. For X11 / xcb, Qt:Window with the
Qt::BypassWindowManagerHint works well enough as an alternative,
but WASM and Wayland don't seem to implement it correctly, so this
just handles popups as Qt::ToolTip on all platforms.

This reverts commit b00a68a8e19370e106cd76258a3c1825f43613ee
("tdf#145363 Qt reparent modal dialogs on show").
In addition the popup widgets are switched back to Qt::ToolTip.

Change-Id: If726771b4e9cc3f639f21cf502b3ec5985873643
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132526
Reviewed-by: Jan-Marek Glogowski 
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 9aa31504bcd3..c6edaa58304d 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -132,7 +132,6 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 int menuBarOffset() const;
 
 void fixICCCMwindowGroup();
-void modalReparent(bool bVisible);
 
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 6c2e4757f84a..2e396fa8ce07 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -147,15 +147,14 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 aWinFlags = Qt::Tool | Qt::FramelessWindowHint;
 else if (nStyle & SalFrameStyleFlags::TOOLTIP)
 aWinFlags = Qt::ToolTip;
-// Can't use Qt::Popup, because it grabs the input focus and generates
-// a focus-out event, reaching the combo box. This used to map to
-// Qt::ToolTip, which doesn't feel that correct...
+// Can't use Qt::Popup, because it grabs the input focus and generates 
a focus-out event,
+// instantly auto-closing the LO's editable ComboBox popup.
+// On X11, the alternative Qt::Window | Qt::FramelessWindowHint | 
Qt::BypassWindowManagerHint
+// seems to work well enough, but at least on Wayland and WASM, this 
results in problems.
+// So while using Qt::ToolTip, the popups are wrongly advertised via 
accessibility, at least
+// the GUI seems to work on all platforms... what a mess.
 else if (isPopup())
-#ifdef EMSCRIPTEN
 aWinFlags = Qt::ToolTip | Qt::FramelessWindowHint;
-#else
-aWinFlags = Qt::Window | Qt::FramelessWindowHint | 
Qt::BypassWindowManagerHint;
-#endif
 else if (nStyle & SalFrameStyleFlags::TOOLWINDOW)
 aWinFlags = Qt::Tool;
 // top level windows can't be transient in Qt, so make them dialogs, 
if they have a parent. At least
@@ -170,7 +169,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 if (aWinFlags == Qt::Window)
 {
 m_pTopLevel = new QtMainWindow(*this, aWinFlags);
-m_pQWidget = new QtWidget(*this, aWinFlags);
+m_pQWidget = new QtWidget(*this);
 m_pTopLevel->setCentralWidget(m_pQWidget);
 m_pTopLevel->setFocusProxy(m_pQWidget);
 }
@@ -425,42 +424,6 @@ void QtFrame::DrawMenuBar() { /* not needed */}
 
 void QtFrame::SetExtendedFrameStyle(SalExtStyle /*nExtStyle*/) { /* not needed 
*/}
 
-void QtFrame::modalReparent(bool bVisible)
-{
-#ifndef NDEBUG
-auto* pSalInst(GetQtInstance());
-assert(pSalInst);
-assert(pSalInst->IsMainThread());
-assert(!asChild()->isVisible());
-assert(asChild()->isModal());
-#endif
-
-if (!bVisible)
-{
-QWidget* pNewParent = m_pParent ? m_pParent->asChild() : nullptr;
-if (pNewParent != m_pQWidget->parent())
-m_pQWidget->setParent(pNewParent, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/qt5

2022-04-05 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 95cf002cbc5c4d51f2e15b6e1bbda31f86c03a88
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 4 11:25:22 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 5 10:04:18 2022 +0200

tdf#147523 Qt use inner QWidget to set pointer pos

Regression from commit e63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d
("Qt use asChild for pointer positioning"), which should just have
been a cleanup for commit ca28826a087245686d7fca3ffc8ca1f03307924d
("tdf#131467 Qt set default position on first resize").

And scale the requested position by the device scale factor.

Change-Id: I50b3c628d22896e987d8cc2eaf5635cb12ba3464
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132518
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit cec215e0e3adaf26c89c4ffbaa53f87481772f0c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132388

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 7b24103908e9..76e89ecdb76b 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -871,7 +871,7 @@ void QtFrame::SetPointerPos(tools::Long nX, tools::Long nY)
 {
 // some cursor already exists (and it has m_ePointerStyle shape)
 // so here we just reposition it
-QCursor::setPos(asChild()->mapToGlobal(QPoint(nX, nY)));
+QCursor::setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY) / 
devicePixelRatioF()));
 }
 
 void QtFrame::Flush()


[Libreoffice-commits] core.git: basic/Library_sb.mk

2022-04-04 Thread Jan-Marek Glogowski (via logerrit)
 basic/Library_sb.mk |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit be7d84a3fbd47bf9a078ac7e6854bc4927e84933
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 4 15:11:10 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 4 21:36:10 2022 +0200

Fix --disable-scripting build (WASM)

Simply include the global transliterator in all builds.

Regression from commit de81c2545aec06a1b269218b7d00656e97d8b66c
("Related: tdf#144245 Optimize case-insensitive handling").

Change-Id: Ica1c6e5d67c8458f9977f2ff87d9594a43b4cff2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132517
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk
index 17fbcbd1010e..28effaaae0e1 100644
--- a/basic/Library_sb.mk
+++ b/basic/Library_sb.mk
@@ -66,7 +66,6 @@ $(eval $(call gb_Library_add_exception_objects,sb,\
basic/source/basmgr/vbahelper \
basic/source/classes/codecompletecache \
basic/source/classes/eventatt \
-   basic/source/classes/global \
basic/source/classes/image \
basic/source/classes/propacc \
basic/source/classes/sb \
@@ -104,6 +103,7 @@ endif
 
 $(eval $(call gb_Library_add_exception_objects,sb,\
basic/source/runtime/basrdll \
+   basic/source/classes/global \
basic/source/runtime/methods \
basic/source/runtime/methods1 \
basic/source/classes/sbintern \


[Libreoffice-commits] core.git: vcl/qt5

2022-04-04 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/QtFrame.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cec215e0e3adaf26c89c4ffbaa53f87481772f0c
Author: Jan-Marek Glogowski 
AuthorDate: Mon Apr 4 11:25:22 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Mon Apr 4 17:35:21 2022 +0200

tdf#147523 Qt use inner QWidget to set pointer pos

Regression from commit e63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d
("Qt use asChild for pointer positioning"), which should just have
been a cleanup for commit ca28826a087245686d7fca3ffc8ca1f03307924d
("tdf#131467 Qt set default position on first resize").

And scale the requested position by the device scale factor.

Change-Id: I50b3c628d22896e987d8cc2eaf5635cb12ba3464
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132518
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index a70b6616c0a7..6c2e4757f84a 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -883,7 +883,7 @@ void QtFrame::SetPointerPos(tools::Long nX, tools::Long nY)
 {
 // some cursor already exists (and it has m_ePointerStyle shape)
 // so here we just reposition it
-QCursor::setPos(asChild()->mapToGlobal(QPoint(nX, nY)));
+QCursor::setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY) / 
devicePixelRatioF()));
 }
 
 void QtFrame::Flush()


[Libreoffice-commits] core.git: configure.ac external/cairo external/cppunit external/freetype external/libnumbertext solenv/gbuild static/README.wasm.md

2022-03-30 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac|   21 +--
 external/cairo/ExternalProject_cairo.mk |2 -
 external/cppunit/ExternalProject_cppunit.mk |4 +-
 external/freetype/ExternalProject_freetype.mk   |2 -
 external/libnumbertext/ExternalProject_libnumbertext.mk |4 +-
 solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk  |3 +-
 static/README.wasm.md   |   22 +---
 7 files changed, 45 insertions(+), 13 deletions(-)

New commits:
commit 79365d6f5a3706da8464d564deee6bb54422c3d0
Author: Jan-Marek Glogowski 
AuthorDate: Sat Mar 26 20:46:56 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Wed Mar 30 15:12:21 2022 +0200

WASM fix native EH build since Emscripten 3.1.6

Building LO with WASM native EH and Emscripten 3.1.6+, the link
fails with a missing "emscripten_longjmp" symbol. Actually the
old build was simply wrong, because the emscripten_longjmp
function is just used for the Emscripten SjLj and not the native
WASM SjLj implementation. Linking just worked, because the used
libcompiler_rt-wasm-sjlj-mt.a lib was incorrectly providing that
symbol, which 3.1.6 removed.

But since running the NEH build still fails early in the same way
then before in FF nightly 100 and Chrome (= failure in the LO job
scheduler calling Task::UpdateMinPeriod for the "desktop::Desktop
m_firstRunTimer" timer, resulting in a WASM VM "RuntimeError:
indirect call signature mismatch"), there is still no way to know,
if nothing else it missing. The Emscripten / JS EH build still
works without any code changes. And it's not the first call on
a job object that fails...

And unfortunatly, because Qt itself also uses libpng, it also uses
SjLj for error handling, like LO in the image import, so the Qt
build must also be patched to build with "-s SUPPORT_LONGJMP=wasm".
Simply enough to do (see README.wasm.md). LO's configure now
detects that symbol and will bail out on incompatible Qt and LO
build setup.

See https://github.com/emscripten-core/emscripten/issues/16572

Change-Id: I3a1877f3aeb77873906176b9d3cd1ea92973f1f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132139
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/configure.ac b/configure.ac
index 9d97f42c4030..224faea12abf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4625,10 +4625,10 @@ check_use_ld()
 fi
 else
 # I tried to use gcc's '-B' and a directory + symlink setup 
in
-   # $BUILDDIR, but libtool always filtered-out that option, so gcc 
wouldn't
-   # pickup the alternative linker, when called by libtool for linking.
+# $BUILDDIR, but libtool always filtered-out that option, so gcc 
wouldn't
+# pickup the alternative linker, when called by libtool for 
linking.
 # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so 
instead.
-   AC_MSG_ERROR([A linker path is just supported with clang, because 
of libtool's -B filtering!])
+AC_MSG_ERROR([A linker path is just supported with clang, because 
of libtool's -B filtering!])
 fi
 fi
 use_ld_fail_if_error=$2
@@ -12966,6 +12966,21 @@ then
 if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f 
"$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
 AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} 
or ${QT5_PLATFORMS_SRCDIR}])
 fi
+
+EMSDK_LLVM_NM="$(em-config EMSCRIPTEN_ROOT)"/../bin/llvm-nm
+if ! test -x "$EMSDK_LLVM_NM"; then
+AC_MSG_ERROR([Missing llvm-nm expected to be found at 
"$EMSDK_LLVM_NM".])
+fi
+if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
+AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
+fi
+QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 
2>/dev/null | $GREP emscripten_longjmp`"
+if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
+AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a 
(missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
+fi
+if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
+AC_MSG_ERROR(['emscripten_longjmp' symbol not found in 
libQt5Gui.a. You probably use an incompatible Qt build with '-s 
SUPPORT_LONGJMP=wasm'.])
+fi
 fi
 
 QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT 
-DQT_NO_VERSION_TAGGING"
diff --git a/external/cairo/ExternalProject_cairo.mk 
b/external/cairo/ExternalProject_cairo.mk
index f1bf3ddbd1b2..0996572d63ba 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -48,7 +48,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :

[Libreoffice-commits] core.git: Branch 'feature/wasm' - 1338 commits - accessibility/inc accessibility/source android/default-document android/source avmedia/source basctl/inc basctl/source basegfx/so

2022-03-29 Thread Jan-Marek Glogowski (via logerrit)
Rebased ref, commits from common ancestor:
commit ecbb8e6b04ed1f474c3b9f1d83903118bb2b0d60
Author: Jan-Marek Glogowski 
AuthorDate: Sat Mar 26 20:46:56 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Tue Mar 29 20:11:36 2022 +0200

WASM fix native EH build since Emscripten 3.1.6

Building LO with WASM native EH and Emscripten 3.1.6+, the link
fails with a missing "emscripten_longjmp" symbol. Actually the
old build was simply wrong, because the emscripten_longjmp
function is just used for the Emscripten SjLj and not the native
WASM SjLj implementation. Linking just worked, because the used
libcompiler_rt-wasm-sjlj-mt.a lib was incorrectly providing that
symbol, which 3.1.6 removed.

But since running the NEH build still fails early in the same way
then before in FF nightly 100 and Chrome (= failure in the LO job
scheduler calling Task::UpdateMinPeriod for the "desktop::Desktop
m_firstRunTimer" timer, resulting in a WASM VM "RuntimeError:
indirect call signature mismatch"), there is still no way to know,
if nothing else it missing. The Emscripten / JS EH build still
works without any code changes. And it's not the first call on
a job object that fails...

And unfortunatly, because Qt itself also uses libpng, it also uses
SjLj for error handling, like LO in the image import, so the Qt
build must also be patched to build with "-s SUPPORT_LONGJMP=wasm".
Simply enough to do (see README.wasm.md). LO's configure now
detects that symbol and will bail out on incompatible Qt and LO
build setup.

See https://github.com/emscripten-core/emscripten/issues/16572

Change-Id: I3a1877f3aeb77873906176b9d3cd1ea92973f1f6

diff --git a/configure.ac b/configure.ac
index 9d97f42c4030..224faea12abf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4625,10 +4625,10 @@ check_use_ld()
 fi
 else
 # I tried to use gcc's '-B' and a directory + symlink setup 
in
-   # $BUILDDIR, but libtool always filtered-out that option, so gcc 
wouldn't
-   # pickup the alternative linker, when called by libtool for linking.
+# $BUILDDIR, but libtool always filtered-out that option, so gcc 
wouldn't
+# pickup the alternative linker, when called by libtool for 
linking.
 # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so 
instead.
-   AC_MSG_ERROR([A linker path is just supported with clang, because 
of libtool's -B filtering!])
+AC_MSG_ERROR([A linker path is just supported with clang, because 
of libtool's -B filtering!])
 fi
 fi
 use_ld_fail_if_error=$2
@@ -12966,6 +12966,21 @@ then
 if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f 
"$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
 AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} 
or ${QT5_PLATFORMS_SRCDIR}])
 fi
+
+EMSDK_LLVM_NM="$(em-config EMSCRIPTEN_ROOT)"/../bin/llvm-nm
+if ! test -x "$EMSDK_LLVM_NM"; then
+AC_MSG_ERROR([Missing llvm-nm expected to be found at 
"$EMSDK_LLVM_NM".])
+fi
+if test ! -f "${qt5_libdir}"/libQt5Gui.a; then
+AC_MSG_ERROR([No Qt5 WASM libQt5Gui.a in ${qt5_libdir}])
+fi
+QT5_WASM_SJLJ="`${EMSDK_LLVM_NM} "${qt5_libdir}"/libQt5Gui.a 
2>/dev/null | $GREP emscripten_longjmp`"
+if test "$ENABLE_WASM_EXCEPTIONS" = TRUE -a -n "$QT5_WASM_SJLJ"; then
+AC_MSG_ERROR(['emscripten_longjmp' symbol found in libQt5Gui.a 
(missing '-s SUPPORT_LONGJMP=wasm'). See static/README.wasm.md.])
+fi
+if test "$ENABLE_WASM_EXCEPTIONS" != TRUE -a -z "$QT5_WASM_SJLJ"; then
+AC_MSG_ERROR(['emscripten_longjmp' symbol not found in 
libQt5Gui.a. You probably use an incompatible Qt build with '-s 
SUPPORT_LONGJMP=wasm'.])
+fi
 fi
 
 QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT 
-DQT_NO_VERSION_TAGGING"
diff --git a/external/cairo/ExternalProject_cairo.mk 
b/external/cairo/ExternalProject_cairo.mk
index f1bf3ddbd1b2..0996572d63ba 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -48,7 +48,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
$(gb_RUN_CONFIGURE) ./configure \
$(if $(debug),STRIP=" ") \
$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) 
$(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
-   $(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) 
-Wno-enum-conversion" --enable-pthread=yes PTHREAD_LIBS="") \
+   $(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) 
-Wno-enum-conversion $(gb_EMSCRIPTEN_CPPFLAGS)" --enable-pthread=yes 
PTHREAD_LIBS="") \
$(if $(filter-out EMSCRIPTEN ANDROID 
iOS,$(OS)),CFLAGS="$(CFLAGS) $(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
$(if $(filter ANDROID 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - configure.ac helpcompiler/Module_helpcompiler.mk RepositoryExternal.mk

2022-03-09 Thread Jan-Marek Glogowski (via logerrit)
 RepositoryExternal.mk   |2 +-
 configure.ac|9 -
 helpcompiler/Module_helpcompiler.mk |2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit ef47b4c2aa50b74d1f337f764428bfb1a537faa8
Author: Jan-Marek Glogowski 
AuthorDate: Tue Dec 21 14:12:10 2021 +0100
Commit: Andras Timar 
CommitDate: Wed Mar 9 12:31:43 2022 +0100

Don't build clucene if not needed

Just build it if HELPTOOLS or XMLHELP are in BUILD_TYPE. And
simply tets for clucene just in this case. And since XMLHELP
is not in the list of PERMITTED_BUILD_TARGETS, disable it.

Change-Id: I13fdbf096c60191a428e23c22344f7e22e8c5d66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127231
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9044f574bc81..d86edc543e44 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2940,7 +2940,7 @@ $(call gb_LinkTarget_use_libraries,$(1),\
 endef
 
 $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo,\
-   clucene \
+$(call gb_Helper_optionals_or,HELPTOOLS XMLHELP,clucene) \
 ))
 
 endif # SYSTEM_CLUCENE
diff --git a/configure.ac b/configure.ac
index 03e7fc52d688..a7d6267c73cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -813,6 +813,7 @@ disable_database_connectivity_dependencies()
 # ===
 build_crypto=yes
 test_cmis=yes
+test_clucene=no
 test_gdb_index=no
 test_openldap=yes
 test_split_debug=no
@@ -5413,6 +5414,7 @@ fi
 AC_MSG_CHECKING([if we need to build the help index tooling])
 if test "$with_help" = yes -o "$enable_extension_integration" != no; then
 BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
+test_clucene=yes
 AC_MSG_RESULT([yes])
 else
 AC_MSG_RESULT([no])
@@ -5442,6 +5444,7 @@ fi
 AC_MSG_CHECKING([whether to include the XML-help support])
 if test "$enable_xmlhelp" = yes; then
 BUILD_TYPE="$BUILD_TYPE XMLHELP"
+test_clucene=yes
 AC_DEFINE(HAVE_FEATURE_XMLHELP)
 AC_MSG_RESULT([yes])
 else
@@ -5552,6 +,7 @@ if test "$cross_compiling" = "yes"; then
 --build="$build_alias" \
 --disable-cairo-canvas \
 --disable-cups \
+--disable-customtarget-components \
 --disable-firebird-sdbc \
 --disable-gpgmepp \
 --disable-gstreamer-1-0 \
@@ -5564,6 +5568,7 @@ if test "$cross_compiling" = "yes"; then
 --disable-pdfimport \
 --disable-postgresql-sdbc \
 --disable-skia \
+--disable-xmlhelp \
 --enable-icecream="$enable_icecream" \
 --without-doxygen \
 --without-webdav \
@@ -9324,8 +9329,8 @@ dnl 
===
 dnl we should rather be using
 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
 dnl but the contribs-lib check seems tricky
-if test "$enable_xmlhelp" = yes -o "$enable_extension_integration" = yes; then
 AC_MSG_CHECKING([which clucene to use])
+if test "$test_clucene" = yes; then
 if test "$with_system_clucene" = "yes"; then
 AC_MSG_RESULT([external])
 SYSTEM_CLUCENE=TRUE
@@ -9352,6 +9357,8 @@ else
 SYSTEM_CLUCENE=
 BUILD_TYPE="$BUILD_TYPE CLUCENE"
 fi
+else
+AC_MSG_RESULT([not needed])
 fi
 AC_SUBST(SYSTEM_CLUCENE)
 AC_SUBST(CLUCENE_CFLAGS)
diff --git a/helpcompiler/Module_helpcompiler.mk 
b/helpcompiler/Module_helpcompiler.mk
index 146e3868df3f..344faba3a1b8 100644
--- a/helpcompiler/Module_helpcompiler.mk
+++ b/helpcompiler/Module_helpcompiler.mk
@@ -10,7 +10,7 @@
 $(eval $(call gb_Module_Module,helpcompiler))
 
 $(eval $(call gb_Module_add_targets,helpcompiler,\
-Library_helplinker \
+$(call gb_Helper_optionals_or,HELPTOOLS XMLHELP,Library_helplinker) \
 ))
 
 $(eval $(call gb_Module_add_targets_for_build,helpcompiler,\


[Libreoffice-commits] core.git: external/liborcus

2022-02-20 Thread Jan-Marek Glogowski (via logerrit)
 external/liborcus/ExternalProject_liborcus.mk |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 26603bc9ef0116ed31c510dab82b69d3666447b5
Author: Jan-Marek Glogowski 
AuthorDate: Thu Feb 10 09:38:40 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 20:43:57 2022 +0100

WASM fix orcus native exception handling (NEH)

While this fixes the build with --enable-wasm-exceptions, the
resulting binary generates an "indirect call signature mismatch",
which doesn't happen with the non-NEH build.

The Chrome DWARF backtrace points to CallbackTaskScheduling().
Further debugging reveals, it's actually the UpdateMinPeriod
call for the "desktop::Desktop m_firstRunTimer" Timer.
Disturbingly the debug dynamic_cast at the start of the
job loop fails, and the fallback generic job output is
chosen, AKA:

info:vcl.schedule: 6516 0x3871618  i: 0 a: 1 p: 1 \
desktop::Desktop m_firstRunTimer

m_firstRunTimer is a Timer member in the Desktop class, so this
looks like some memory corruption or toolchain problem.

The size difference is more then 10% and it's supposed to be
faster too. FWIW the optimized link time is still high and needs
32GB+ memory compared to the 13GB non-optimized memory usage.

Change-Id: I06d37ecece09000fd3b72a73e7bf40f0b0f61457
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130216
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/external/liborcus/ExternalProject_liborcus.mk 
b/external/liborcus/ExternalProject_liborcus.mk
index 638271a5a398..d067b741146a 100644
--- a/external/liborcus/ExternalProject_liborcus.mk
+++ b/external/liborcus/ExternalProject_liborcus.mk
@@ -91,8 +91,8 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
$(call gb_ExternalProject_run,build,\
$(if $(liborcus_LIBS),LIBS='$(liborcus_LIBS)') \
$(if $(liborcus_CXXFLAGS),CXXFLAGS='$(liborcus_CXXFLAGS)') \
-   $(if $(liborcus_CPPFLAGS),CPPFLAGS='$(liborcus_CPPFLAGS) 
$(gb_EMSCRIPTEN_CPPFLAGS)') \
-   $(if $(liborcus_LDFLAGS),LDFLAGS='$(liborcus_LDFLAGS)') \
+   $(if $(liborcus_CPPFLAGS),CPPFLAGS='$(liborcus_CPPFLAGS) 
$(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_EXCEPT)') \
+   $(if $(liborcus_LDFLAGS),LDFLAGS='$(liborcus_LDFLAGS) 
$(gb_EMSCRIPTEN_EXCEPT)') \
MDDS_CFLAGS='$(MDDS_CFLAGS)' \
MDDS_LIBS=' ' \
MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \


[Libreoffice-commits] core.git: svx/inc svx/source

2022-02-20 Thread Jan-Marek Glogowski (via logerrit)
 svx/inc/sdr/contact/viewobjectcontactofsdrmediaobj.hxx|2 +-
 svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx |   14 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 0b0d41b48fa7c5aebd42bdce60dab77421743ae1
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 20 15:26:25 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 20:43:26 2022 +0100

Fix --disable-avmedia build

Regression from commit 6f938dce6eaa927cfde39491ef7a0bc1d07df66b
("update video pos and size after change if currently playing").

Change-Id: Ib618fcd7347255d0cae352b7fc90aa85a2c14d32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130215
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/svx/inc/sdr/contact/viewobjectcontactofsdrmediaobj.hxx 
b/svx/inc/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
index d362048df3db..891c920aed79 100644
--- a/svx/inc/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
+++ b/svx/inc/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
@@ -54,7 +54,7 @@ namespace sdr::contact
 virtual void ActionChanged() override;
 
 private:
-void updateMediaWindow() const;
+void updateMediaWindow(bool bShow) const;
 
 #if HAVE_FEATURE_AVMEDIA
 std::unique_ptr mpMediaWindow;
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx 
b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
index 0241fabd5661..777017472bf6 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
@@ -87,12 +87,15 @@ Size ViewObjectContactOfSdrMediaObj::getPreferredSize() 
const
 void ViewObjectContactOfSdrMediaObj::ActionChanged()
 {
 ViewObjectContactOfSdrObj::ActionChanged();
-if (mpMediaWindow && mpMediaWindow->isVisible())
-updateMediaWindow();
+updateMediaWindow(false);
 }
 
-void ViewObjectContactOfSdrMediaObj::updateMediaWindow() const
+void ViewObjectContactOfSdrMediaObj::updateMediaWindow(bool bShow) const
 {
+#if HAVE_FEATURE_AVMEDIA
+if (!mpMediaWindow || (!bShow && !mpMediaWindow->isVisible()))
+return;
+
 basegfx::B2DRange aViewRange(getObjectRange());
 
aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation());
 
@@ -120,6 +123,9 @@ void ViewObjectContactOfSdrMediaObj::updateMediaWindow() 
const
 // through to gtk which will now accept it as the underlying
 // m_pSocket of GtkSalObject::SetPosSize is now visible
 mpMediaWindow->setPosSize(aViewRectangle);
+#else
+(void) bShow;
+#endif
 }
 
 void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& 
rItem ) const
@@ -137,7 +143,7 @@ void ViewObjectContactOfSdrMediaObj::updateMediaItem( 
::avmedia::MediaItem& rIte
 }
 else
 {
-updateMediaWindow();
+updateMediaWindow(true);
 }
 #else
 (void) rItem;


[Libreoffice-commits] core.git: configure.ac solenv/gbuild vcl/Library_vcl.mk

2022-02-20 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac   |   12 
 solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk |2 +-
 vcl/Library_vcl.mk |   16 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit ac65b4bb7a75ec71294a527bc4139356fcbf0929
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 20 18:15:10 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 20:12:07 2022 +0100

WASM depend on Emscripten 3.1.3 for native EH

This reverts the special SjLj handling introduced in commit
ae22f7d06246ee21f9c8e9f35f4477e88843c58b ("WASM add option to
build with native exceptions"). This is supposed to work now;
at least it compiles.

Change-Id: I5ebceea9c7fe3c982d7c9a8818fd79f2018f03cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130219
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/configure.ac b/configure.ac
index 6d81302b9e7e..af1da0103177 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3073,7 +3073,19 @@ if test "$enable_wasm_strip" = "yes"; then
 AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
 fi
 
+EMSCRIPTEN_NEH_MAJOR=3
+EMSCRIPTEN_NEH_MINOR=1
+EMSCRIPTEN_NEH_TINY=3
+EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
+
 if test "$enable_wasm_exceptions" = yes; then
+AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION 
for SjLj + native EH])
+check_semantic_version_three_prefixed EMSCRIPTEN NEH
+if test $? -ne 0; then
+AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
+else
+AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
+fi
 ENABLE_WASM_EXCEPTIONS=TRUE
 fi
 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk 
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index a0ba51da2e4f..83e850a95f9f 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -32,7 +32,7 @@ gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST 
-DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO
 
 gb_Executable_EXT := .html
 ifeq ($(ENABLE_WASM_EXCEPTIONS),TRUE)
-gb_EMSCRIPTEN_EXCEPT = -fwasm-exceptions
+gb_EMSCRIPTEN_EXCEPT = -fwasm-exceptions -s SUPPORT_LONGJMP=wasm
 else
 gb_EMSCRIPTEN_EXCEPT = -s DISABLE_EXCEPTION_CATCHING=0
 endif
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 9182f223eb93..d580ff3d2f6a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -94,20 +94,6 @@ $(eval $(call gb_Library_use_externals,vcl,\
 mdds_headers \
 ))
 
-# WASM LLVM doesn't support native EH + SjLj (setjump / longjump) used by 
libjpeg / libpng.
-# This otherwise breaks the PCH generation, so just move the files for that 
case.
-ifeq (EMSCRIPTEN_TRUE,$(OS)_$(ENABLE_WASM_EXCEPTIONS))
-$(eval $(call gb_Library_add_cxxobjects,vcl,\
-vcl/source/filter/jpeg/jpegc \
-vcl/source/filter/png/PngImageReader \
-))
-else
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-vcl/source/filter/jpeg/jpegc \
-vcl/source/filter/png/PngImageReader \
-))
-endif
-
 $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/rendercontext/drawmode \
 vcl/skia/SkiaHelper \
@@ -474,6 +460,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/ixpm/xpmread \
 vcl/source/filter/jpeg/Exif \
 vcl/source/filter/jpeg/jpeg \
+vcl/source/filter/jpeg/jpegc \
 vcl/source/filter/jpeg/JpegReader \
 vcl/source/filter/jpeg/JpegWriter \
 vcl/source/filter/jpeg/JpegTransform \
@@ -484,6 +471,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/wmf/wmf \
 vcl/source/filter/wmf/wmfexternal \
 vcl/source/filter/wmf/wmfwr \
+vcl/source/filter/png/PngImageReader \
 vcl/source/filter/png/pngwrite \
 vcl/source/filter/webp/reader \
 vcl/source/filter/webp/writer \


[Libreoffice-commits] core.git: configure.ac

2022-02-20 Thread Jan-Marek Glogowski (via logerrit)
 configure.ac |   47 +++
 1 file changed, 47 insertions(+)

New commits:
commit 89d97041e881ef6429c069e7d0485db50e0371b2
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 20 18:10:38 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 19:42:05 2022 +0100

WASM test minimal Emscripten version in configure

Extracting the version from the compiler defines is probably more
stable then the elaborative emcc -v output.

Change-Id: I491c0983be7f9811f4f6775b0a5f3cb172f0aefe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130218
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/configure.ac b/configure.ac
index a1167a9cda5b..6d81302b9e7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,34 @@ dnl path location is gpg, so make sure we find it
 unset mac_gpg_path
 }
 
+dnl sematically test a three digits version
+dnl $1 - $3 = minimal version
+dnl $4 - $6 = current version
+
+check_semantic_version_three()
+{
+test "$4" -gt "$1" \
+-o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
+-o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
+return $?
+}
+
+dnl calls check_semantic_version_three with digits in named variables 
$1_MAJOR, $1_MINOR, $1_TINY
+dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
+dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
+
+check_semantic_version_three_prefixed()
+{
+eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
+eval local MIN_MINOR="\$${1}_${2}_MINOR"
+eval local MIN_TINY="\$${1}_${2}_TINY"
+eval local CUR_MAJOR="\$${1}_MAJOR"
+eval local CUR_MINOR="\$${1}_MINOR"
+eval local CUR_TINY="\$${1}_TINY"
+check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR 
$CUR_MINOR $CUR_TINY
+return $?
+}
+
 echo ""
 echo "*"
 echo "*   Running ${PACKAGE_NAME} build configuration."
@@ -1375,7 +1403,26 @@ dnl 
===
 dnl Sanity checks for Emscripten SDK setup
 dnl ===
 
+EMSCRIPTEN_MIN_MAJOR=2
+EMSCRIPTEN_MIN_MINOR=0
+EMSCRIPTEN_MIN_TINY=31
+EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
+
 if test "$_os" = "Emscripten"; then
+AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
+EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
+EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_major__ //p')
+EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_minor__ //p')
+EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_tiny__ //p')
+
EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
+
+check_semantic_version_three_prefixed EMSCRIPTEN MIN
+if test $? -eq 0; then
+AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
+else
+AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
+fi
+
 EMSCRIPTEN_ERROR=0
 if ! which emconfigure >/dev/null 2>&1; then
 AC_MSG_WARN([emconfigure must be in your \$PATH])


[Libreoffice-commits] core.git: Branch 'feature/wasm' - 808 commits - accessibility/source android/default-document animations/source avmedia/inc avmedia/Library_avmediagtk.mk avmedia/Module_avmedia.m

2022-02-20 Thread Jan-Marek Glogowski (via logerrit)
Rebased ref, commits from common ancestor:
commit 2172b7e689d41dd3fcea2ad4c2beae5b8e7b43ab
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 20 18:15:10 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 19:06:47 2022 +0100

WASM depend on Emscripten 3.1.3 for native EH

This reverts the special SjLj handling introduced in commit
ae22f7d06246ee21f9c8e9f35f4477e88843c58b ("WASM add option to
build with native exceptions"). This is supposed to work now;
at least it compiles.

Change-Id: I5ebceea9c7fe3c982d7c9a8818fd79f2018f03cc

diff --git a/configure.ac b/configure.ac
index 6d81302b9e7e..af1da0103177 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3073,7 +3073,19 @@ if test "$enable_wasm_strip" = "yes"; then
 AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
 fi
 
+EMSCRIPTEN_NEH_MAJOR=3
+EMSCRIPTEN_NEH_MINOR=1
+EMSCRIPTEN_NEH_TINY=3
+EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
+
 if test "$enable_wasm_exceptions" = yes; then
+AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION 
for SjLj + native EH])
+check_semantic_version_three_prefixed EMSCRIPTEN NEH
+if test $? -ne 0; then
+AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
+else
+AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
+fi
 ENABLE_WASM_EXCEPTIONS=TRUE
 fi
 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk 
b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index a0ba51da2e4f..83e850a95f9f 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -32,7 +32,7 @@ gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST 
-DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO
 
 gb_Executable_EXT := .html
 ifeq ($(ENABLE_WASM_EXCEPTIONS),TRUE)
-gb_EMSCRIPTEN_EXCEPT = -fwasm-exceptions
+gb_EMSCRIPTEN_EXCEPT = -fwasm-exceptions -s SUPPORT_LONGJMP=wasm
 else
 gb_EMSCRIPTEN_EXCEPT = -s DISABLE_EXCEPTION_CATCHING=0
 endif
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 9182f223eb93..d580ff3d2f6a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -94,20 +94,6 @@ $(eval $(call gb_Library_use_externals,vcl,\
 mdds_headers \
 ))
 
-# WASM LLVM doesn't support native EH + SjLj (setjump / longjump) used by 
libjpeg / libpng.
-# This otherwise breaks the PCH generation, so just move the files for that 
case.
-ifeq (EMSCRIPTEN_TRUE,$(OS)_$(ENABLE_WASM_EXCEPTIONS))
-$(eval $(call gb_Library_add_cxxobjects,vcl,\
-vcl/source/filter/jpeg/jpegc \
-vcl/source/filter/png/PngImageReader \
-))
-else
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-vcl/source/filter/jpeg/jpegc \
-vcl/source/filter/png/PngImageReader \
-))
-endif
-
 $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/rendercontext/drawmode \
 vcl/skia/SkiaHelper \
@@ -474,6 +460,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/ixpm/xpmread \
 vcl/source/filter/jpeg/Exif \
 vcl/source/filter/jpeg/jpeg \
+vcl/source/filter/jpeg/jpegc \
 vcl/source/filter/jpeg/JpegReader \
 vcl/source/filter/jpeg/JpegWriter \
 vcl/source/filter/jpeg/JpegTransform \
@@ -484,6 +471,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/wmf/wmf \
 vcl/source/filter/wmf/wmfexternal \
 vcl/source/filter/wmf/wmfwr \
+vcl/source/filter/png/PngImageReader \
 vcl/source/filter/png/pngwrite \
 vcl/source/filter/webp/reader \
 vcl/source/filter/webp/writer \
commit 495157606f8b524e1e795ba07e02964a5f0ef84f
Author: Jan-Marek Glogowski 
AuthorDate: Sun Feb 20 18:10:38 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Sun Feb 20 19:06:47 2022 +0100

WASM test minimal Emscripten version in configure

Extracting the version from the compiler defines is probably more
stable then the elaborative emcc -v output.

Change-Id: I491c0983be7f9811f4f6775b0a5f3cb172f0aefe

diff --git a/configure.ac b/configure.ac
index a1167a9cda5b..6d81302b9e7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,34 @@ dnl path location is gpg, so make sure we find it
 unset mac_gpg_path
 }
 
+dnl sematically test a three digits version
+dnl $1 - $3 = minimal version
+dnl $4 - $6 = current version
+
+check_semantic_version_three()
+{
+test "$4" -gt "$1" \
+-o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
+-o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
+return $?
+}
+
+dnl calls check_semantic_version_three with digits in named variables 
$1_MAJOR, $1_MINOR, $1_TINY
+dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
+dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
+
+check_semantic_version_three_prefixed()
+{
+eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
+eval local MIN_MINOR="\$${1}_${2}_MINOR"
+eval local MIN_TINY="\$${1}_${2}_TINY"
+eval local CUR_MAJOR="\$${1}_MAJOR"
+eval 

[Libreoffice-commits] core.git: solenv/gbuild

2022-02-11 Thread Jan-Marek Glogowski (via logerrit)
 solenv/gbuild/ComponentTarget.mk |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2483cd198b51bd5d0819cbebf40f211b2ef1236d
Author: Jan-Marek Glogowski 
AuthorDate: Fri Feb 11 19:40:36 2022 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Fri Feb 11 20:46:21 2022 +0100

Correctly depend on source component file

Regression from commit 17ec55c48082254e1f55bcfa00808e45a50a9801
("Fail on non-optional, but filtered component names").

Change-Id: Idab5b3dbf9658c03b0ec1af67d1d9b740111c6a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129849
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk
index aed3fd88e889..3ba9cdb00d6b 100644
--- a/solenv/gbuild/ComponentTarget.mk
+++ b/solenv/gbuild/ComponentTarget.mk
@@ -102,7 +102,7 @@ $(call gb_ComponentTarget_get_target,$(1)) : 
COMPONENTSOURCE := $(call gb_Compon
 $(call gb_ComponentTarget_get_target,$(1)) : COMPONENTIMPL :=
 $(call gb_ComponentTarget_get_target,$(1)) : ALLFILTEREDIMPL := $(call 
gb_ComponentTarget__init_allfiltered,$(1))
 
-$(call gb_ComponentTarget_get_target,$(1)) : $(call 
gb_ComponentTarget__source,$(1))
+$(call gb_ComponentTarget_get_target,$(1)) : $(call 
gb_ComponentTarget__init_source,$(1))
 $(call gb_ComponentTarget_get_target,$(1)).optionals : $(call 
gb_ComponentTarget__init_source,$(1))
 $(call gb_ComponentTarget_get_target,$(1)).allfiltered : $(call 
gb_ComponentTarget__init_allfiltered,$(1))
 


  1   2   3   4   5   6   7   8   9   10   >