include/vcl/svapp.hxx                    |    9 ---------
 vcl/inc/unx/salinst.h                    |    3 +++
 vcl/source/app/svapp.cxx                 |   14 --------------
 vcl/unx/generic/app/salinst.cxx          |   13 +++++++++++++
 vcl/unx/generic/dtrans/X11_selection.cxx |    3 ++-
 5 files changed, 18 insertions(+), 24 deletions(-)

New commits:
commit d5c51922bc44929fe91e217044e2d6ba8b61559a
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 2 04:08:30 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Mar 2 17:16:15 2026 +0100

    vcl: Move GetDisplayConnection from Application to X11SalInstance
    
    As the comment already says, this is only used by the gen/x11
    vcl plugin, so move it there.
    
    Change-Id: Ieb02f1c7f49c27545d74cca82088e1285b51ffb1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200755
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 7afde6b855bc..8348bd3b8292 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -56,7 +56,6 @@ class Accelerator;
 class Help;
 class OutputDevice;
 namespace vcl {
-    class DisplayConnectionDispatch;
     class KeyCode;
     class Window;
 }
@@ -804,14 +803,6 @@ public:
     */
     static void                 RemoveUserEvent( ImplSVEvent * nUserEvent );
 
-    /** Get the DisplayConnection.
-
-    It allows toolkits to send display events to the application.
-
-    This is only used by the gen/x11 VCL plugin.
-    */
-    static rtl::Reference<vcl::DisplayConnectionDispatch> 
GetDisplayConnection();
-
     /** @deprecated AppEvent is used only in the Desktop class now. However, 
it is
      intended to notify the application that an event has occurred. It was in 
oldsv.cxx,
      but is still needed by a number of functions.
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 22b4d6422450..bcf9d1359e22 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -88,6 +88,9 @@ public:
     virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
     ImplCreateDropTarget(const SystemEnvData& rSysEnv) override;
     virtual void            AddToRecentDocumentList(const OUString& rFileUrl, 
const OUString& rMimeType, const OUString& rDocumentService) override;
+
+    /** Get the DisplayConnection. It allows to send display events to the 
application. */
+    static rtl::Reference<vcl::DisplayConnectionDispatch> 
GetDisplayConnection();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 14b6c9def363..401c00fa7941 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -63,7 +63,6 @@
 #include <salframe.hxx>
 #include <salsys.hxx>
 #include <svdata.hxx>
-#include <displayconnectiondispatch.hxx>
 #include <window.h>
 #include <accmgr.hxx>
 #include <strings.hrc>
@@ -1571,19 +1570,6 @@ void UnoWrapperBase::SetUnoWrapper( UnoWrapperBase* 
pWrapper )
     pSVData->mpUnoWrapper = pWrapper;
 }
 
-rtl::Reference<vcl::DisplayConnectionDispatch> 
Application::GetDisplayConnection()
-{
-    ImplSVData* pSVData = ImplGetSVData();
-
-    if( !pSVData->mxDisplayConnection.is() )
-    {
-        pSVData->mxDisplayConnection.set( new vcl::DisplayConnectionDispatch );
-        pSVData->mxDisplayConnection->start();
-    }
-
-    return pSVData->mxDisplayConnection;
-}
-
 void Application::SetFilterHdl( const Link<ConvertData&,bool>& rLink )
 {
     ImplGetSVData()->maGDIData.mxGrfConverter->SetFilterHdl( rLink );
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 48d55e3b6fcb..57039abc11d9 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -233,4 +233,17 @@ std::shared_ptr<SalBitmap> 
X11SalInstance::CreateSalBitmap()
     return std::make_shared<SvpSalBitmap>();
 }
 
+rtl::Reference<vcl::DisplayConnectionDispatch> 
X11SalInstance::GetDisplayConnection()
+{
+    ImplSVData* pSVData = ImplGetSVData();
+
+    if (!pSVData->mxDisplayConnection.is())
+    {
+        pSVData->mxDisplayConnection.set(new vcl::DisplayConnectionDispatch);
+        pSVData->mxDisplayConnection->start();
+    }
+
+    return pSVData->mxDisplayConnection;
+}
+
 /* 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 acd483111c30..5882886c0bd6 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -25,6 +25,7 @@
 
 #include <salinst.hxx>
 #include <unx/saldisp.hxx>
+#include <unx/salinst.h>
 
 #include <unistd.h>
 #include <string.h>
@@ -335,7 +336,7 @@ void SelectionManager::initialize()
          *  needs to be added. The display used would be that of the normal 
event loop
          *  and synchronization should be done via the SolarMutex.
          */
-        m_xDisplayConnection = Application::GetDisplayConnection();
+        m_xDisplayConnection = X11SalInstance::GetDisplayConnection();
         assert(m_xDisplayConnection.is());
         m_xDisplayConnection->addEventHandler(this);
     }

Reply via email to