vcl/inc/displayconnectiondispatch.hxx           |   19 ++++++++++++-------
 vcl/source/helper/displayconnectiondispatch.cxx |   13 +++++++------
 vcl/unx/generic/dtrans/X11_selection.cxx        |   11 ++++-------
 vcl/unx/generic/dtrans/X11_selection.hxx        |   14 +++++---------
 4 files changed, 28 insertions(+), 29 deletions(-)

New commits:
commit 96132685fcbaee19d9ad18883a5625575761c6c9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 4 14:51:17 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Jul 5 07:45:10 2025 +0200

    vcl: No longer use css::awt::XEventHandler
    
    Instead of using the css::awt::XEventHandler UNO interface
    for vcl-internal only processing of events (and only used
    in the gen VCL plugin), introduce a new abstract base
    class DisplayEventHandler that initially basically provides
    the same interface, i.e. it starts with the
    same virtual `handleEvent` method as the XEventHandler has,
    but that can be further adjusted as makes sense in
    upcoming commits now.
    
    Change-Id: Iaf08f4aee3fea99d9d5d5c907d107452812d187d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187401
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/displayconnectiondispatch.hxx 
b/vcl/inc/displayconnectiondispatch.hxx
index 6c094b86ea07..8044b6d410ce 100644
--- a/vcl/inc/displayconnectiondispatch.hxx
+++ b/vcl/inc/displayconnectiondispatch.hxx
@@ -20,20 +20,25 @@
 #pragma once
 
 #include <sal/config.h>
-#include <cppuhelper/weak.hxx>
-#include <com/sun/star/awt/XEventHandler.hpp>
+#include <cppuhelper/implbase.hxx>
 #include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
 #include <vcl/dllapi.h>
 #include <mutex>
 #include <vector>
 
 namespace vcl {
 
+class DisplayEventHandler : public cppu::WeakImplHelper<>
+{
+public:
+    virtual bool handleEvent(const ::css::uno::Any& rEvent) = 0;
+};
+
 class VCL_DLLPUBLIC DisplayConnectionDispatch final : public cppu::OWeakObject
 {
     std::mutex                      m_aMutex;
-    ::std::vector< css::uno::Reference< css::awt::XEventHandler > >
-                                    m_aHandlers;
+    std::vector<rtl::Reference<DisplayEventHandler>> m_aHandlers;
     OUString                        m_ConnectionIdentifier;
 public:
     DisplayConnectionDispatch();
@@ -44,8 +49,8 @@ public:
 
     bool dispatchEvent( void const * pData, int nBytes );
 
-    void addEventHandler(const css::uno::Reference<css::awt::XEventHandler>& 
handler);
-    void removeEventHandler(const 
css::uno::Reference<css::awt::XEventHandler>& handler);
+    void addEventHandler(const rtl::Reference<DisplayEventHandler>& handler);
+    void removeEventHandler(const rtl::Reference<DisplayEventHandler>& 
handler);
     OUString getIdentifier();
 };
 
diff --git a/vcl/source/helper/displayconnectiondispatch.cxx 
b/vcl/source/helper/displayconnectiondispatch.cxx
index 45bd5acaa6f7..f7b8692b07a9 100644
--- a/vcl/source/helper/displayconnectiondispatch.cxx
+++ b/vcl/source/helper/displayconnectiondispatch.cxx
@@ -57,12 +57,12 @@ void DisplayConnectionDispatch::terminate()
 
     std::scoped_lock aGuard( m_aMutex );
     Any aEvent;
-    std::vector< css::uno::Reference< XEventHandler > > aLocalList( 
m_aHandlers );
+    std::vector<rtl::Reference<DisplayEventHandler>> aLocalList(m_aHandlers);
     for (auto const& elem : aLocalList)
         elem->handleEvent( aEvent );
 }
 
-void DisplayConnectionDispatch::addEventHandler(const 
css::uno::Reference<XEventHandler>& handler)
+void DisplayConnectionDispatch::addEventHandler(const 
rtl::Reference<DisplayEventHandler>& handler)
 {
     std::scoped_lock aGuard( m_aMutex );
 
@@ -70,7 +70,7 @@ void DisplayConnectionDispatch::addEventHandler(const 
css::uno::Reference<XEvent
 }
 
 void DisplayConnectionDispatch::removeEventHandler(
-    const css::uno::Reference<XEventHandler>& handler)
+    const rtl::Reference<DisplayEventHandler>& handler)
 {
     std::scoped_lock aGuard( m_aMutex );
 
@@ -89,7 +89,7 @@ bool DisplayConnectionDispatch::dispatchEvent( void const * 
pData, int nBytes )
     Sequence< sal_Int8 > aSeq( static_cast<const sal_Int8*>(pData), nBytes );
     Any aEvent;
     aEvent <<= aSeq;
-    ::std::vector< css::uno::Reference< XEventHandler > > handlers;
+    std::vector<rtl::Reference<DisplayEventHandler>> handlers;
     {
         std::scoped_lock aGuard( m_aMutex );
         handlers = m_aHandlers;
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index 75939e81fdb7..0134cd006fbd 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -3865,7 +3865,7 @@ void SelectionManager::shutdown() noexcept
     m_xDropTransferable.clear();
 }
 
-sal_Bool SelectionManager::handleEvent(const Any& event)
+bool SelectionManager::handleEvent(const Any& event)
 {
     Sequence< sal_Int8 > aSeq;
     if( event >>= aSeq )
diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx 
b/vcl/unx/generic/dtrans/X11_selection.hxx
index fce985440ce9..03ad481b7116 100644
--- a/vcl/unx/generic/dtrans/X11_selection.hxx
+++ b/vcl/unx/generic/dtrans/X11_selection.hxx
@@ -134,13 +134,10 @@ namespace x11 {
 
     };
 
-    class SelectionManager :
-        public ::cppu::WeakImplHelper<
-            css::datatransfer::dnd::XDragSource,
-            css::awt::XEventHandler,
-            css::frame::XTerminateListener
-        >,
-        public SelectionAdaptor
+    class SelectionManager : public 
cppu::ImplInheritanceHelper<vcl::DisplayEventHandler,
+                                                                
css::datatransfer::dnd::XDragSource,
+                                                                
css::frame::XTerminateListener>,
+                             public SelectionAdaptor
     {
         static std::unordered_map< OUString, SelectionManager* >& 
getInstances();
 
@@ -445,8 +442,7 @@ namespace x11 {
 
         void initialize();
 
-        // XEventHandler
-        virtual sal_Bool    SAL_CALL handleEvent(const css::uno::Any& event) 
override;
+        virtual bool handleEvent(const css::uno::Any& event) override;
 
         // XDragSource
         virtual sal_Bool    SAL_CALL isDragImageSupported() override;
commit 3bf95c8e11504982cf102777d0b34faf1445fdf4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 4 13:08:31 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Jul 5 07:45:03 2025 +0200

    vcl: No longer wrap OUString in Any
    
    No longer needed after
    
        Change-Id: Ie500521a3e26ce926ab3521fb6ce1485ab22f768
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Jul 4 11:16:24 2025 +0200
    
            vcl: Stop implementing XDisplayConnection
    
    Change-Id: I920b1f92469fcd7255682abc1806fa9eb907b546
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187390
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/displayconnectiondispatch.hxx 
b/vcl/inc/displayconnectiondispatch.hxx
index be957060064f..6c094b86ea07 100644
--- a/vcl/inc/displayconnectiondispatch.hxx
+++ b/vcl/inc/displayconnectiondispatch.hxx
@@ -46,7 +46,7 @@ public:
 
     void addEventHandler(const css::uno::Reference<css::awt::XEventHandler>& 
handler);
     void removeEventHandler(const 
css::uno::Reference<css::awt::XEventHandler>& handler);
-    css::uno::Any getIdentifier();
+    OUString getIdentifier();
 };
 
 }
diff --git a/vcl/source/helper/displayconnectiondispatch.cxx 
b/vcl/source/helper/displayconnectiondispatch.cxx
index 84499ff05367..45bd5acaa6f7 100644
--- a/vcl/source/helper/displayconnectiondispatch.cxx
+++ b/vcl/source/helper/displayconnectiondispatch.cxx
@@ -77,9 +77,9 @@ void DisplayConnectionDispatch::removeEventHandler(
     std::erase(m_aHandlers, handler);
 }
 
-Any DisplayConnectionDispatch::getIdentifier()
+OUString DisplayConnectionDispatch::getIdentifier()
 {
-    return Any(m_ConnectionIdentifier);
+    return m_ConnectionIdentifier;
 }
 
 bool DisplayConnectionDispatch::dispatchEvent( void const * pData, int nBytes )
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index cfe322deeb37..75939e81fdb7 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -344,10 +344,7 @@ void SelectionManager::initialize()
 
     OUString aUDisplay;
     if( m_xDisplayConnection.is() )
-    {
-        Any aIdentifier = m_xDisplayConnection->getIdentifier();
-        aIdentifier >>= aUDisplay;
-    }
+        aUDisplay = m_xDisplayConnection->getIdentifier();
 
     OString aDisplayName( OUStringToOString( aUDisplay, 
RTL_TEXTENCODING_ISO_8859_1 ) );
 
commit 8aa9942cdfd40e84b6c00f9223ca7f933cff3720
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 4 13:05:24 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Jul 5 07:44:56 2025 +0200

    vcl: Drop unused DisplayConnectionDispatch params
    
    Now that these unused params are no longer needed to
    satisfy the XDisplayConnection interface after
    
        Change-Id: Ie500521a3e26ce926ab3521fb6ce1485ab22f768
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Jul 4 11:16:24 2025 +0200
    
            vcl: Stop implementing XDisplayConnection
    
    , drop them altogether.
    
    Change-Id: I1f98c322d44e8697f461a701e722d935122b92c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187389
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/displayconnectiondispatch.hxx 
b/vcl/inc/displayconnectiondispatch.hxx
index 772aab328650..be957060064f 100644
--- a/vcl/inc/displayconnectiondispatch.hxx
+++ b/vcl/inc/displayconnectiondispatch.hxx
@@ -44,8 +44,8 @@ public:
 
     bool dispatchEvent( void const * pData, int nBytes );
 
-    void addEventHandler( const css::uno::Any& window, const 
css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask );
-    void removeEventHandler( const css::uno::Any& window, const 
css::uno::Reference< css::awt::XEventHandler >& handler );
+    void addEventHandler(const css::uno::Reference<css::awt::XEventHandler>& 
handler);
+    void removeEventHandler(const 
css::uno::Reference<css::awt::XEventHandler>& handler);
     css::uno::Any getIdentifier();
 };
 
diff --git a/vcl/source/helper/displayconnectiondispatch.cxx 
b/vcl/source/helper/displayconnectiondispatch.cxx
index d21ecd859fb0..84499ff05367 100644
--- a/vcl/source/helper/displayconnectiondispatch.cxx
+++ b/vcl/source/helper/displayconnectiondispatch.cxx
@@ -62,14 +62,15 @@ void DisplayConnectionDispatch::terminate()
         elem->handleEvent( aEvent );
 }
 
-void DisplayConnectionDispatch::addEventHandler( const Any& /*window*/, const 
css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ )
+void DisplayConnectionDispatch::addEventHandler(const 
css::uno::Reference<XEventHandler>& handler)
 {
     std::scoped_lock aGuard( m_aMutex );
 
     m_aHandlers.push_back( handler );
 }
 
-void DisplayConnectionDispatch::removeEventHandler( const Any& /*window*/, 
const css::uno::Reference< XEventHandler >& handler )
+void DisplayConnectionDispatch::removeEventHandler(
+    const css::uno::Reference<XEventHandler>& handler)
 {
     std::scoped_lock aGuard( m_aMutex );
 
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index 9169c373ea13..cfe322deeb37 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -336,7 +336,7 @@ void SelectionManager::initialize()
          */
         m_xDisplayConnection = Application::GetDisplayConnection();
         assert(m_xDisplayConnection.is());
-        m_xDisplayConnection->addEventHandler(Any(), this, ~0);
+        m_xDisplayConnection->addEventHandler(this);
     }
 
     if( m_pDisplay )
@@ -3826,7 +3826,7 @@ void SelectionManager::shutdown() noexcept
         m_xDesktop->removeTerminateListener(this);
 
     if( m_xDisplayConnection.is() )
-        m_xDisplayConnection->removeEventHandler(Any(), this);
+        m_xDisplayConnection->removeEventHandler(this);
 
     // stop dispatching
     if( m_aThread )

Reply via email to