[Libreoffice-commits] core.git: include/vcl Repository.mk solenv/clang-format vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_osx.mk vcl/Module_vcl.mk vcl/osx vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 2 09:24:46 UTC 2018


 Repository.mk                 |    1 
 include/vcl/ImageTree.hxx     |    2 
 include/vcl/svmain.hxx        |    2 
 include/vcl/window.hxx        |    2 
 solenv/clang-format/blacklist |    1 
 vcl/Library_vcl.mk            |  126 +++----------------------------
 vcl/Library_vclplug_osx.mk    |  158 +++++++++++++++++++++++++++++++++++++++
 vcl/Module_vcl.mk             |    1 
 vcl/inc/bmpfast.hxx           |    4 -
 vcl/inc/salinst.hxx           |    4 -
 vcl/inc/vclpluginapi.h        |    6 +
 vcl/osx/salinst.cxx           |   27 +-----
 vcl/osx/salplug.cxx           |  167 ++++++++++++++++++++++++++++++++++++++++++
 vcl/source/app/dbggui.cxx     |    1 
 vcl/source/app/svapp.cxx      |    2 
 15 files changed, 361 insertions(+), 143 deletions(-)

New commits:
commit 3af4e1a0825c5b11ae4ef58fc411378aab669387
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Thu Sep 13 12:49:53 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Oct 2 11:24:17 2018 +0200

    Implement MacOSX VCL backend as plugin
    
    Change-Id: Ie90af62eff146064c3b066a8f7ca1c3a69f44c39
    Reviewed-on: https://gerrit.libreoffice.org/61102
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/Repository.mk b/Repository.mk
index 34ac4e5c6ae0..7376e0391d6f 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -481,6 +481,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 			AppleRemote \
 		) \
 		fps_aqua \
+		vclplug_osx \
 		MacOSXSpell \
 	) \
 ))
diff --git a/include/vcl/ImageTree.hxx b/include/vcl/ImageTree.hxx
index 66a82b000ebc..6598c34c09e9 100644
--- a/include/vcl/ImageTree.hxx
+++ b/include/vcl/ImageTree.hxx
@@ -70,7 +70,7 @@ public:
     /** a crude form of life cycle control (called from DeInitVCL; otherwise,
      *  if the ImplImageTree singleton were destroyed during exit that would
      *  be too late for the destructors of the bitmaps in maIconCache)*/
-    void shutdown();
+    VCL_DLLPUBLIC void shutdown();
 };
 
 #endif
diff --git a/include/vcl/svmain.hxx b/include/vcl/svmain.hxx
index c4437b27d556..6305c090d289 100644
--- a/include/vcl/svmain.hxx
+++ b/include/vcl/svmain.hxx
@@ -25,7 +25,7 @@
 
 // #i47888# allow for alternative initialization as required for e.g. MacOSX
 bool ImplSVMainHook( int* );
-int ImplSVMain();
+VCL_DLLPUBLIC int ImplSVMain();
 
 VCL_DLLPUBLIC int SVMain();
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index fc74f2918ab5..c6e560baeb95 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -555,7 +555,7 @@ public:
     SalFrame*                           ImplGetFrame() const;
     SAL_DLLPRIVATE ImplFrameData*       ImplGetFrameData();
 
-    SAL_DLLPRIVATE vcl::Window*         ImplGetWindow();
+                   vcl::Window*         ImplGetWindow();
     SAL_DLLPRIVATE ImplWinData*         ImplGetWinData() const;
     SAL_DLLPRIVATE vcl::Window*         ImplGetClientWindow() const;
     SAL_DLLPRIVATE vcl::Window*         ImplGetDlgWindow( sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = nullptr );
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 09489f6e1d2f..116e97c043fc 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -17915,6 +17915,7 @@ vcl/osx/salinst.cxx
 vcl/osx/salmenu.cxx
 vcl/osx/salnativewidgets.cxx
 vcl/osx/salobj.cxx
+vcl/osx/salplug.cxx
 vcl/osx/salprn.cxx
 vcl/osx/salsys.cxx
 vcl/osx/saltimer.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 095e040154c9..d8fd456b3417 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -89,22 +89,6 @@ $(eval $(call gb_Library_use_libraries,vcl,\
     xmlreader \
 ))
 
-ifeq ($(OS),MACOSX)
-$(eval $(call gb_Library_add_libs,vcl,\
-    -framework IOKit \
-    -F/System/Library/PrivateFrameworks \
-    -framework CoreUI \
-    -lobjc \
-))
-endif
-ifeq ($(OS),MACOSX)
-
-$(eval $(call gb_Library_add_cxxflags,vcl,\
-    $(gb_OBJCXXFLAGS) \
-))
-
-endif
-
 ifeq ($(ENABLE_JAVA),TRUE)
 $(eval $(call gb_Library_use_libraries,vcl,\
     jvmaccess \
@@ -443,8 +427,6 @@ $(eval $(call gb_Library_add_cobjects,vcl,\
     vcl/source/filter/jpeg/transupp \
 ))
 
-# optional parts
-
 vcl_quartz_code= \
     vcl/quartz/salbmp \
     vcl/quartz/utils \
@@ -455,100 +437,6 @@ vcl_coretext_code= \
     vcl/quartz/ctfonts \
     vcl/quartz/salgdi \
 
-ifeq ($(OS),MACOSX)
-
-$(eval $(call gb_Library_add_cxxflags,vcl,\
-    $(gb_OBJCXXFLAGS) \
-))
-
-$(eval $(call gb_Library_add_defs,vcl,\
-    -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
-))
-
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-    $(vcl_coretext_code) \
-))
-
-$(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
-    ApplicationServices \
-))
-
-$(eval $(call gb_Library_add_objcxxobjects,vcl,\
-    vcl/osx/a11yactionwrapper \
-    vcl/osx/a11ycomponentwrapper \
-    vcl/osx/a11yfactory \
-    vcl/osx/a11yrolehelper \
-    vcl/osx/a11yselectionwrapper \
-    vcl/osx/a11ytablewrapper \
-    vcl/osx/a11ytextattributeswrapper \
-    vcl/osx/a11ytextwrapper \
-    vcl/osx/a11yutil \
-    vcl/osx/a11yvaluewrapper \
-    vcl/osx/a11ywrapper \
-    vcl/osx/a11ywrapperbutton \
-    vcl/osx/a11ywrappercheckbox \
-    vcl/osx/a11ywrappercombobox \
-    vcl/osx/a11ywrappergroup \
-    vcl/osx/a11ywrapperlist \
-    vcl/osx/a11ywrapperradiobutton \
-    vcl/osx/a11ywrapperradiogroup \
-    vcl/osx/a11ywrapperrow \
-    vcl/osx/a11ywrapperscrollarea \
-    vcl/osx/a11ywrapperscrollbar \
-    vcl/osx/a11ywrappersplitter \
-    vcl/osx/a11ywrapperstatictext \
-    vcl/osx/a11ywrappertabgroup \
-    vcl/osx/a11ywrappertextarea \
-    vcl/osx/a11ywrappertoolbar \
-    vcl/osx/salnstimer \
-    vcl/osx/vclnsapp \
-    vcl/osx/printaccessoryview \
-    vcl/osx/printview \
-    vcl/osx/salframeview \
-    vcl/osx/salnsmenu \
-))
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/osx/a11yfocuslistener \
-    vcl/osx/a11yfocustracker \
-    vcl/osx/a11ylistener \
-    vcl/osx/documentfocuslistener \
-    vcl/osx/saldata \
-    vcl/osx/salinst \
-    vcl/osx/salsys \
-    vcl/osx/saltimer \
-    vcl/osx/DataFlavorMapping \
-    vcl/osx/DragActionConversion \
-    vcl/osx/DragSource \
-    vcl/osx/DragSourceContext \
-    vcl/osx/DropTarget \
-    vcl/osx/HtmlFmtFlt \
-    vcl/osx/OSXTransferable \
-    vcl/osx/PictToBmpFlt \
-    vcl/osx/clipboard \
-    vcl/osx/service_entry \
-    $(vcl_quartz_code) \
-    vcl/quartz/salgdiutils \
-    vcl/osx/salnativewidgets \
-    vcl/osx/salprn \
-    vcl/osx/salframe \
-    vcl/osx/salmenu \
-    vcl/osx/salobj \
-))
-$(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
-    $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
-    Cocoa \
-    Carbon \
-    CoreFoundation \
-))
-
-ifneq ($(ENABLE_MACOSX_SANDBOX),TRUE)
-$(eval $(call gb_Library_use_libraries,vcl,\
-    AppleRemote \
-))
-endif
-
-endif
-
 vcl_headless_code= \
     vcl/headless/svpframe \
     $(if $(filter-out IOS,$(OS)), \
@@ -709,6 +597,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
 ))
 endif
 
+
 ifeq ($(OS),IOS)
 $(eval $(call gb_Library_add_cxxflags,vcl,\
     $(gb_OBJCXXFLAGS) \
@@ -727,7 +616,18 @@ $(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
 ))
 endif
 
-# OS-specific stuff
+
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
+    Cocoa \
+    CoreFoundation \
+))
+
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+    vcl/osx/salplug \
+))
+endif
+
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk
new file mode 100644
index 000000000000..7b2e52f3b3d3
--- /dev/null
+++ b/vcl/Library_vclplug_osx.mk
@@ -0,0 +1,158 @@
+# -*- 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,vclplug_osx))
+
+$(eval $(call gb_Library_set_include,vclplug_osx,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Library_use_sdk_api,vclplug_osx))
+
+$(eval $(call gb_Library_use_custom_headers,vclplug_osx,\
+    officecfg/registry \
+))
+
+$(eval $(call gb_Library_add_libs,vclplug_osx,\
+    -framework IOKit \
+    -F/System/Library/PrivateFrameworks \
+    -framework CoreUI \
+    -lobjc \
+))
+
+$(eval $(call gb_Library_add_cxxflags,vclplug_osx,\
+    $(gb_OBJCXXFLAGS) \
+))
+
+$(eval $(call gb_Library_use_libraries,vclplug_osx,\
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    i18nlangtag \
+    i18nutil \
+    sal \
+    salhelper \
+    tl \
+    vcl \
+))
+
+$(eval $(call gb_Library_use_externals,vclplug_osx,\
+    boost_headers \
+    harfbuzz \
+))
+
+ifeq ($(DISABLE_GUI),)
+$(eval $(call gb_Library_use_externals,vclplug_osx,\
+    epoxy \
+))
+endif
+
+$(eval $(call gb_Library_add_cxxflags,vclplug_osx,\
+    $(gb_OBJCXXFLAGS) \
+))
+
+$(eval $(call gb_Library_add_defs,vclplug_osx,\
+    -DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
+))
+
+$(eval $(call gb_Library_add_objcxxobjects,vclplug_osx,\
+    vcl/osx/a11yactionwrapper \
+    vcl/osx/a11ycomponentwrapper \
+    vcl/osx/a11yfactory \
+    vcl/osx/a11yrolehelper \
+    vcl/osx/a11yselectionwrapper \
+    vcl/osx/a11ytablewrapper \
+    vcl/osx/a11ytextattributeswrapper \
+    vcl/osx/a11ytextwrapper \
+    vcl/osx/a11yutil \
+    vcl/osx/a11yvaluewrapper \
+    vcl/osx/a11ywrapper \
+    vcl/osx/a11ywrapperbutton \
+    vcl/osx/a11ywrappercheckbox \
+    vcl/osx/a11ywrappercombobox \
+    vcl/osx/a11ywrappergroup \
+    vcl/osx/a11ywrapperlist \
+    vcl/osx/a11ywrapperradiobutton \
+    vcl/osx/a11ywrapperradiogroup \
+    vcl/osx/a11ywrapperrow \
+    vcl/osx/a11ywrapperscrollarea \
+    vcl/osx/a11ywrapperscrollbar \
+    vcl/osx/a11ywrappersplitter \
+    vcl/osx/a11ywrapperstatictext \
+    vcl/osx/a11ywrappertabgroup \
+    vcl/osx/a11ywrappertextarea \
+    vcl/osx/a11ywrappertoolbar \
+    vcl/osx/printaccessoryview \
+    vcl/osx/printview \
+    vcl/osx/salframeview \
+    vcl/osx/salnsmenu \
+    vcl/osx/salnstimer \
+    vcl/osx/vclnsapp \
+))
+
+$(eval $(call gb_Library_add_exception_objects,vclplug_osx,\
+    vcl/osx/DataFlavorMapping \
+    vcl/osx/DragActionConversion \
+    vcl/osx/DragSource \
+    vcl/osx/DragSourceContext \
+    vcl/osx/DropTarget \
+    vcl/osx/HtmlFmtFlt \
+    vcl/osx/OSXTransferable \
+    vcl/osx/PictToBmpFlt \
+    vcl/osx/a11yfocuslistener \
+    vcl/osx/a11yfocustracker \
+    vcl/osx/a11ylistener \
+    vcl/osx/clipboard \
+    vcl/osx/documentfocuslistener \
+    vcl/osx/saldata \
+    vcl/osx/salframe \
+    vcl/osx/salinst \
+    vcl/osx/salmenu \
+    vcl/osx/salnativewidgets \
+    vcl/osx/salobj \
+    vcl/osx/salprn \
+    vcl/osx/salsys \
+    vcl/osx/saltimer \
+    vcl/osx/service_entry \
+    vcl/quartz/ctfonts \
+    vcl/quartz/salbmp \
+    vcl/quartz/salgdi \
+    vcl/quartz/salgdicommon \
+    vcl/quartz/salgdiutils \
+    vcl/quartz/salvd \
+    vcl/quartz/utils \
+))
+
+$(eval $(call gb_Library_use_system_darwin_frameworks,vclplug_osx,\
+    ApplicationServices \
+    Cocoa \
+    Carbon \
+    CoreFoundation \
+    $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
+))
+
+ifneq ($(ENABLE_MACOSX_SANDBOX),TRUE)
+$(eval $(call gb_Library_use_libraries,vclplug_osx,\
+    AppleRemote \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 4f8d26c01c4b..df3bf6e26412 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -106,6 +106,7 @@ endif
 ifeq ($(OS),MACOSX)
 $(eval $(call gb_Module_add_targets,vcl,\
     Package_osxres \
+    Library_vclplug_osx \
 ))
 endif
 
diff --git a/vcl/inc/bmpfast.hxx b/vcl/inc/bmpfast.hxx
index 6e5e22544c5d..f9a1f891bb47 100644
--- a/vcl/inc/bmpfast.hxx
+++ b/vcl/inc/bmpfast.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_VCL_INC_BMPFAST_HXX
 #define INCLUDED_VCL_INC_BMPFAST_HXX
 
+#include <vcl/dllapi.h>
+
 class BitmapWriteAccess;
 class BitmapReadAccess;
 struct BitmapBuffer;
@@ -29,7 +31,7 @@ struct SalTwoRect;
 // the bmpfast functions have signatures with good compatibility to
 // their canonic counterparts, which employ the GetPixel/SetPixel methods
 
-bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
+VCL_DLLPUBLIC bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
         const SalTwoRect& rTwoRect );
 
 bool ImplFastBitmapBlending( BitmapWriteAccess const & rDst,
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 9f20394fe4e6..1418ef4ef859 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -216,10 +216,6 @@ void DeInitSalData();                       // called from Application-Dtor
 
 void InitSalMain();
 
-#ifdef MACOSX
-void postInitVCLinitNSApp();
-#endif
-
 #endif // INCLUDED_VCL_INC_SALINST_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h
index 88defd3972d6..fb3350e43a1f 100644
--- a/vcl/inc/vclpluginapi.h
+++ b/vcl/inc/vclpluginapi.h
@@ -47,6 +47,12 @@
 #define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
+#if defined VCLPLUG_OSX_IMPLEMENTATION
+#define VCLPLUG_OSX_PUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define VCLPLUG_OSX_PUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
 #if defined VCLPLUG_QT5_IMPLEMENTATION
 #define VCLPLUG_QT5_PUBLIC SAL_DLLPUBLIC_EXPORT
 #else
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index e81278b807fb..8fe681f37853 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -35,7 +35,7 @@
 #include <osl/process.h>
 
 #include <rtl/ustrbuf.hxx>
-
+#include <vclpluginapi.h>
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
 #include <vcl/idle.hxx>
@@ -57,6 +57,7 @@
 
 #include <print.h>
 #include <salimestatus.hxx>
+#include <o3tl/make_unique.hxx>
 
 #include <comphelper/processfactory.hxx>
 
@@ -191,24 +192,12 @@ void SalAbort( const OUString& rErrorText, bool bDumpCore )
         _exit(1);
 }
 
-void InitSalData()
-{
-}
-
 const OUString& SalGetDesktopEnvironment()
 {
     static OUString aDesktopEnvironment( "MacOSX" );
     return aDesktopEnvironment;
 }
 
-void DeInitSalData()
-{
-}
-
-void InitSalMain()
-{
-}
-
 SalYieldMutex::SalYieldMutex()
     : m_aCodeBlock( nullptr )
 {
@@ -307,7 +296,8 @@ void ImplSalYieldMutexRelease()
         pInst->GetYieldMutex()->release();
 }
 
-SalInstance* CreateSalInstance()
+extern "C" {
+VCLPLUG_OSX_PUBLIC SalInstance* create_SalInstance()
 {
     SalData* pSalData = new SalData;
 
@@ -345,10 +335,6 @@ SalInstance* CreateSalInstance()
 
     return pInst;
 }
-
-void DestroySalInstance( SalInstance* pInst )
-{
-    delete pInst;
 }
 
 AquaSalInstance::AquaSalInstance()
@@ -358,8 +344,10 @@ AquaSalInstance::AquaSalInstance()
     , mbNoYieldLock( false )
     , mbTimerProcessed( false )
 {
-    GetYieldMutex()->acquire();
     maMainThread = osl::Thread::getCurrentIdentifier();
+
+    ImplSVData* pSVData = ImplGetSVData();
+    pSVData->maAppData.mxToolkitName = OUString("osx");
 }
 
 AquaSalInstance::~AquaSalInstance()
@@ -371,7 +359,6 @@ AquaSalInstance::~AquaSalInstance()
         [pDockMenu release];
         pDockMenu = nil;
     }
-    GetYieldMutex()->release();
 }
 
 void AquaSalInstance::TriggerUserEventProcessing()
diff --git a/vcl/osx/salplug.cxx b/vcl/osx/salplug.cxx
new file mode 100644
index 000000000000..e4f69a10ee25
--- /dev/null
+++ b/vcl/osx/salplug.cxx
@@ -0,0 +1,167 @@
+/* -*- 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 <osl/module.hxx>
+#include <osl/process.h>
+
+#include <rtl/bootstrap.hxx>
+#include <rtl/process.h>
+#include <sal/log.hxx>
+
+#include <salinst.hxx>
+#include <saldatabasic.hxx>
+#include <config_vclplug.h>
+#include <desktop/crashreport.hxx>
+
+#include <cstdio>
+
+extern "C" {
+typedef SalInstance*(*salFactoryProc)();
+}
+
+static oslModule pCloseModule = nullptr;
+
+static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false )
+{
+    SalInstance* pInst = nullptr;
+    OUString aModule(
+#ifdef SAL_DLLPREFIX
+            SAL_DLLPREFIX
+#endif
+            "vclplug_" + rModuleBase + "lo" SAL_DLLEXTENSION );
+
+    osl::Module aMod;
+    if (aMod.loadRelative(reinterpret_cast<oslGenericFunction>(&tryInstance), aModule, SAL_LOADMODULE_GLOBAL))
+    {
+        salFactoryProc aProc = reinterpret_cast<salFactoryProc>(aMod.getFunctionSymbol("create_SalInstance"));
+        if (aProc)
+        {
+            pInst = aProc();
+            SAL_INFO(
+                "vcl.plugadapt",
+                "sal plugin " << aModule << " produced instance " << pInst);
+            if (pInst)
+            {
+                pCloseModule = static_cast<oslModule>(aMod);
+                aMod.release();
+            }
+        }
+        else
+        {
+            SAL_WARN(
+                "vcl.plugadapt",
+                "could not load symbol create_SalInstance from shared object "
+                    << aModule);
+        }
+    }
+    else if (bForce)
+    {
+        SAL_WARN("vcl.plugadapt", "could not load shared object " << aModule);
+    }
+    else
+    {
+        SAL_INFO("vcl.plugadapt", "could not load shared object " << aModule);
+    }
+
+    // coverity[leaked_storage] - this is on purpose
+    return pInst;
+}
+
+SalInstance *CreateSalInstance()
+{
+    SalInstance *pInst = nullptr;
+
+    OUString aUsePlugin;
+    rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin );
+
+    if( !aUsePlugin.isEmpty() )
+        pInst = tryInstance( aUsePlugin, true );
+
+    // fallback, try everything
+    static const char* const pPlugin[] = { "osx" };
+
+    for ( int i = 0; !pInst && i != SAL_N_ELEMENTS(pPlugin); ++i )
+        pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) );
+
+    if( ! pInst )
+    {
+        std::fprintf( stderr, "no suitable windowing system found, exiting.\n" );
+        _exit( 1 );
+    }
+
+    // acquire SolarMutex
+    pInst->AcquireYieldMutex();
+
+    return pInst;
+}
+
+void DestroySalInstance( SalInstance *pInst )
+{
+    // release SolarMutex
+    pInst->ReleaseYieldMutexAll();
+
+    delete pInst;
+    if( pCloseModule )
+        osl_unloadModule( pCloseModule );
+}
+
+void InitSalData()
+{
+}
+
+void DeInitSalData()
+{
+}
+
+void InitSalMain()
+{
+}
+
+void SalAbort( const OUString& rErrorText, bool bDumpCore )
+{
+    if( rErrorText.isEmpty() )
+        std::fprintf( stderr, "Application Error\n" );
+    else
+    {
+        CrashReporter::AddKeyValue("AbortMessage", rErrorText);
+        std::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+    }
+    if( bDumpCore )
+        abort();
+    else
+        _exit(1);
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+    static OUString aDesktopEnvironment( "Windows" );
+    return aDesktopEnvironment;
+}
+
+SalData::SalData() :
+    m_pInstance(nullptr),
+    m_pPIManager(nullptr)
+{
+}
+
+SalData::~SalData() COVERITY_NOEXCEPT_FALSE
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index b27eed124f6c..bd87814b31c6 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -35,7 +35,6 @@
 #include <dbggui.hxx>
 
 #include <salinst.hxx>
-#include <svsys.h>
 
 #include <algorithm>
 #include <memory>
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index bd5127f444c5..c1aeac0639c0 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1138,7 +1138,7 @@ OUString Application::GetHWOSConfInfo()
         aDetails.append( VclResId(SV_APP_DEFAULT) );
     aDetails.append( "; " );
 
-#if (defined LINUX || defined _WIN32)
+#if (defined LINUX || defined _WIN32 || defined MACOSX)
     aDetails.append( SV_APP_VCLBACKEND );
     aDetails.append( GetToolkitName() );
     aDetails.append( "; " );


More information about the Libreoffice-commits mailing list