vcl/inc/unx/X11DisplayConnectionDispatch.hxx         |   14 ++++++--------
 vcl/inc/unx/X11_selection.hxx                        |   11 +++++------
 vcl/unx/generic/app/X11DisplayConnectionDispatch.cxx |    9 +++++----
 3 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit d4dc0806b5abc986d88b2d9522b33097e00a4cc9
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 2 06:38:31 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Mar 2 17:23:02 2026 +0100

    vcl: Drop abstract DisplayEventHandler base class
    
    Use the only subclass x11::SelectionManager directly in
    XDisplayConnectionDispatch instead.
    
    Change-Id: I43327631fcf84013017e39b2170cfff5297f2291
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200763
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/unx/X11DisplayConnectionDispatch.hxx 
b/vcl/inc/unx/X11DisplayConnectionDispatch.hxx
index 69f4ed21d005..467a686253b9 100644
--- a/vcl/inc/unx/X11DisplayConnectionDispatch.hxx
+++ b/vcl/inc/unx/X11DisplayConnectionDispatch.hxx
@@ -30,17 +30,15 @@
 #include <mutex>
 #include <vector>
 
-class DisplayEventHandler : public cppu::WeakImplHelper<>
+namespace x11
 {
-public:
-    virtual bool handleEvent(const void* pEvent) = 0;
-    virtual void shutdown() noexcept = 0;
-};
+class SelectionManager;
+}
 
 class X11DisplayConnectionDispatch final : public 
vcl::DisplayConnectionDispatch
 {
     std::mutex m_aMutex;
-    std::vector<rtl::Reference<DisplayEventHandler>> m_aHandlers;
+    std::vector<rtl::Reference<x11::SelectionManager>> m_aHandlers;
 
 public:
     X11DisplayConnectionDispatch();
@@ -51,8 +49,8 @@ public:
 
     bool dispatchEvent(const void* pEvent);
 
-    void addEventHandler(const rtl::Reference<DisplayEventHandler>& handler);
-    void removeEventHandler(const rtl::Reference<DisplayEventHandler>& 
handler);
+    void addEventHandler(const rtl::Reference<x11::SelectionManager>& handler);
+    void removeEventHandler(const rtl::Reference<x11::SelectionManager>& 
handler);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/inc/unx/X11_selection.hxx b/vcl/inc/unx/X11_selection.hxx
index 2c4354855511..1fcf9b96354b 100644
--- a/vcl/inc/unx/X11_selection.hxx
+++ b/vcl/inc/unx/X11_selection.hxx
@@ -107,10 +107,9 @@ public:
         const 
css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& listener) 
override;
 };
 
-class SelectionManager
-    : public cppu::ImplInheritanceHelper<DisplayEventHandler, 
css::datatransfer::dnd::XDragSource,
-                                         css::frame::XTerminateListener>,
-      public SelectionAdaptor
+class SelectionManager : public 
cppu::WeakImplHelper<css::datatransfer::dnd::XDragSource,
+                                                     
css::frame::XTerminateListener>,
+                         public SelectionAdaptor
 {
     static std::unordered_map<OUString, SelectionManager*>& getInstances();
 
@@ -423,8 +422,8 @@ public:
 
     void initialize();
 
-    virtual bool handleEvent(const void* pEvent) override;
-    void shutdown() noexcept override;
+    bool handleEvent(const void* pEvent);
+    void shutdown() noexcept;
 
     // XDragSource
     virtual sal_Bool SAL_CALL isDragImageSupported() override;
diff --git a/vcl/unx/generic/app/X11DisplayConnectionDispatch.cxx 
b/vcl/unx/generic/app/X11DisplayConnectionDispatch.cxx
index ec72999dc093..847370b0a080 100644
--- a/vcl/unx/generic/app/X11DisplayConnectionDispatch.cxx
+++ b/vcl/unx/generic/app/X11DisplayConnectionDispatch.cxx
@@ -20,6 +20,7 @@
 #include <salinst.hxx>
 #include <svdata.hxx>
 #include <unx/X11DisplayConnectionDispatch.hxx>
+#include <unx/X11_selection.hxx>
 #include <unx/salinst.h>
 
 #include <tools/debug.hxx>
@@ -50,13 +51,13 @@ void X11DisplayConnectionDispatch::terminate()
     SolarMutexReleaser aRel;
 
     std::scoped_lock aGuard(m_aMutex);
-    std::vector<rtl::Reference<DisplayEventHandler>> aLocalList(m_aHandlers);
+    std::vector<rtl::Reference<x11::SelectionManager>> aLocalList(m_aHandlers);
     for (auto const& elem : aLocalList)
         elem->shutdown();
 }
 
 void X11DisplayConnectionDispatch::addEventHandler(
-    const rtl::Reference<DisplayEventHandler>& handler)
+    const rtl::Reference<x11::SelectionManager>& handler)
 {
     std::scoped_lock aGuard(m_aMutex);
 
@@ -64,7 +65,7 @@ void X11DisplayConnectionDispatch::addEventHandler(
 }
 
 void X11DisplayConnectionDispatch::removeEventHandler(
-    const rtl::Reference<DisplayEventHandler>& handler)
+    const rtl::Reference<x11::SelectionManager>& handler)
 {
     std::scoped_lock aGuard(m_aMutex);
 
@@ -75,7 +76,7 @@ bool X11DisplayConnectionDispatch::dispatchEvent(const void* 
pEvent)
 {
     SolarMutexReleaser aRel;
 
-    std::vector<rtl::Reference<DisplayEventHandler>> handlers;
+    std::vector<rtl::Reference<x11::SelectionManager>> handlers;
     {
         std::scoped_lock aGuard(m_aMutex);
         handlers = m_aHandlers;

Reply via email to