vcl/source/window/window.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 35208d62e32ee0a7aeacfe2f577b68c9dcb40671
Author: Noel Power <noel.po...@suse.com>
Date:   Tue Jul 9 13:58:19 2013 +0100

    fix for fdo#66718, access correct clipboard
    
    Changes to use SystemClipboard::createUnix break some subtle behaviour
    ( or is it even misbehaviour ) that users of the service
    "com.sun.star.datatransfer.clipboard.SystemClipboard" depend on.
    When creating the SystemClipboard the arguments passed to
    X11SalInstance::CreateClipboard(...) are used to access cached
    instances. Previously the window clipboard was created with 'no'
    params and then initialised ( via XInitialisation ) later
    This ensured users creating the "css.datatransfer.clipboard.SystemClipboard"
    with no paramaters immediately get that same clipboard. Note: creating
    the SystemClipboard with no param seesm a sensible thing from an scripters
    point of view as the params that would be required to match the correct
    Clipboard seem rather difficult to access in an uno only world
    
    Change-Id: Ib71d6744086d354025de4db62039b9a98f230eca
    (cherry picked from commit 942501b6e49c6c9e19556d9ec132a458e5fef6c3)
    Reviewed-on: https://gerrit.libreoffice.org/4784
    Reviewed-by: Petr Mladek <pmla...@suse.cz>
    Tested-by: Petr Mladek <pmla...@suse.cz>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 1018bb8..2c31c79 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8435,11 +8435,19 @@ uno::Reference< XClipboard > Window::GetClipboard()
             try
             {
                 uno::Reference< XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
-                Reference<XSystemClipboard> xSystemClipboard;
+                Reference<XSystemClipboard> xSystemClipboard = 
SystemClipboard::createDefault(xContext);
 #if defined(UNX) && !defined(MACOSX)          // unix clipboard needs to be 
initialized
-                xSystemClipboard = SystemClipboard::createUnix( xContext, 
Application::GetDisplayConnection(), "CLIPBOARD", vcl::createBmpConverter() );
-#else
-                xSystemClipboard = SystemClipboard::createDefault(xContext);
+                uno::Reference< XInitialization > xInit = uno::Reference< 
XInitialization >( xSystemClipboard, UNO_QUERY );
+
+                if( xInit.is() )
+                {
+                    Sequence< Any > aArgumentList( 3 );
+                    aArgumentList[ 0 ] = makeAny( 
Application::GetDisplayConnection() );
+                    aArgumentList[ 1 ] = makeAny( OUString("CLIPBOARD") );
+                    aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
+
+                    xInit->initialize( aArgumentList );
+                }
 #endif
                 mpWindowImpl->mpFrameData->mxClipboard.set( xSystemClipboard, 
UNO_QUERY );
             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to