vcl/inc/unx/saldata.hxx | 1 vcl/inc/unx/saldisp.hxx | 1 vcl/unx/generic/app/saldata.cxx | 129 +++++++++++++++++----------------------- vcl/unx/generic/app/salinst.cxx | 1 4 files changed, 58 insertions(+), 74 deletions(-)
New commits: commit 8ee35f32d2a486fde1690236ebf801930a01b170 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 24 22:41:49 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 25 09:03:18 2026 +0100 vcl: Merge SalXLib::Init into ctor Change-Id: Iaa35d9d08f5c8f6a88e5c1470827e22dc10428e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200273 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 23ea5d4bee43..241a189e8255 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -149,7 +149,6 @@ class SalXLib public: SalXLib(); ~SalXLib(); - void Init(); bool Yield( bool bWait, bool bHandleAllCurrentEvents ); void Wakeup(); diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index f281301c9dd0..0b918a5637e5 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -236,7 +236,6 @@ X11SalData::X11SalData() PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) ); pXLib_.reset(new SalXLib()); - pXLib_->Init(); } X11SalData::~X11SalData() @@ -292,64 +291,6 @@ void X11SalData::PopXErrorLevel() } } -SalXLib::SalXLib() -{ - m_aTimeout.tv_sec = 0; - m_aTimeout.tv_usec = 0; - m_nTimeoutMS = 0; - - nFDs_ = 0; - FD_ZERO( &aReadFDS_ ); - FD_ZERO( &aExceptionFDS_ ); - - m_pInputMethod = nullptr; - m_pDisplay = nullptr; - - m_pTimeoutFDS[0] = m_pTimeoutFDS[1] = -1; - if (pipe (m_pTimeoutFDS) == -1) - return; - - // initialize 'wakeup' pipe. - int flags; - - // set close-on-exec descriptor flag. - if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFD)) != -1) - { - flags |= FD_CLOEXEC; - (void)fcntl(m_pTimeoutFDS[0], F_SETFD, flags); - } - if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFD)) != -1) - { - flags |= FD_CLOEXEC; - (void)fcntl(m_pTimeoutFDS[1], F_SETFD, flags); - } - - // set non-blocking I/O flag. - if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFL)) != -1) - { - flags |= O_NONBLOCK; - (void)fcntl(m_pTimeoutFDS[0], F_SETFL, flags); - } - if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFL)) != -1) - { - flags |= O_NONBLOCK; - (void)fcntl(m_pTimeoutFDS[1], F_SETFL, flags); - } - - // insert [0] into read descriptor set. - FD_SET( m_pTimeoutFDS[0], &aReadFDS_ ); - nFDs_ = m_pTimeoutFDS[0] + 1; -} - -SalXLib::~SalXLib() -{ - // close 'wakeup' pipe. - close (m_pTimeoutFDS[0]); - close (m_pTimeoutFDS[1]); - - m_pInputMethod.reset(); -} - static Display *OpenX11Display(OString& rDisplay) { /* @@ -373,7 +314,7 @@ static Display *OpenX11Display(OString& rDisplay) { osl_getCommandArg(i+1, &aParam.pData); rDisplay = OUStringToOString( - aParam, osl_getThreadTextEncoding()); + aParam, osl_getThreadTextEncoding()); if ((pDisp = XOpenDisplay(rDisplay.getStr()))!=nullptr) { @@ -402,8 +343,51 @@ static Display *OpenX11Display(OString& rDisplay) return pDisp; } -void SalXLib::Init() +SalXLib::SalXLib() { + m_aTimeout.tv_sec = 0; + m_aTimeout.tv_usec = 0; + m_nTimeoutMS = 0; + + nFDs_ = 0; + FD_ZERO( &aReadFDS_ ); + FD_ZERO( &aExceptionFDS_ ); + + m_pTimeoutFDS[0] = m_pTimeoutFDS[1] = -1; + if (pipe (m_pTimeoutFDS) == -1) + return; + + // initialize 'wakeup' pipe. + int flags; + + // set close-on-exec descriptor flag. + if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFD)) != -1) + { + flags |= FD_CLOEXEC; + (void)fcntl(m_pTimeoutFDS[0], F_SETFD, flags); + } + if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFD)) != -1) + { + flags |= FD_CLOEXEC; + (void)fcntl(m_pTimeoutFDS[1], F_SETFD, flags); + } + + // set non-blocking I/O flag. + if ((flags = fcntl (m_pTimeoutFDS[0], F_GETFL)) != -1) + { + flags |= O_NONBLOCK; + (void)fcntl(m_pTimeoutFDS[0], F_SETFL, flags); + } + if ((flags = fcntl (m_pTimeoutFDS[1], F_GETFL)) != -1) + { + flags |= O_NONBLOCK; + (void)fcntl(m_pTimeoutFDS[1], F_SETFL, flags); + } + + // insert [0] into read descriptor set. + FD_SET( m_pTimeoutFDS[0], &aReadFDS_ ); + nFDs_ = m_pTimeoutFDS[0] + 1; + m_pInputMethod.reset( new SalI18N_InputMethod ); m_pInputMethod->SetLocale(); XrmInitialize(); @@ -419,16 +403,24 @@ void SalXLib::Init() OUString aProgramSystemPath; osl_getSystemPathFromFileURL (aProgramFileURL.pData, &aProgramSystemPath.pData); OString aProgramName = OUStringToOString( - aProgramSystemPath, - osl_getThreadTextEncoding() ); + aProgramSystemPath, + osl_getThreadTextEncoding() ); std::fprintf( stderr, "%s X11 error: Can't open display: %s ", - aProgramName.getStr(), aDisplay.getStr()); + aProgramName.getStr(), aDisplay.getStr()); std::fprintf( stderr, " Set DISPLAY environment variable, use -display option "); std::fprintf( stderr, " or check permissions of your X-Server "); std::fprintf( stderr, " (See \"man X\" resp. \"man xhost\" for details) "); std::fflush( stderr ); exit(0); +} +SalXLib::~SalXLib() +{ + // close 'wakeup' pipe. + close (m_pTimeoutFDS[0]); + close (m_pTimeoutFDS[1]); + + m_pInputMethod.reset(); } extern "C" { commit adb0de46025840f887990d70f65cf5b4dd675eec Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 24 22:36:34 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Feb 25 09:03:11 2026 +0100 vcl: Merge X11SalData::Init into ctor Change-Id: I86795bb8b788cce5182f2dd3c472da296ac1113a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200272 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/inc/unx/saldata.hxx b/vcl/inc/unx/saldata.hxx index 33460a162dae..66fa8c61bd61 100644 --- a/vcl/inc/unx/saldata.hxx +++ b/vcl/inc/unx/saldata.hxx @@ -43,7 +43,6 @@ public: X11SalData(); virtual ~X11SalData() override; - void Init(); void Dispose(); void DeleteDisplay(); // for shutdown diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index ac2f15810268..f281301c9dd0 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -232,10 +232,11 @@ const char* const XRequest[] = { X11SalData::X11SalData() : GenericUnixSalData() { - pXLib_ = nullptr; - m_aOrigXIOErrorHandler = XSetIOErrorHandler ( XIOErrorHdl ); PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) ); + + pXLib_.reset(new SalXLib()); + pXLib_->Init(); } X11SalData::~X11SalData() @@ -258,12 +259,6 @@ void X11SalData::DeleteDisplay() pXLib_.reset(); } -void X11SalData::Init() -{ - pXLib_.reset(new SalXLib()); - pXLib_->Init(); -} - void X11SalData::ErrorTrapPush() { PushXErrorLevel( true ); diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index af2c85a4e303..256a3f7c43d3 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -61,7 +61,6 @@ extern "C" // initialize SalData X11SalData *pSalData = new X11SalData(); - pSalData->Init(); pInstance->SetLib( pSalData->GetLib() ); return pInstance;
