From 1698debed2993fc5f262aa3ebbdb32fc112ac556 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Wed, 12 Sep 2018 10:26:52 +0200 Subject: Implement Windows VCL backend as plugin Change-Id: If9c7c67f48311ac68ecc9f8e3a07f9bb7c73d962 Reviewed-on: https://gerrit.libreoffice.org/61101 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- vcl/Library_vcl.mk | 37 +------ vcl/Library_vclplug_win.mk | 98 +++++++++++++++++ vcl/Module_vcl.mk | 1 + vcl/inc/fontselect.hxx | 2 +- vcl/inc/fontsubset.hxx | 2 +- vcl/inc/helpwin.hxx | 2 +- vcl/inc/opengl/FixedTextureAtlas.hxx | 6 +- vcl/inc/opengl/PackedTextureAtlas.hxx | 6 +- vcl/inc/salinst.hxx | 2 +- vcl/inc/salprn.hxx | 3 + vcl/inc/salsys.hxx | 2 +- vcl/inc/sft.hxx | 10 +- vcl/inc/svdata.hxx | 2 +- vcl/inc/vclpluginapi.h | 6 + vcl/source/app/svapp.cxx | 3 +- vcl/win/app/salinst.cxx | 76 +++---------- vcl/win/app/salplug.cxx | 199 ++++++++++++++++++++++++++++++++++ vcl/win/window/salframe.cxx | 10 -- 18 files changed, 349 insertions(+), 118 deletions(-) create mode 100644 vcl/Library_vclplug_win.mk create mode 100644 vcl/win/app/salplug.cxx (limited to 'vcl') diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index f9df0a3a5f36..095e040154c9 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -731,52 +731,19 @@ endif ifeq ($(OS),WNT) $(eval $(call gb_Library_add_exception_objects,vcl,\ - vcl/opengl/win/gdiimpl \ vcl/opengl/win/WinDeviceInfo \ vcl/opengl/win/blocklist_parser \ - vcl/win/app/saldata \ - vcl/win/app/salinfo \ - vcl/win/app/salinst \ - vcl/win/app/salshl \ - vcl/win/app/saltimer \ - vcl/win/gdi/gdiimpl \ - vcl/win/gdi/salbmp \ - vcl/win/gdi/salgdi \ - vcl/win/gdi/salgdi2 \ - vcl/win/gdi/salfont \ - vcl/win/gdi/salgdi_gdiplus \ - vcl/win/gdi/salnativewidgets-luna \ - vcl/win/gdi/salprn \ - vcl/win/gdi/salvd \ - vcl/win/gdi/winlayout \ - vcl/win/gdi/DWriteTextRenderer \ - vcl/win/window/salframe \ - vcl/win/window/keynames \ - vcl/win/window/salmenu \ - vcl/win/window/salobj \ + vcl/win/app/salplug \ )) $(eval $(call gb_Library_use_system_win32_libs,vcl,\ - advapi32 \ - crypt32 \ - gdi32 \ - gdiplus \ - imm32 \ - mpr \ ole32 \ - shell32 \ - usp10 \ - uuid \ - version \ - winspool \ setupapi \ - shlwapi \ + version \ )) $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc)) -endif -ifeq ($(OS),WNT) # HACK: dependency on icon themes so running unit tests don't # prevent delivering these by having open file handles on WNT $(eval $(call gb_Library_use_package,vcl,postprocess_images)) diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk new file mode 100644 index 000000000000..97a83d436cc1 --- /dev/null +++ b/vcl/Library_vclplug_win.mk @@ -0,0 +1,98 @@ +# -*- 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_win)) + +$(eval $(call gb_Library_set_include,vclplug_win,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ + -I$(SRCDIR)/vcl/inc/win \ +)) + +$(eval $(call gb_Library_add_defs,vclplug_win,\ + -DVCLPLUG_WIN_IMPLEMENTATION \ +)) + +$(eval $(call gb_Library_use_custom_headers,vclplug_win,\ + officecfg/registry \ +)) + +$(eval $(call gb_Library_use_sdk_api,vclplug_win)) + +$(eval $(call gb_Library_use_libraries,vclplug_win,\ + basegfx \ + comphelper \ + cppu \ + i18nlangtag \ + i18nutil \ + sal \ + salhelper \ + tl \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_use_externals,vclplug_win,\ + boost_headers \ + epoxy \ + glm_headers \ + harfbuzz \ +)) + +$(eval $(call gb_Library_add_exception_objects,vclplug_win,\ + vcl/opengl/win/gdiimpl \ + vcl/win/app/saldata \ + vcl/win/app/salinfo \ + vcl/win/app/salinst \ + vcl/win/app/salshl \ + vcl/win/app/saltimer \ + vcl/win/gdi/gdiimpl \ + vcl/win/gdi/salbmp \ + vcl/win/gdi/salgdi \ + vcl/win/gdi/salgdi2 \ + vcl/win/gdi/salfont \ + vcl/win/gdi/salgdi_gdiplus \ + vcl/win/gdi/salnativewidgets-luna \ + vcl/win/gdi/salprn \ + vcl/win/gdi/salvd \ + vcl/win/gdi/winlayout \ + vcl/win/gdi/DWriteTextRenderer \ + vcl/win/window/salframe \ + vcl/win/window/keynames \ + vcl/win/window/salmenu \ + vcl/win/window/salobj \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,vclplug_win,\ + gdi32 \ + gdiplus \ + imm32 \ + ole32 \ + shell32 \ + version \ + winspool \ +)) + +$(eval $(call gb_Library_add_nativeres,vclplug_win,vcl/salsrc)) + +# HACK: dependency on icon themes so running unit tests don't +# prevent delivering these by having open file handles on WNT +$(eval $(call gb_Library_use_package,vclplug_win,postprocess_images)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index b8731614797a..4f8d26c01c4b 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -112,6 +112,7 @@ endif ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,vcl,\ WinResTarget_vcl \ + Library_vclplug_win \ )) endif diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx index 9707ba4e5fa9..51f70997ac53 100644 --- a/vcl/inc/fontselect.hxx +++ b/vcl/inc/fontselect.hxx @@ -34,7 +34,7 @@ class LogicalFontInstance; class PhysicalFontFace; class Size; -class FontSelectPattern : public FontAttributes +class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes { public: FontSelectPattern( const vcl::Font&, const OUString& rSearchName, diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 66368b7cbcb9..76551c29d89d 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -44,7 +44,7 @@ namespace o3tl { template<> struct typed_flags : is_typed_flags {}; } -class FontSubsetInfo final +class VCL_DLLPUBLIC FontSubsetInfo final { public: explicit FontSubsetInfo(); diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index 09fed59b7138..765dac0508e5 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -74,7 +74,7 @@ public: void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const OUString& rHelpText, const OUString& rStatusText, const Point& rScreenPos, const tools::Rectangle& rHelpArea ); -void ImplDestroyHelpWindow( bool bUpdateHideTime ); +VCL_DLLPUBLIC void ImplDestroyHelpWindow( bool bUpdateHideTime ); void ImplSetHelpWindowPos( vcl::Window* pHelpWindow, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const Point& rPos, const tools::Rectangle& rHelpArea ); diff --git a/vcl/inc/opengl/FixedTextureAtlas.hxx b/vcl/inc/opengl/FixedTextureAtlas.hxx index c273a5e36c0c..145ddf52f5e1 100644 --- a/vcl/inc/opengl/FixedTextureAtlas.hxx +++ b/vcl/inc/opengl/FixedTextureAtlas.hxx @@ -16,7 +16,7 @@ struct FixedTexture; -class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager +class FixedTextureAtlasManager final { std::vector> maFixedTextures; @@ -26,9 +26,13 @@ class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager void CreateNewTexture(); + FixedTextureAtlasManager( const FixedTextureAtlasManager& ) = delete; + FixedTextureAtlasManager& operator=( const FixedTextureAtlasManager& ) = delete; + public: FixedTextureAtlasManager(int nWidthFactor, int nHeightFactor, int nTextureSize); ~FixedTextureAtlasManager(); + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); OpenGLTexture Reserve(int nWidth, int nHeight); diff --git a/vcl/inc/opengl/PackedTextureAtlas.hxx b/vcl/inc/opengl/PackedTextureAtlas.hxx index 8e6def84c9e4..c7f39d86b4d9 100644 --- a/vcl/inc/opengl/PackedTextureAtlas.hxx +++ b/vcl/inc/opengl/PackedTextureAtlas.hxx @@ -26,7 +26,7 @@ struct PackedTexture; * [2]: https://github.com/lukaszdk/texture-atlas-generator * */ -class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager +class VCL_DLLPUBLIC PackedTextureAtlasManager final { std::vector> maPackedTextures; @@ -35,6 +35,9 @@ class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager void CreateNewTexture(); + PackedTextureAtlasManager( const PackedTextureAtlasManager& ) = delete; + PackedTextureAtlasManager& operator=( const PackedTextureAtlasManager& ) = delete; + public: /** @@ -43,6 +46,7 @@ public: */ PackedTextureAtlasManager(int nTextureWidth, int nTextureHeight); ~PackedTextureAtlasManager(); + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); OpenGLTexture Reserve(int nWidth, int nHeight); std::vector ReduceTextureNumber(int nMaxNumberOfTextures); diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 3ee6aca23567..9f20394fe4e6 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -209,7 +209,7 @@ void DestroySalInstance( SalInstance* pInst ); void SalAbort( const OUString& rErrorText, bool bDumpCore ); -VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment(); +VCL_DLLPUBLIC const OUString& SalGetDesktopEnvironment(); void InitSalData(); // called from Application-Ctor void DeInitSalData(); // called from Application-Dtor diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index 014f61179b47..d9669793655d 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -86,6 +86,9 @@ public: class VCL_PLUGIN_PUBLIC SalPrinter { + SalPrinter( const SalPrinter& ) = delete; + SalPrinter& operator=( const SalPrinter& ) = delete; + public: SalPrinter() {} virtual ~SalPrinter(); diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index 5e3478e45b2b..fc80e90d0ca9 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -83,7 +83,7 @@ public: }; -SalSystem* ImplGetSalSystem(); +VCL_DLLPUBLIC SalSystem* ImplGetSalSystem(); #endif // INCLUDED_VCL_INC_SALSYS_HXX diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 00cf119a4ca4..95fbcadb0d8d 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -344,7 +344,7 @@ namespace vcl * @ingroup sft * */ - SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, + VCL_DLLPUBLIC SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, @@ -387,7 +387,7 @@ namespace vcl * @ingroup sft * */ - std::unique_ptr GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); + VCL_DLLPUBLIC std::unique_ptr GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); #if defined(_WIN32) || defined(MACOSX) || defined(IOS) /** @@ -399,7 +399,7 @@ namespace vcl * @return glyph ID, if the character is missing in the font, the return value is 0. * @ingroup sft */ - sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch); + VCL_DLLPUBLIC sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch); #endif /** @@ -411,7 +411,7 @@ namespace vcl * @ingroup sft * */ - void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); + VCL_DLLPUBLIC void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); /** * Returns fonts metrics. @@ -430,7 +430,7 @@ namespace vcl /** * returns the number of glyphs in a font */ - int GetTTGlyphCount( TrueTypeFont const * ttf ); + VCL_DLLPUBLIC int GetTTGlyphCount( TrueTypeFont const * ttf ); /** * provide access to the raw data of a SFNT-container's subtable diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 6df874abc74b..b36ecf7e6a41 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -387,7 +387,7 @@ VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId); DockingManager* ImplGetDockingManager(); BlendFrameCache* ImplGetBlendFrameCache(); -bool ImplCallPreNotify( NotifyEvent& rEvt ); +VCL_DLLPUBLIC bool ImplCallPreNotify( NotifyEvent& rEvt ); VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData(); VCL_PLUGIN_PUBLIC void ImplHideSplash(); diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h index e8677d239937..88defd3972d6 100644 --- a/vcl/inc/vclpluginapi.h +++ b/vcl/inc/vclpluginapi.h @@ -59,6 +59,12 @@ #define VCLPLUG_SVP_PUBLIC SAL_DLLPUBLIC_IMPORT #endif +#if defined VCLPLUG_WIN_IMPLEMENTATION +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + #if defined DESKTOP_DETECTOR_IMPLEMENTATION #define DESKTOP_DETECTOR_PUBLIC SAL_DLLPUBLIC_EXPORT #else diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index ca3848d58a22..bd5127f444c5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1138,8 +1138,7 @@ OUString Application::GetHWOSConfInfo() aDetails.append( VclResId(SV_APP_DEFAULT) ); aDetails.append( "; " ); -#ifdef LINUX - // Only linux has different backends, so don't show blank for others. +#if (defined LINUX || defined _WIN32) aDetails.append( SV_APP_VCLBACKEND ); aDetails.append( GetToolkitName() ); aDetails.append( "; " ); diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 1c67113322dc..d5fca66f6bd2 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -299,55 +300,33 @@ SalData::SalData() SetSalData( this ); initNWF(); + + CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA) + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); } SalData::~SalData() { deInitNWF(); SetSalData( nullptr ); -} - -void InitSalData() -{ - SalData* pSalData = new SalData; - CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA) - - // init GDIPlus - static Gdiplus::GdiplusStartupInput gdiplusStartupInput; - Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, nullptr); -} -void DeInitSalData() -{ CoUninitialize(); - SalData* pSalData = GetSalData(); - // deinit GDIPlus - if(pSalData) - { - Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); - } - - delete pSalData; + if (gdiplusToken) + Gdiplus::GdiplusShutdown(gdiplusToken); } -void InitSalMain() +extern "C" { +VCLPLUG_WIN_PUBLIC SalInstance* create_SalInstance() { - // remember data, copied from WinMain - SalData* pData = GetSalData(); - if ( pData ) // Im AppServer NULL - { - STARTUPINFOW aSI; - aSI.cb = sizeof( aSI ); - GetStartupInfoW( &aSI ); - pData->mhInst = GetModuleHandleW( nullptr ); - pData->mnCmdShow = aSI.wShowWindow; - } -} + SalData* pSalData = new SalData(); -SalInstance* CreateSalInstance() -{ - SalData* pSalData = GetSalData(); + STARTUPINFOW aSI; + aSI.cb = sizeof( aSI ); + GetStartupInfoW( &aSI ); + pSalData->mhInst = GetModuleHandleW( nullptr ); + pSalData->mnCmdShow = aSI.wShowWindow; pSalData->mnAppThreadId = GetCurrentThreadId(); @@ -405,20 +384,6 @@ SalInstance* CreateSalInstance() return pInst; } - -void DestroySalInstance( SalInstance* pInst ) -{ - SalData* pSalData = GetSalData(); - - // (only one instance in this version !!!) - - ImplFreeSalGDI(); - - // reset instance - if ( pSalData->mpInstance == pInst ) - pSalData->mpInstance = nullptr; - - delete pInst; } WinSalInstance::WinSalInstance() @@ -426,12 +391,13 @@ WinSalInstance::WinSalInstance() , mhComWnd( nullptr ) , m_nNoYieldLock( 0 ) { - GetYieldMutex()->acquire(); + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mxToolkitName = OUString("win"); } WinSalInstance::~WinSalInstance() { - GetYieldMutex()->release(); + ImplFreeSalGDI(); DestroyWindow( mhComWnd ); } @@ -1000,12 +966,6 @@ std::shared_ptr WinSalInstance::CreateSalBitmap() return std::make_shared(); } -const OUString& SalGetDesktopEnvironment() -{ - static OUString aDesktopEnvironment( "Windows" ); - return aDesktopEnvironment; -} - int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POINTERS pExceptionInfo) { // Decide if an exception is a c++ (mostly UNO) exception or a process violation. diff --git a/vcl/win/app/salplug.cxx b/vcl/win/app/salplug.cxx new file mode 100644 index 000000000000..1ef61976a23d --- /dev/null +++ b/vcl/win/app/salplug.cxx @@ -0,0 +1,199 @@ +/* -*- 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 +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +extern "C" { +typedef SalInstance*(*salFactoryProc)(); +} + +namespace { + +// HACK to obtain Application::IsHeadlessModeEnabled early on, before +// Application::EnableHeadlessMode has potentially been called: +bool IsHeadlessModeRequested() +{ + if (Application::IsHeadlessModeEnabled()) { + return true; + } + sal_uInt32 n = rtl_getAppCommandArgCount(); + for (sal_uInt32 i = 0; i < n; ++i) { + OUString arg; + rtl_getAppCommandArg(i, &arg.pData); + if ( arg == "--headless" || arg == "-headless" ) { + return true; + } + } + return false; +} + +} + +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(&tryInstance), aModule, SAL_LOADMODULE_GLOBAL)) + { + salFactoryProc aProc = reinterpret_cast(aMod.getFunctionSymbol("create_SalInstance")); + if (aProc) + { + pInst = aProc(); + SAL_INFO( + "vcl.plugadapt", + "sal plugin " << aModule << " produced instance " << pInst); + if (pInst) + { + pCloseModule = static_cast(aMod); + aMod.release(); + pCloseModule = nullptr; + } + } + 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[] = { "win" }; + + 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 +{ +} + +bool HasAtHook() +{ + BOOL bIsRunning = FALSE; + // pvParam must be BOOL + return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0) + && bIsRunning; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 35da3a0b5f04..d96aa4776fa1 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5860,14 +5860,4 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR return bResult; } -#ifdef _WIN32 -bool HasAtHook() -{ - BOOL bIsRunning = FALSE; - // pvParam must be BOOL - return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0) - && bIsRunning; -} -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit