vcl/qt5/QtInstance.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 7be32268e086e122e64f7aa12566b6a092c63d20
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Thu Oct 17 14:13:01 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Oct 17 17:39:03 2024 +0200

    Fix experimental Emscripten --enable-qt6 build resource issues
    
    ...where window decoration icons and menu text glyphs were missing
    
    Change-Id: Iadff019a99fbe96442fc010df0d019ba5e2b98e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175088
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 8a0ace0509f9..e3348828a5bd 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -53,6 +53,7 @@
 #include <vclpluginapi.h>
 #include <tools/debug.hxx>
 #include <comphelper/flagguard.hxx>
+#include <config_vclplug.h>
 #include <dndhelper.hxx>
 #include <vcl/stdtext.hxx>
 #include <vcl/sysdata.hxx>
@@ -70,6 +71,9 @@
 #ifdef EMSCRIPTEN
 #include <QtCore/QtPlugin>
 Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
+#if defined DISABLE_DYNLOADING && ENABLE_QT6
+#include <QtCore/QtResource>
+#endif
 #endif
 
 namespace
@@ -868,9 +872,23 @@ weld::MessageDialog* 
QtInstance::CreateMessageDialog(weld::Widget* pParent,
     }
 }
 
+static void initResources()
+{
+#if defined EMSCRIPTEN && defined DISABLE_DYNLOADING && ENABLE_QT6
+    // Make sure the resources from Qt6's plugins/platforms/libqwasm.a are not 
stripped out of a
+    // statically linked binary (and this code cannot be directly in extern 
"C" create_SalInstance,
+    // as the expansion of Q_INIT_RESOURCE contains extern function 
declarations that would then
+    // erroneously be C function declarations):
+    Q_INIT_RESOURCE(wasmfonts);
+    Q_INIT_RESOURCE(wasmwindow);
+#endif
+}
+
 extern "C" {
 VCLPLUG_QT_PUBLIC SalInstance* create_SalInstance()
 {
+    initResources();
+
     std::unique_ptr<char* []> pFakeArgv;
     std::unique_ptr<int> pFakeArgc;
     std::vector<FreeableCStr> aFakeArgvFreeable;

Reply via email to