diff options
-rw-r--r-- | desktop/Library_sofficeapp.mk | 8 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 30 |
2 files changed, 37 insertions, 1 deletions
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index da37f9a84653..80479b4af6d2 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -17,6 +17,13 @@ $(eval $(call gb_Library_set_include,sofficeapp,\ -I$(SRCDIR)/vcl/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,\ @@ -47,6 +54,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 261b2f64748b..cc2972175a91 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -59,6 +59,9 @@ #include <basebmp/bitmapdevice.hxx> #endif +// We also need to hackily be able to start the main libreoffice thread +#include "../app/sofficemain.h" + using namespace css; using namespace vcl; using namespace utl; @@ -638,6 +641,12 @@ static void initialize_uno(const OUString &aAppProgramURL) // configmgr setup ? } +static void* lo_startmain(void*) +{ + soffice_main(); + return 0; +} + static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) { (void) pThis; @@ -670,8 +679,27 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) force_c_locale(); // Force headless + // 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", "svp"); - InitVCL(); +// InitVCL(); + // 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); |