summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-05-09 15:08:34 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-05-09 15:08:34 +0100
commit08a6ca447d3a5f4810c7b632c98de39a446279d5 (patch)
treec2807795b707f3168d089fbcfb39fd0480fe6d56
parent3e2b5e619e7d8fc5eb1a23b5b0e93a049752c443 (diff)
DO NOT MERGE: dirty hacks for tiled rendering to work via libLO. feature/gtktiledviewer
Change-Id: I86e13192ddb5904afabca38d3a201f17f145de09
-rw-r--r--desktop/Library_sofficeapp.mk8
-rw-r--r--desktop/source/lib/init.cxx56
2 files changed, 52 insertions, 12 deletions
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index f2fe076daf0f..d756437c8938 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -17,6 +17,13 @@ $(eval $(call gb_Library_set_include,sofficeapp,\
-I$(SRCDIR)/sw/inc \
))
+$(eval $(call gb_Library_add_libs,sofficeapp,\
+ $(if $(filter $(OS),LINUX), \
+ -ldl \
+ -lpthread \
+ ) \
+))
+
$(eval $(call gb_Library_use_external,sofficeapp,boost_headers))
$(eval $(call gb_Library_use_custom_headers,sofficeapp,\
@@ -43,6 +50,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
sfx \
svl \
svt \
+ sw \
tk \
tl \
ucbhelper \
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fb223e7fcbde..f192bb09f100 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -49,6 +49,9 @@
#include <unotxdoc.hxx>
#include <viewsh.hxx>
+// We also need to hackily be able to start the main libreoffice thread
+#include "../app/sofficemain.h"
+
using namespace css;
using namespace utl;
@@ -426,16 +429,19 @@ static void aBasicErrorFunc(const OUString& rError, const OUString& rAction)
static void initialize_uno(const OUString &aAppURL)
{
- rtl::Bootstrap::setIniFilename( aAppURL + "/fundamentalrc" );
-
- rtl::Bootstrap::set( "CONFIGURATION_LAYERS",
- "xcsxcu:${BRAND_BASE_DIR}/" LIBO_SHARE_FOLDER "/registry "
- "res:${BRAND_BASE_DIR}/" LIBO_SHARE_FOLDER "/registry "
-// "bundledext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:BUNDLED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini " );
-// "sharedext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:SHARED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini "
-// "userext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini "
-// "user:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/bootstraprc:UserInstallation}/user/registrymodifications.xcu"
- );
+ // without rendering we can simply use fundamentalrc, and manually add some
+ // parameters below, however we won't be able to run the soffice_main
+ // thread in that case.
+ rtl::Bootstrap::setIniFilename( aAppURL + "/sofficerc" );
+
+// rtl::Bootstrap::set( "CONFIGURATION_LAYERS",
+// "xcsxcu:${BRAND_BASE_DIR}/" LIBO_SHARE_FOLDER "/registry "
+// "res:${BRAND_BASE_DIR}/" LIBO_SHARE_FOLDER "/registry "
+// // "bundledext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:BUNDLED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini " );
+// // "sharedext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:SHARED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini "
+// // "userext:${${BRAND_BASE_DIR}/" LIBO_ETC_FOLDER "/unorc:UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini "
+// // "user:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/bootstraprc:UserInstallation}/user/registrymodifications.xcu"
+// );
xContext = cppu::defaultBootstrap_InitialComponentContext();
fprintf(stderr, "Uno initialized %d\n", xContext.is());
@@ -449,6 +455,13 @@ static void initialize_uno(const OUString &aAppURL)
// configmgr setup ?
}
+
+static void* lo_startmain(void*)
+{
+ soffice_main();
+ return 0;
+}
+
static int lo_initialize(LibreOffice* pThis, const char* pAppPath)
{
(void) pThis;
@@ -472,8 +485,27 @@ static int lo_initialize(LibreOffice* pThis, const char* pAppPath)
force_c_locale();
// Force headless
- rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
- InitVCL();
+ // the "svp" headless vcl backend isn't able to do tiled rendering for
+ // us -- we need to use a full featured backend, i.e. "gen" or "gtk",
+ // gtk seems to be somewhat better.
+ rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "gtk");
+// InitVCL();
+ // happens in soffice_main for us -- and we can't call InitVCL twice
+ // unfortunately -- which is annoying since (see below)
+
+ pthread_t thread;
+ pthread_create(&thread, 0, lo_startmain, NULL);
+ sleep(10);
+ // We'll segfault trying to access Application if we're too fast...
+ // Specifically pImplSVData doesn't exist until InitVCL has been called,
+ // and that won't be immediate, but we can't call InitVCL ourselves
+ // as soffice_main already does so, but InitVCL would then fail
+ // within soffice_main if we have already called it earlier.
+ //
+ // And there's also a chance of deadlock if we try to open documents
+ // too early -- when running in a debugger we therefore need quite
+ // a large delay here (for now).
+
Application::EnableHeadlessMode(true);
ErrorHandler::RegisterDisplay(aBasicErrorFunc);