vcl/inc/unx/gendata.hxx | 13 ------------- vcl/inc/unx/saldata.hxx | 16 ++++++++++++++++ vcl/unx/generic/app/wmadaptor.cxx | 2 +- vcl/unx/generic/window/salframe.cxx | 6 +++--- 4 files changed, 20 insertions(+), 17 deletions(-)
New commits: commit 71c46b67bdab27d3bf01782049da87e4aa6b1ad0 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 25 10:54:48 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Feb 26 23:27:19 2026 +0100 vcl: Move GenericUnixSalData::m_aHostname to gen/x11 subclass This is only used for the gen/x11 VCL plugin, where it's known that the X11SalData subclass is used. Therefore, move the logic there and use a pointer to the more specific class to call the getter. Change-Id: I0563997676d6bb6db4a5812a1436d32ddc0f4726 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200330 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx index f3044c8b7716..a1c3ea4259c5 100644 --- a/vcl/inc/unx/gendata.hxx +++ b/vcl/inc/unx/gendata.hxx @@ -54,8 +54,6 @@ class VCL_PLUGIN_PUBLIC GenericUnixSalData : public SalData #endif SalGenericDisplay* m_pDisplay; - // cached hostname to avoid slow lookup - OUString m_aHostname; #ifndef IOS std::unique_ptr<FreetypeManager> m_pFreetypeManager; @@ -73,13 +71,6 @@ public: SalGenericDisplay* GetDisplay() const { return m_pDisplay; } void SetDisplay(SalGenericDisplay* pDisp) { m_pDisplay = pDisp; } - const OUString& GetHostname() - { - if (m_aHostname.isEmpty()) - osl_getLocalHostname(&m_aHostname.pData); - return m_aHostname; - } - #ifndef IOS FreetypeManager* GetFreetypeManager() diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 4dba293d3db1..a276febb7d40 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -35,6 +35,9 @@ class X11SalData final : public GenericUnixSalData XErrorHandler m_aHandler; }; + // cached hostname to avoid slow lookup + OUString m_aHostname; + // for transient storage of unicode strings eg. 'u123' by input methods OUString m_aUnicodeEntry; @@ -47,6 +50,13 @@ public: X11SalData(); virtual ~X11SalData() override; + const OUString& GetHostname() + { + if (m_aHostname.isEmpty()) + osl_getLocalHostname(&m_aHostname.pData); + return m_aHostname; + } + OUString& GetUnicodeCommand() { return m_aUnicodeEntry; } void Dispose(); diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 13f39b11c0c3..05897c80f3fc 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -2144,7 +2144,7 @@ void WMAdaptor::setPID( X11SalFrame const * i_pFrame ) const */ void WMAdaptor::setClientMachine( X11SalFrame const * i_pFrame ) const { - OString aWmClient( OUStringToOString( GetGenericUnixSalData()->GetHostname(), RTL_TEXTENCODING_ASCII_US ) ); + OString aWmClient(OUStringToOString(GetX11SalData()->GetHostname(), RTL_TEXTENCODING_ASCII_US)); XTextProperty aClientProp = { reinterpret_cast<unsigned char *>(const_cast<char *>(aWmClient.getStr())), XA_STRING, 8, sal::static_int_cast<unsigned long>( aWmClient.getLength() ) }; XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp ); } commit b79140c8491abb08183549376b6b5086a9f02702 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Feb 25 10:50:03 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Feb 26 23:27:12 2026 +0100 vcl: Move GenericUnixSalData::m_aUnicodeEntry to gen/x11 subclass This is only used for the gen/x11 VCL plugin, where it's known that the X11SalData subclass is used. Therefore, move the logic there and use a pointer to the more specific class to call the method accessing it. Change-Id: I66b10086e19269f97e1910a0d41b8e031b5762b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200329 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx index 4b5709f6c0af..f3044c8b7716 100644 --- a/vcl/inc/unx/gendata.hxx +++ b/vcl/inc/unx/gendata.hxx @@ -56,8 +56,6 @@ class VCL_PLUGIN_PUBLIC GenericUnixSalData : public SalData SalGenericDisplay* m_pDisplay; // cached hostname to avoid slow lookup OUString m_aHostname; - // for transient storage of unicode strings eg. 'u123' by input methods - OUString m_aUnicodeEntry; #ifndef IOS std::unique_ptr<FreetypeManager> m_pFreetypeManager; @@ -82,8 +80,6 @@ public: return m_aHostname; } - OUString& GetUnicodeCommand() { return m_aUnicodeEntry; } - #ifndef IOS FreetypeManager* GetFreetypeManager() diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 7c84bac4375c..4dba293d3db1 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -34,6 +34,10 @@ class X11SalData final : public GenericUnixSalData bool m_bWas; XErrorHandler m_aHandler; }; + + // for transient storage of unicode strings eg. 'u123' by input methods + OUString m_aUnicodeEntry; + std::vector< XErrorStackEntry > m_aXErrorHandlerStack; XIOErrorHandler m_aOrigXIOErrorHandler; @@ -43,6 +47,8 @@ public: X11SalData(); virtual ~X11SalData() override; + OUString& GetUnicodeCommand() { return m_aUnicodeEntry; } + void Dispose(); void DeleteDisplay(); // for shutdown diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index dfb9baceed14..b8e04e565d3f 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2622,7 +2622,7 @@ GetAlternateKeyCode( const sal_uInt16 nKeyCode ) void X11SalFrame::beginUnicodeSequence() { - OUString& rSeq( GetGenericUnixSalData()->GetUnicodeCommand() ); + OUString& rSeq(GetX11SalData()->GetUnicodeCommand()); vcl::DeletionListener aDeleteWatch( this ); if( !rSeq.isEmpty() ) @@ -2646,7 +2646,7 @@ void X11SalFrame::beginUnicodeSequence() bool X11SalFrame::appendUnicodeSequence( sal_Unicode c ) { bool bRet = false; - OUString& rSeq( GetGenericUnixSalData()->GetUnicodeCommand() ); + OUString& rSeq(GetX11SalData()->GetUnicodeCommand()); if( !rSeq.isEmpty() ) { // range check @@ -2676,7 +2676,7 @@ bool X11SalFrame::appendUnicodeSequence( sal_Unicode c ) bool X11SalFrame::endUnicodeSequence() { - OUString& rSeq( GetGenericUnixSalData()->GetUnicodeCommand() ); + OUString& rSeq(GetX11SalData()->GetUnicodeCommand()); vcl::DeletionListener aDeleteWatch( this ); if( rSeq.getLength() > 1 && rSeq.getLength() < 6 )
