vcl/inc/unx/gendata.hxx | 6 ----- vcl/inc/unx/gtk/gtkdata.hxx | 5 ++-- vcl/inc/unx/saldata.hxx | 5 ++-- vcl/inc/unx/saldisp.hxx | 7 +++-- vcl/skia/x11/gdiimpl.cxx | 2 - vcl/skia/x11/salvd.cxx | 4 +-- vcl/unx/generic/app/i18n_ic.cxx | 12 +++++----- vcl/unx/generic/app/saldata.cxx | 2 - vcl/unx/generic/app/saldisp.cxx | 14 +++++------ vcl/unx/generic/app/salinst.cxx | 5 +--- vcl/unx/generic/app/sm.cxx | 8 +++--- vcl/unx/generic/app/wmadaptor.cxx | 21 +++++++++-------- vcl/unx/generic/dtrans/X11_selection.cxx | 8 +++--- vcl/unx/generic/gdi/salgdi.cxx | 4 +-- vcl/unx/generic/gdi/salvd.cxx | 4 +-- vcl/unx/generic/window/salframe.cxx | 37 +++++++++++++++---------------- vcl/unx/generic/window/salobj.cxx | 25 ++++++++++---------- vcl/unx/gtk3/gtkdata.cxx | 2 - vcl/unx/gtk3/gtkframe.cxx | 22 +++++++++--------- vcl/unx/x11/x11sys.cxx | 6 ++--- 20 files changed, 98 insertions(+), 101 deletions(-)
New commits: commit ebc831fa75d8c3440187313f418736f2e1ac60c1 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 25 10:34:35 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 25 14:44:12 2026 +0100 vcl: Drop GenericUnixSalData::ErrorTrap{Push,Pop} from base class The base class implementations do nothing and it's only overriden by the GtkSalData and X11SalData subclasses. Those methods are also only used within the gen/x11 and gtk VCL plugin code, where it is known that X11SalData and GtkSalData are the specific subclasses in use. Therefore, drop the virtual base class method doing nothing and use the more specific subclasses directly. Change-Id: Ic45c22eb4d661a45aec42e88b3210cd6546cc7ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200302 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx index 3e3765af1b5e..4b5709f6c0af 100644 --- a/vcl/inc/unx/gendata.hxx +++ b/vcl/inc/unx/gendata.hxx @@ -103,12 +103,6 @@ public: } #endif - - // Mostly useful for remote protocol backends - virtual void ErrorTrapPush(){}; - - // true on error - virtual bool ErrorTrapPop(bool /* bIgnoreError */ = true) { return false; }; }; inline GenericUnixSalData* GetGenericUnixSalData() diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 6e1ec245edca..a95e22d0e97d 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -241,8 +241,9 @@ public: bool Yield( bool bWait, bool bHandleAllCurrentEvents ); inline GdkDisplay *GetGdkDisplay(); - virtual void ErrorTrapPush() override; - virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; + void ErrorTrapPush(); + // true on error + bool ErrorTrapPop(bool bIgnoreError = true); inline GtkSalDisplay *GetGtkDisplay() const; void setException(const std::exception_ptr& exception) { m_aException = exception; } diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 66fa8c61bd61..7c84bac4375c 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -52,8 +52,9 @@ public: static void Timeout(); // X errors - virtual void ErrorTrapPush() override; - virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; + void ErrorTrapPush(); + // true on error + bool ErrorTrapPop(bool bIgnoreError = true); void XError( Display *pDisp, XErrorEvent *pEvent ); bool HasXErrorOccurred() const { return m_aXErrorHandlerStack.back().m_bWas; } diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index a9d0d044af97..849ffdf70e4a 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -536,14 +536,14 @@ void SalX11Display::Init() void SalX11Display::SetupInput() { - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp_ ); XSync( pDisp_, False ); - bool bError = GetGenericUnixSalData()->ErrorTrapPop( false ); - GetGenericUnixSalData()->ErrorTrapPush(); + bool bError = GetX11SalData()->ErrorTrapPop(false); + GetX11SalData()->ErrorTrapPush(); pKbdExtension->UseExtension( ! bError ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); SetKbdExtension( pKbdExtension ); } diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 2500b82ca9fb..13f39b11c0c3 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -34,6 +34,7 @@ #include <officecfg/VCL.hxx> #include <unx/wmadaptor.hxx> +#include <unx/saldata.hxx> #include <unx/saldisp.hxx> #include <unx/salframe.h> @@ -552,7 +553,7 @@ GnomeWMAdaptor::GnomeWMAdaptor(SalX11Display* pSalDisplay) : ::Window aWMChild = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = nullptr; - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); if( XGetWindowProperty( m_pDisplay, aWMChild, m_aWMAtoms[ WIN_SUPPORTING_WM_CHECK ], @@ -568,9 +569,9 @@ GnomeWMAdaptor::GnomeWMAdaptor(SalX11Display* pSalDisplay) : && nFormat == 32 && nItems != 0 ) { - if (! GetGenericUnixSalData()->ErrorTrapPop( false ) ) + if (!GetX11SalData()->ErrorTrapPop(false)) { - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); ::Window aCheckWindow = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); @@ -588,9 +589,9 @@ GnomeWMAdaptor::GnomeWMAdaptor(SalX11Display* pSalDisplay) : } } else - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); } - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); } else if( pProperty ) { @@ -751,7 +752,7 @@ bool WMAdaptor::getNetWmName() ::Window aWMChild = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = nullptr; - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); if( XGetWindowProperty( m_pDisplay, aWMChild, m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ], @@ -767,9 +768,9 @@ bool WMAdaptor::getNetWmName() && nFormat == 32 && nItems != 0 ) { - if ( ! GetGenericUnixSalData()->ErrorTrapPop( false ) ) + if (!GetX11SalData()->ErrorTrapPop(false)) { - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); ::Window aCheckWindow = *reinterpret_cast< ::Window* >(pProperty); XFree( pProperty ); pProperty = nullptr; @@ -850,11 +851,11 @@ bool WMAdaptor::getNetWmName() XFree( pProperty ); pProperty = nullptr; } - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); } } - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); } else if( pProperty ) { diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index fcce5dda781f..dfb9baceed14 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -40,6 +40,7 @@ #include <headless/BitmapHelper.hxx> #include <headless/svpbmp.hxx> +#include <unx/saldata.hxx> #include <unx/saldisp.hxx> #include <unx/salgdi.h> #include <unx/salframe.h> @@ -97,7 +98,7 @@ static int nVisibleFloats = 0; static void doReparentPresentationDialogues(SalX11Display const * pDisplay ) { - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); for (auto const& elem : aPresentationReparentList) { int x, y; @@ -122,7 +123,7 @@ static void doReparentPresentationDialogues(SalX11Display const * pDisplay ) if( hPresFocusWindow ) XSetInputFocus( pDisplay->GetDisplay(), hPresFocusWindow, PointerRoot, CurrentTime ); XSync( pDisplay->GetDisplay(), False ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); } bool X11SalFrame::IsOverrideRedirect() const @@ -181,12 +182,12 @@ void X11SalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode ) aEvent.xclient.data.l[3] = 0; aEvent.xclient.data.l[4] = 0; - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); XSendEvent( pDisplay_->GetDisplay(), mhForeignParent, False, NoEventMask, &aEvent ); XSync( pDisplay_->GetDisplay(), False ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); } typedef std::vector< unsigned long > NetWmIconData; @@ -352,7 +353,7 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen { // plugin parent may be killed unexpectedly by plugging // process; start permanently ignoring X errors... - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); nStyle_ |= SalFrameStyleFlags::PLUG; Attributes.override_redirect = True; @@ -3324,7 +3325,7 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) static const char* pDisableStackingCheck = getenv( "SAL_DISABLE_STACKING_CHECK" ); - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); /* * don't rely on the new parent from the event. @@ -3344,8 +3345,8 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) &Children, &nChildren ); - bool bError = GetGenericUnixSalData()->ErrorTrapPop( false ); - GetGenericUnixSalData()->ErrorTrapPush(); + bool bError = GetX11SalData()->ErrorTrapPop(false); + GetX11SalData()->ErrorTrapPush(); if( bError ) { @@ -3381,7 +3382,7 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) // Reparenting before Destroy aPresentationReparentList.remove( GetStackingWindow() ); mhStackingWindow = None; - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); return false; } @@ -3434,8 +3435,8 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) */ // reset error occurred - GetGenericUnixSalData()->ErrorTrapPop(); - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPush(); int xp, yp, x, y; unsigned int wp, w, hp, h, bw, d; @@ -3448,8 +3449,8 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) &hRoot, &xp, &yp, &wp, &hp, &bw, &d ); bool bResized = false; - bool bError = GetGenericUnixSalData()->ErrorTrapPop( false ); - GetGenericUnixSalData()->ErrorTrapPush(); + bool bError = GetX11SalData()->ErrorTrapPop( false ); + GetX11SalData()->ErrorTrapPush(); if( ! bError ) { @@ -3492,7 +3493,7 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) if( bResized ) CallCallback( SalEvent::Resize, nullptr ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); return true; } diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 958f303605d9..dc03316e8524 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -30,6 +30,7 @@ #include <vcl/event.hxx> #include <sal/log.hxx> +#include <unx/saldata.hxx> #include <unx/salinst.h> #include <unx/saldisp.hxx> #include <unx/salobj.h> @@ -123,7 +124,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p << static_cast<unsigned int> (aVisID)); #endif - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); // create colormap for visual - there might not be one pObject->maColormap = aAttribs.colormap = XCreateColormap( @@ -141,7 +142,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pVisual, CWEventMask|CWColormap, &aAttribs ); XSync( pDisp, False ); - if( GetGenericUnixSalData()->ErrorTrapPop( false ) ) + if (GetX11SalData()->ErrorTrapPop(false)) { pObject->maSecondary = None; delete pObject; @@ -150,7 +151,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p XReparentWindow( pDisp, pObject->maSecondary, pObject->maPrimary, 0, 0 ); } - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); if( bShow ) { XMapWindow( pDisp, pObject->maSecondary ); XMapWindow( pDisp, pObject->maPrimary ); @@ -162,7 +163,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p rObjData.pVisual = pVisual; XSync(pDisp, False); - if( GetGenericUnixSalData()->ErrorTrapPop( false ) ) + if (GetX11SalData()->ErrorTrapPop(false)) { delete pObject; return nullptr; @@ -240,7 +241,7 @@ X11SalObject::~X11SalObject() std::list<SalObject*>& rObjects = vcl_sal::getSalDisplay()->getSalObjects(); rObjects.remove( this ); - GetGenericUnixSalData()->ErrorTrapPush(); + GetX11SalData()->ErrorTrapPush(); ::Window aObjectParent = maParentWin; XSetWindowBackgroundPixmap(static_cast<Display*>(maSystemChildData.pDisplay), aObjectParent, None); if ( maSecondary ) @@ -250,7 +251,7 @@ X11SalObject::~X11SalObject() if ( maColormap ) XFreeColormap(static_cast<Display*>(maSystemChildData.pDisplay), maColormap); XSync( static_cast<Display*>(maSystemChildData.pDisplay), False ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetX11SalData()->ErrorTrapPop(); } void diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx index 1ab838cbda3a..de664cc27924 100644 --- a/vcl/unx/gtk3/gtkdata.cxx +++ b/vcl/unx/gtk3/gtkdata.cxx @@ -56,7 +56,7 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) : rpCsr = nullptr; if ( getenv( "SAL_IGNOREXERRORS" ) ) - GetGenericUnixSalData()->ErrorTrapPush(); // and leak the trap + GetGtkSalData()->ErrorTrapPush(); // and leak the trap gtk_widget_set_default_direction(AllSettings::GetLayoutRTL() ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); } diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 717b422c4856..82d7b3819adf 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -531,7 +531,7 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData ) { getDisplay()->registerFrame( this ); // permanently ignore errors from our unruly children ... - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); m_bDefaultPos = true; m_bDefaultSize = true; Init( pSysData ); @@ -5541,13 +5541,13 @@ void GtkSalFrame::IMHandler::createIMContext() g_signal_connect( m_pIMContext, "preedit_end", G_CALLBACK (signalIMPreeditEnd), this ); - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); im_context_set_client_widget(m_pIMContext, m_pFrame->getMouseEventWidget()); #if GTK_CHECK_VERSION(4, 0, 0) gtk_event_controller_key_set_im_context(m_pFrame->m_pKeyController, m_pIMContext); #endif gtk_im_context_focus_in( m_pIMContext ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetGtkSalData()->ErrorTrapPop(); m_bFocused = true; } @@ -5558,12 +5558,12 @@ void GtkSalFrame::IMHandler::deleteIMContext() return; // first give IC a chance to deinitialize - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); #if GTK_CHECK_VERSION(4, 0, 0) gtk_event_controller_key_set_im_context(m_pFrame->m_pKeyController, nullptr); #endif im_context_set_client_widget(m_pIMContext, nullptr); - GetGenericUnixSalData()->ErrorTrapPop(); + GetGtkSalData()->ErrorTrapPop(); // destroy old IC g_object_unref( m_pIMContext ); m_pIMContext = nullptr; @@ -5584,9 +5584,9 @@ void GtkSalFrame::IMHandler::updateIMSpotLocation() aArea.y = aPosEvent.mnY; aArea.width = aPosEvent.mnWidth; aArea.height = aPosEvent.mnHeight; - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); gtk_im_context_set_cursor_location( m_pIMContext, &aArea ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetGtkSalData()->ErrorTrapPop(); } void GtkSalFrame::IMHandler::sendEmptyCommit() @@ -5630,9 +5630,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn ) m_bFocused = bFocusIn; if( bFocusIn ) { - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); gtk_im_context_focus_in( m_pIMContext ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetGtkSalData()->ErrorTrapPop(); if( m_aInputEvent.mpTextAttr ) { sendEmptyCommit(); @@ -5642,9 +5642,9 @@ void GtkSalFrame::IMHandler::focusChanged( bool bFocusIn ) } else { - GetGenericUnixSalData()->ErrorTrapPush(); + GetGtkSalData()->ErrorTrapPush(); gtk_im_context_focus_out( m_pIMContext ); - GetGenericUnixSalData()->ErrorTrapPop(); + GetGtkSalData()->ErrorTrapPop(); // cancel an eventual event posted to begin preedit again GtkSalFrame::getDisplay()->CancelInternalEvent( m_pFrame, &m_aInputEvent, SalEvent::ExtTextInput ); } commit e8cb84378b2ae53ee449acb3591fba1a48644aca Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 25 10:15:18 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 25 14:44:05 2026 +0100 vcl: Get SalData in vcl_sal::getSalDisplay instead of passing as param All callers of vcl_sal::getSalDisplay call GetGenericUnixSalData to get the GenericUnixSalData* to pass as an argument. Simplify this by dropping the param and calling GetGenericUnixSalData inside vcl_sal::getSalDisplay itself. Change-Id: Id6269b656fbc7414ca65facc717c5b7fc3075e85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200301 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 383666c0e812..abfdf97f77f4 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -356,10 +356,11 @@ namespace vcl_sal { std::u16string_view pLang, KeySym nSymbol ); - inline SalX11Display* getSalDisplay(GenericUnixSalData const * data) + inline SalX11Display* getSalDisplay() { - assert(data != nullptr); - return static_cast<SalX11Display*>(data->GetDisplay()); + const GenericUnixSalData* pData = GetGenericUnixSalData(); + assert(pData != nullptr); + return static_cast<SalX11Display*>(pData->GetDisplay()); } } diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx index 30ab945b0f39..4e27a3055ff5 100644 --- a/vcl/skia/x11/gdiimpl.cxx +++ b/vcl/skia/x11/gdiimpl.cxx @@ -147,7 +147,7 @@ void X11SkiaSalGraphicsImpl::Flush() { performFlush(); } std::unique_ptr<skwindow::WindowContext> createVulkanWindowContext(bool temporary) { - SalX11Display* salDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* salDisplay = vcl_sal::getSalDisplay(); const XVisualInfo* visual; XVisualInfo* visuals = nullptr; if (!temporary) diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx index 1aca3a608faa..7e853068f362 100644 --- a/vcl/skia/x11/salvd.cxx +++ b/vcl/skia/x11/salvd.cxx @@ -38,7 +38,7 @@ X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, t { assert(mpGraphics); - mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + mpDisplay = vcl_sal::getSalDisplay(); mnXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber(); mnWidth = nDX; mnHeight = nDY; @@ -56,7 +56,7 @@ X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, t // TODO Check where a VirtualDevice is created from SystemGraphicsData assert(false); - mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + mpDisplay = vcl_sal::getSalDisplay(); mnXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber(); mnWidth = nDX; mnHeight = nDY; diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index c43ebb0f117e..07b70cfbb8f3 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -155,7 +155,7 @@ SalI18N_InputContext::SalI18N_InputContext(X11SalFrame* pFrame) : maClientData.aInputEv.mnCursorFlags = 0; SalI18N_InputMethod *pInputMethod; - pInputMethod = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetInputMethod(); + pInputMethod = vcl_sal::getSalDisplay()->GetInputMethod(); mnSupportedPreeditStyle = XIMPreeditCallbacks | XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone; @@ -262,7 +262,7 @@ SalI18N_InputContext::SalI18N_InputContext(X11SalFrame* pFrame) : // XCreateIC() fails on Redflag Linux 2.0 if there is no // fontset though the data itself is not evaluated nor is // it required according to the X specs. - Display* pDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDisplay(); + Display* pDisplay = vcl_sal::getSalDisplay()->GetDisplay(); XFontSet pFontSet = get_font_set(pDisplay); if (pFontSet != nullptr) @@ -371,7 +371,7 @@ SalI18N_InputContext::Map(X11SalFrame* pFrame) if ( maContext == nullptr ) { SalI18N_InputMethod *pInputMethod; - pInputMethod = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetInputMethod(); + pInputMethod = vcl_sal::getSalDisplay()->GetInputMethod(); maContext = XCreateIC( pInputMethod->GetMethod(), XNVaNestedList, mpAttributes, @@ -557,7 +557,7 @@ SalI18N_InputContext::SetICFocus(X11SalFrame* pFocusFrame) { sendEmptyCommit(pFocusFrame); // begin preedit again - vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SalEvent::ExtTextInput ); + vcl_sal::getSalDisplay()->SendInternalEvent( pFocusFrame, &maClientData.aInputEv, SalEvent::ExtTextInput ); } XSetICFocus( maContext ); @@ -570,7 +570,7 @@ SalI18N_InputContext::UnsetICFocus() if ( mbUseable && (maContext != nullptr) ) { // cancel an eventual event posted to begin preedit again - vcl_sal::getSalDisplay(GetGenericUnixSalData())->CancelInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput ); + vcl_sal::getSalDisplay()->CancelInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput ); maClientData.pFrame = nullptr; XUnsetICFocus( maContext ); } @@ -594,7 +594,7 @@ SalI18N_InputContext::EndExtTextInput() if( static_cast<X11SalFrame*>(maClientData.pFrame)->hasFocus() ) { // begin preedit again - vcl_sal::getSalDisplay(GetGenericUnixSalData())->SendInternalEvent( maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput ); + vcl_sal::getSalDisplay()->SendInternalEvent(maClientData.pFrame, &maClientData.aInputEv, SalEvent::ExtTextInput); } } } diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 0b918a5637e5..08a43320d729 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -499,7 +499,7 @@ void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) ) return; - if( pDisplay != vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDisplay() ) + if (pDisplay != vcl_sal::getSalDisplay()->GetDisplay()) return; PrintXError( pDisplay, pEvent ); diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 20235b396a9f..a9d0d044af97 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -2352,7 +2352,7 @@ SalColormap::SalColormap( const SalX11Display* pDisplay, Colormap hColormap, // MonoChrome SalColormap::SalColormap() - : m_pDisplay( vcl_sal::getSalDisplay(GetGenericUnixSalData()) ), + : m_pDisplay(vcl_sal::getSalDisplay()), m_hColormap( None ), m_nWhitePixel( 1 ), m_nBlackPixel( 0 ), @@ -2366,13 +2366,13 @@ SalColormap::SalColormap() // TrueColor SalColormap::SalColormap( sal_uInt16 nDepth ) - : m_pDisplay( vcl_sal::getSalDisplay(GetGenericUnixSalData()) ), + : m_pDisplay(vcl_sal::getSalDisplay()), m_hColormap( None ), m_nWhitePixel( (1 << nDepth) - 1 ), m_nBlackPixel( 0x00000000 ), m_nUsed( 1 << nDepth ) { - SalX11Screen nXScreen( vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen() ); + SalX11Screen nXScreen(vcl_sal::getSalDisplay()->GetDefaultXScreen()); const SalVisual *pVisual = &m_pDisplay->GetVisual( nXScreen ); if( pVisual->GetClass() == TrueColor && pVisual->GetDepth() == nDepth ) diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index c96181ec5fe9..633866efce99 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -154,8 +154,7 @@ static Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) bool X11SalInstance::AnyInput(VclInputFlags nType) { - GenericUnixSalData *pData = GetGenericUnixSalData(); - Display *pDisplay = vcl_sal::getSalDisplay(pData)->GetDisplay(); + Display* pDisplay = vcl_sal::getSalDisplay()->GetDisplay(); bool bRet = false; if( (nType & VclInputFlags::TIMER) && (mpXLib && mpXLib->CheckTimeout(false)) ) @@ -221,7 +220,7 @@ void X11SalInstance::AddToRecentDocumentList(const OUString&, const OUString&, c void X11SalInstance::PostPrintersChanged() { - SalX11Display* pDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pDisp = vcl_sal::getSalDisplay(); for (auto pSalFrame : pDisp->getFrames() ) pDisp->PostEvent( pSalFrame, nullptr, SalEvent::PrinterChanged ); } diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 20234681c9f3..5d98e59ba870 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -295,7 +295,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, pStateVal, void task of the quick-starter) */ *pSmRestartHint = SmRestartNever; - for (auto pSalFrame : vcl_sal::getSalDisplay(GetGenericUnixSalData())->getFrames() ) + for (auto pSalFrame : vcl_sal::getSalDisplay()->getFrames()) { vcl::Window *pWindow = pSalFrame->GetWindow(); if (pWindow && pWindow->IsVisible()) @@ -395,7 +395,7 @@ IMPL_STATIC_LINK_NOARG( SessionManagerClient, ShutDownHdl, void*, void ) m_pSession->CallCallback( &aEvent ); } - SalFrame *pAnyFrame = vcl_sal::getSalDisplay(GetGenericUnixSalData())->anyFrame(); + SalFrame* pAnyFrame = vcl_sal::getSalDisplay()->anyFrame(); SAL_INFO("vcl.sm.debug", " rFrames.empty() = " << (pAnyFrame ? "true" : "false")); if( pAnyFrame ) pAnyFrame->CallCallback( SalEvent::Shutdown, nullptr ); @@ -518,7 +518,7 @@ void SessionManagerClient::open(SalSession * pSession) pClientID = nullptr; } - SalX11Display* pDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pDisp = vcl_sal::getSalDisplay(); if( pDisp->GetDrawable(pDisp->GetDefaultXScreen()) && !m_aClientID.isEmpty() ) { SAL_INFO("vcl.sm.debug", " SmcOpenConnection open: pDisp->GetDrawable = true"); @@ -853,7 +853,7 @@ void ICEWatchProc( } SAL_INFO( "vcl.sm.debug", " ICE connection on " << IceConnectionNumber( ice_conn ) ); - SAL_INFO( "vcl.sm.debug", " Display connection is " << ConnectionNumber( vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDisplay() ) ); + SAL_INFO( "vcl.sm.debug", " Display connection is " << ConnectionNumber(vcl_sal::getSalDisplay()->GetDisplay())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index ba1fc519da8e..acd483111c30 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -3320,10 +3320,10 @@ void SelectionManager::startDrag( comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) { - pCaptureFrame = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetCaptureFrame(); + pCaptureFrame = vcl_sal::getSalDisplay()->GetCaptureFrame(); if( pCaptureFrame ) { - vcl_sal::getSalDisplay(GetGenericUnixSalData())->CaptureMouse( nullptr ); + vcl_sal::getSalDisplay()->CaptureMouse(nullptr); nPointerGrabSuccess = XGrabPointer( m_pDisplay, aRoot, True, DRAG_EVENT_MASK, @@ -3360,7 +3360,7 @@ void SelectionManager::startDrag( { comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) - vcl_sal::getSalDisplay(GetGenericUnixSalData())->CaptureMouse( pCaptureFrame ); + vcl_sal::getSalDisplay()->CaptureMouse(pCaptureFrame); #if OSL_DEBUG_LEVEL > 0 else OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" ); @@ -3450,7 +3450,7 @@ void SelectionManager::startDrag( { comphelper::SolarMutex& rSolarMutex( Application::GetSolarMutex() ); if( rSolarMutex.tryToAcquire() ) - vcl_sal::getSalDisplay(GetGenericUnixSalData())->CaptureMouse( pCaptureFrame ); + vcl_sal::getSalDisplay()->CaptureMouse(pCaptureFrame); #if OSL_DEBUG_LEVEL > 0 else OSL_FAIL( "failed to acquire SolarMutex to reset capture frame" ); diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index ec40d1f2c708..3f814b47fbf6 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -126,7 +126,7 @@ void X11SalGraphics::SetDrawable(Drawable aDrawable, cairo_surface_t* pSurface, if( nXScreen != m_nXScreen ) { FreeColorMap(); - maX11Common.m_pColormap = &vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetColormap( nXScreen ); + maX11Common.m_pColormap = &vcl_sal::getSalDisplay()->GetColormap(nXScreen); m_nXScreen = nXScreen; } @@ -136,7 +136,7 @@ void X11SalGraphics::SetDrawable(Drawable aDrawable, cairo_surface_t* pSurface, void X11SalGraphics::Init( X11SalFrame& rFrame, Drawable aTarget, SalX11Screen nXScreen ) { - maX11Common.m_pColormap = &vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetColormap(nXScreen); + maX11Common.m_pColormap = &vcl_sal::getSalDisplay()->GetColormap(nXScreen); m_nXScreen = nXScreen; m_pFrame = &rFrame; diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 26eafa3b0611..5d9246cc6a6d 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -119,7 +119,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Lo bool bDeleteColormap = false; nDepth_ = eFormat == DeviceFormat::WITH_ALPHA ? 32 : rGraphics.GetBitCount(); - pDisplay_ = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + pDisplay_ = vcl_sal::getSalDisplay(); nDX_ = nDX; nDY_ = nDY; @@ -158,7 +158,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Lo bool bDeleteColormap = false; sal_uInt16 nBitCount = rGraphics.GetBitCount(); - pDisplay_ = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + pDisplay_ = vcl_sal::getSalDisplay(); nDepth_ = nBitCount; assert(rData.hDrawable != None); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index e0aeb08e21c0..fcce5dda781f 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -708,13 +708,11 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, SalFrameStyleFlags nSalFrameStyle, m_nXScreen( 0 ), maAlwaysOnTopRaiseTimer( "vcl::X11SalFrame maAlwaysOnTopRaiseTimer" ) { - GenericUnixSalData *pData = GetGenericUnixSalData(); - mpParent = static_cast< X11SalFrame* >( pParent ); mbTransientForRoot = false; - pDisplay_ = vcl_sal::getSalDisplay(pData); + pDisplay_ = vcl_sal::getSalDisplay(); // insert frame in framelist pDisplay_->registerFrame( this ); @@ -2299,12 +2297,12 @@ SalFrame::SalPointerState X11SalFrame::GetPointerState() KeyIndicatorState X11SalFrame::GetIndicatorState() { - return vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetIndicatorState(); + return vcl_sal::getSalDisplay()->GetIndicatorState(); } void X11SalFrame::SimulateKeyPress( sal_uInt16 nKeyCode ) { - vcl_sal::getSalDisplay(GetGenericUnixSalData())->SimulateKeyPress(nKeyCode); + vcl_sal::getSalDisplay()->SimulateKeyPress(nKeyCode); } namespace diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 21038e51ed41..958f303605d9 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -59,7 +59,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pObject->mpParent = pParent; - SalX11Display* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pSalDisp = vcl_sal::getSalDisplay(); const SystemEnvData& rEnv = pParent->GetSystemData(); Display* pDisp = pSalDisp->GetDisplay(); ::Window aObjectParent = static_cast<::Window>(rEnv.GetWindowHandle(pParent)); @@ -223,7 +223,7 @@ X11SalObject::X11SalObject() , maColormap(0) , mbVisible(false) { - maSystemChildData.pDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDisplay(); + maSystemChildData.pDisplay = vcl_sal::getSalDisplay()->GetDisplay(); maSystemChildData.SetWindowHandle(None); maSystemChildData.pSalFrame = nullptr; maSystemChildData.pWidget = nullptr; @@ -231,13 +231,13 @@ X11SalObject::X11SalObject() maSystemChildData.toolkit = SystemEnvData::Toolkit::Gen; maSystemChildData.platform = SystemEnvData::Platform::Xcb; - std::list< SalObject* >& rObjects = vcl_sal::getSalDisplay(GetGenericUnixSalData())->getSalObjects(); + std::list<SalObject*>& rObjects = vcl_sal::getSalDisplay()->getSalObjects(); rObjects.push_back( this ); } X11SalObject::~X11SalObject() { - std::list< SalObject* >& rObjects = vcl_sal::getSalDisplay(GetGenericUnixSalData())->getSalObjects(); + std::list<SalObject*>& rObjects = vcl_sal::getSalDisplay()->getSalObjects(); rObjects.remove( this ); GetGenericUnixSalData()->ErrorTrapPush(); @@ -387,7 +387,7 @@ static sal_uInt16 sal_GetCode( int state ) bool X11SalObject::Dispatch( XEvent* pEvent ) { - std::list< SalObject* >& rObjects = vcl_sal::getSalDisplay(GetGenericUnixSalData())->getSalObjects(); + std::list<SalObject*>& rObjects = vcl_sal::getSalDisplay()->getSalObjects(); for (auto const& elem : rObjects) { @@ -469,7 +469,7 @@ bool X11SalObject::Dispatch( XEvent* pEvent ) void X11SalObject::SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::Any>& rLeaveArgs, const css::uno::Sequence<css::uno::Any>& rEnterArgs) { - SalX11Display* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pSalDisp = vcl_sal::getSalDisplay(); Display* pDisp = pSalDisp->GetDisplay(); ::Window aObjectParent = maParentWin; diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index 21a334009b30..6084706131f8 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -42,21 +42,21 @@ X11SalSystem::~X11SalSystem() // for the moment only handle xinerama case unsigned int X11SalSystem::GetDisplayScreenCount() { - SalX11Display* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pSalDisp = vcl_sal::getSalDisplay(); return pSalDisp->IsXinerama() ? pSalDisp->GetXineramaScreens().size() : pSalDisp->GetXScreenCount(); } unsigned int X11SalSystem::GetDisplayBuiltInScreen() { - SalX11Display* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pSalDisp = vcl_sal::getSalDisplay(); return pSalDisp->GetDefaultXScreen().getXScreen(); } AbsoluteScreenPixelRectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { AbsoluteScreenPixelRectangle aRet; - SalX11Display* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); + SalX11Display* pSalDisp = vcl_sal::getSalDisplay(); if( pSalDisp->IsXinerama() ) { const std::vector< AbsoluteScreenPixelRectangle >& rScreens = pSalDisp->GetXineramaScreens();
