diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-12 10:26:52 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-02 11:24:00 +0200 |
commit | 1698debed2993fc5f262aa3ebbdb32fc112ac556 (patch) | |
tree | 0848ab3850845d3d6a088ace1b9561c99fcd6fef /vcl/win/app/salinst.cxx | |
parent | 3d9809bb6a20c34ef9f5ef0f4a6bc4eab7d8551f (diff) |
Implement Windows VCL backend as plugin
Change-Id: If9c7c67f48311ac68ecc9f8e3a07f9bb7c73d962
Reviewed-on: https://gerrit.libreoffice.org/61101
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/win/app/salinst.cxx')
-rw-r--r-- | vcl/win/app/salinst.cxx | 76 |
1 files changed, 18 insertions, 58 deletions
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 <vcl/opengl/OpenGLHelper.hxx> #include <vcl/opengl/OpenGLContext.hxx> #include <vcl/timer.hxx> +#include <vclpluginapi.h> #include <opengl/salbmp.hxx> #include <opengl/win/gdiimpl.hxx> @@ -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<SalBitmap> WinSalInstance::CreateSalBitmap() return std::make_shared<WinSalBitmap>(); } -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. |