diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-01-13 21:04:19 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-01-14 16:13:04 +0100 |
commit | 7d990aafdc363b2a12b5db78637d7f3bef7780bd (patch) | |
tree | 3d32337824b6003769318510822110ba09351b9d /vcl/unx/generic | |
parent | 4bdf28b404f90236d93ce207671f755a71f28496 (diff) |
VCL drop m_pInstance from *nix SalData
AKA the "*nix SalData untangling" commit.
The original plan was to get rid of vcl/inc/saldatabasic.hxx and
even SalData for all the *nix backends. But after many backs and
forths, reinspecting the code and imagining the resulting code, I
decided against that plan. All these variants would have resulted
in reinterpret_cast calls, I wanted to prevent. And they would
have required larger renames for no benefit.
An other, related idea was to include all SalData implementations
in the vcl/inc/svdata.hxx header, but that seemed like an include
explosion, so was also dropped.
I tried to untangling iOS from using GenericUnixSalData, as it
doesn't use any of it's features. The new, minimal SalData should
be sufficient.
I'm leaving the easier drop of mpInstance from the Windows and
MacOSX backend as a minimal interesting EasyHack.
Change-Id: I5be01c1f42131a7e31cb30899392308e1e2de53b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128402
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/app/gendata.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldisp.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/salinst.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 3 |
7 files changed, 20 insertions, 18 deletions
diff --git a/vcl/unx/generic/app/gendata.cxx b/vcl/unx/generic/app/gendata.cxx index 479694c6dd73..444d653023a7 100644 --- a/vcl/unx/generic/app/gendata.cxx +++ b/vcl/unx/generic/app/gendata.cxx @@ -23,20 +23,25 @@ #include <unx/glyphcache.hxx> #include <printerinfomanager.hxx> -GenericUnixSalData::GenericUnixSalData(SalInstance* const pInstance) +SalData::SalData() { SetSalData(this); } + +SalData::~SalData() {} + +GenericUnixSalData::GenericUnixSalData() : m_pDisplay(nullptr) { - m_pInstance = pInstance; - SetSalData(this); } GenericUnixSalData::~GenericUnixSalData() { + // at least for InitPrintFontManager the sequence is important m_pPrintFontManager.reset(); m_pFreetypeManager.reset(); m_pPrinterInfoManager.reset(); } +void GenericUnixSalData::Dispose() {} + void GenericUnixSalData::InitFreetypeManager() { m_pFreetypeManager.reset(new FreetypeManager); } void GenericUnixSalData::InitPrintFontManager() diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 25efc5529b28..488e9937dc19 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -232,8 +232,8 @@ static const char* XRequest[] = { "X_NoOperation" }; -X11SalData::X11SalData(SalInstance *pInstance) - : GenericUnixSalData(pInstance) +X11SalData::X11SalData() + : GenericUnixSalData() { pXLib_ = nullptr; diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 33259eb2da49..490b4b771692 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1890,7 +1890,7 @@ void SalX11Display::Yield() return; XEvent aEvent; - DBG_ASSERT( GetSalData()->m_pInstance->GetYieldMutex()->IsCurrentThread(), + DBG_ASSERT(GetSalInstance()->GetYieldMutex()->IsCurrentThread(), "will crash soon since solar mutex not locked in SalDisplay::Yield" ); XNextEvent( pDisp_, &aEvent ); @@ -1934,7 +1934,7 @@ void SalX11Display::Dispatch( XEvent *pEvent ) return; } - SalInstance* pInstance = GetSalData()->m_pInstance; + SalInstance* pInstance = GetSalInstance(); pInstance->CallEventCallback( pEvent, sizeof( XEvent ) ); switch( pEvent->type ) diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 437614f35177..502f4c7f7ec2 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -59,7 +59,7 @@ extern "C" X11SalInstance* pInstance = new X11SalInstance( std::make_unique<SalYieldMutex>() ); // initialize SalData - X11SalData *pSalData = new X11SalData(pInstance); + X11SalData *pSalData = new X11SalData(); pSalData->Init(); pInstance->SetLib( pSalData->GetLib() ); diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index c403c2f3246b..9ef00512c142 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -25,6 +25,7 @@ #include <unx/freetype_glyphcache.hxx> #include <vcl/svapp.hxx> #include <sallayout.hxx> +#include <salinst.hxx> #include <cairo.h> #include <cairo-ft.h> @@ -168,8 +169,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG return; } - ImplSVData* pSVData = ImplGetSVData(); - if (const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions()) + if (const cairo_font_options_t* pFontOptions = GetSalInstance()->GetCairoFontOptions()) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); bool bDisableAA = !rStyleSettings.GetUseFontAAFromSystem() && !rGraphics.getAntiAlias(); @@ -300,8 +300,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG void FontConfigFontOptions::cairo_font_options_substitute(FcPattern* pPattern) { - ImplSVData* pSVData = ImplGetSVData(); - const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions(); + const cairo_font_options_t* pFontOptions = GetSalInstance()->GetCairoFontOptions(); if( !pFontOptions ) return; cairo_ft_font_options_substitute(pFontOptions, pPattern); diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index aa81b67e6ae7..b84ba0befc4c 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -55,7 +55,6 @@ #include <vcl/settings.hxx> #include <vcl/weld.hxx> #include <strings.hrc> -#include <saldatabasic.hxx> #include <unx/genprn.h> #include <unx/geninst.h> #include <unx/genpspgraphics.h> @@ -830,7 +829,7 @@ bool PspSalPrinter::StartJob( ImplJobSetup* pJobSetup ) { SAL_INFO( "vcl.unx.print", "PspSalPrinter::StartJob"); - GetSalData()->m_pInstance->jobStartedPrinterUpdate(); + GetSalInstance()->jobStartedPrinterUpdate(); m_bPdf = false; if (pFileName) m_aFileName = *pFileName; @@ -883,7 +882,7 @@ bool PspSalPrinter::EndJob() bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand ); } } - GetSalData()->m_pInstance->jobEndedPrinterUpdate(); + GetSalInstance()->jobEndedPrinterUpdate(); return bSuccess; } @@ -1226,7 +1225,7 @@ int PrinterUpdate::nActiveJobs = 0; void PrinterUpdate::doUpdate() { ::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() ); - SalGenericInstance *pInst = static_cast<SalGenericInstance *>( GetSalData()->m_pInstance ); + SalGenericInstance *pInst = GetGenericInstance(); if( pInst && rManager.checkPrintersChanged( false ) ) pInst->PostPrintersChanged(); } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index f38e10d252b7..00fd74693c9f 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -38,7 +38,6 @@ #include <X11/keysym.h> #include <X11/extensions/shape.h> -#include <saldatabasic.hxx> #include <unx/saldisp.hxx> #include <unx/salgdi.h> #include <unx/salframe.h> @@ -3295,7 +3294,7 @@ bool X11SalFrame::HandleFocusEvent( XFocusChangeEvent const *pEvent ) if( FocusIn == pEvent->type ) { - GetSalData()->m_pInstance->updatePrinterUpdate(); + GetSalInstance()->updatePrinterUpdate(); mbInputFocus = True; ImplSVData* pSVData = ImplGetSVData(); |