vcl/unx/generic/dtrans/X11_droptarget.cxx |   11 +----------
 vcl/unx/generic/dtrans/X11_selection.cxx  |   25 +++++--------------------
 vcl/unx/generic/dtrans/X11_selection.hxx  |    2 +-
 3 files changed, 7 insertions(+), 31 deletions(-)

New commits:
commit 0a0637b2affa0ae9ee735f9961feef8c706de976
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri May 9 13:34:22 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat May 10 17:31:33 2025 +0200

    gen: Drop always default SelectionManager::get param
    
    Since
    
        Change-Id: Ibc1b6637e3def37f96ab074bde7fe40b60e330c3
        Author: Michael Weghorn <[email protected]>
        Date:   Fri May 9 13:27:32 2025 +0200
    
            gen: Drop complexity as string is always empty anyway
    
    , there's no more caller explicitly passing a value
    for the `rDisplayName` param, so drop it altogether.
    
    Change-Id: Idbe2376effc5073f6c18962a67cdd695cd796c86
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185105
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index c4b0b6c5cc91..826e8fb96489 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -667,15 +667,13 @@ bool SelectionManager::convertData(
     return bSuccess;
 }
 
-SelectionManager& SelectionManager::get( const OUString& rDisplayName )
+SelectionManager& SelectionManager::get()
 {
     osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() );
 
-    OUString aDisplayName( rDisplayName );
-    if( aDisplayName.isEmpty() )
-        if (auto const env = getenv( "DISPLAY" )) {
-            aDisplayName = OStringToOUString( env, RTL_TEXTENCODING_ISO_8859_1 
);
-        }
+    OUString aDisplayName;
+    if (auto const env = getenv( "DISPLAY" ))
+        aDisplayName = OStringToOUString( env, RTL_TEXTENCODING_ISO_8859_1 );
     SelectionManager* pInstance = nullptr;
 
     std::unordered_map< OUString, SelectionManager* >::iterator it = 
getInstances().find( aDisplayName );
diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx 
b/vcl/unx/generic/dtrans/X11_selection.hxx
index ed94663b889a..ea7ac20c9479 100644
--- a/vcl/unx/generic/dtrans/X11_selection.hxx
+++ b/vcl/unx/generic/dtrans/X11_selection.hxx
@@ -413,7 +413,7 @@ namespace x11 {
         sal_Int8 getUserDragAction() const;
         sal_Int32 getSelectionTimeout();
     public:
-        static SelectionManager& get( const OUString& rDisplayName = 
OUString() );
+        static SelectionManager& get();
 
         Display * getDisplay() { return m_pDisplay; };
 
commit 877e0198101fcf79e8c74b86ff339e4b6f11c7bb
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri May 9 13:27:32 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat May 10 17:31:21 2025 +0200

    gen: Drop complexity as string is always empty anyway
    
    While this does interesting checks for the first arg,
    `aDisplayName` will always be an empty string as
    an empty/default-constructed Any is used when assigning a
    value using `operator>>=`.
    
    Therefore, drop the extra logic that doesn't
    have any effect, and go with the default param of
    an empty OUString for SelectionManager::get.
    
    Change-Id: Ibc1b6637e3def37f96ab074bde7fe40b60e330c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185104
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/generic/dtrans/X11_droptarget.cxx 
b/vcl/unx/generic/dtrans/X11_droptarget.cxx
index 9933d490a886..0c0b8e99d869 100644
--- a/vcl/unx/generic/dtrans/X11_droptarget.cxx
+++ b/vcl/unx/generic/dtrans/X11_droptarget.cxx
@@ -50,16 +50,7 @@ void DropTarget::initialize( const Sequence< Any >& 
arguments )
     if( arguments.getLength() <= 1 )
         return;
 
-    OUString aDisplayName;
-    Reference< XDisplayConnection > xConn;
-    arguments.getConstArray()[0] >>= xConn;
-    if( xConn.is() )
-    {
-        Any aIdentifier;
-        aIdentifier >>= aDisplayName;
-    }
-
-    m_xSelectionManager = &SelectionManager::get( aDisplayName );
+    m_xSelectionManager = &SelectionManager::get();
     m_xSelectionManager->initialize( arguments );
 
     if( m_xSelectionManager->getDisplay() ) // #136582# sanity check
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index e802f70da07e..c4b0b6c5cc91 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -4092,20 +4092,7 @@ SelectionManagerHolder::~SelectionManagerHolder()
 
 void SelectionManagerHolder::initialize( const Sequence< Any >& arguments )
 {
-    OUString aDisplayName;
-
-    if( arguments.hasElements() )
-    {
-        css::uno::Reference< XDisplayConnection > xConn;
-        arguments.getConstArray()[0] >>= xConn;
-        if( xConn.is() )
-        {
-            Any aIdentifier;
-            aIdentifier >>= aDisplayName;
-        }
-    }
-
-    SelectionManager& rManager = SelectionManager::get( aDisplayName );
+    SelectionManager& rManager = SelectionManager::get();
     rManager.initialize( arguments );
     m_xRealDragSource = &rManager;
 }

Reply via email to