summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-26 16:06:04 +0200
committerAndrzej Hunt <andrzej@ahunt.org>2014-08-19 14:03:55 +0200
commit7bdcaaf81ff41d661b913341e1154aaaa75dcb14 (patch)
treebacb76fb426df1143ea7c9066b858bfdf63d0a58
parentb3f4709d739743d744b8bb4c2231bb80772af2f6 (diff)
Hack soffice_main into LOK.
Change-Id: I86e13192ddb5904afabca38d3a201f17f145de09
-rw-r--r--desktop/Library_sofficeapp.mk8
-rw-r--r--desktop/source/lib/init.cxx30
2 files changed, 37 insertions, 1 deletions
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index be86dd10e663..a90bcd1f275e 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 60c53fb16bf6..1d29b581166f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -58,6 +58,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;
@@ -643,6 +646,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;
@@ -683,8 +692,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);