summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-07-11 13:22:02 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-07-11 13:22:33 +0200
commit31144904919cf386f7ef6941a2932bc00497ed13 (patch)
treea95ba552b56453c6565fd534cff8819b8a245286 /vcl
parentb100f3f06be2dd79c8145cdf487901bc5d71b332 (diff)
X11SalInstance::CreateClipboard is only ever used with the default $DISPLAY
Change-Id: Id9a407b9ee4419fc6342931b249eb00e70addfad
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/salinst.h2
-rw-r--r--vcl/source/window/window.cxx9
-rw-r--r--vcl/unx/generic/dtrans/X11_service.cxx52
3 files changed, 21 insertions, 42 deletions
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 3f8d06e1eb24..afe8e8432d98 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -39,7 +39,7 @@ class SalXLib;
class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance
{
private:
- boost::unordered_map< OUString, boost::unordered_map< Atom, com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboard > >, OUStringHash > m_aInstances;
+ boost::unordered_map< Atom, com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboard > > m_aInstances;
protected:
SalXLib *mpXLib;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index dc450e378dd8..2125cda2c56b 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8508,11 +8508,10 @@ uno::Reference< XClipboard > Window::GetPrimarySelection()
uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
#if defined(UNX) && !defined(MACOSX)
- // A hack, making the primary selection available as an instance of
- // the SystemClipboard service on X11:
- css::uno::Sequence<css::uno::Any> args(2);
- args[0] <<= Application::GetDisplayConnection();
- args[1] <<= OUString("PRIMARY");
+ // A hack, making the primary selection available as an instance
+ // of the SystemClipboard service on X11:
+ css::uno::Sequence<css::uno::Any> args(1);
+ args[0] <<= OUString("PRIMARY");
mpWindowImpl->mpFrameData->mxSelection.set(
(xContext->getServiceManager()->
createInstanceWithArgumentsAndContext(
diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx
index 2e8e0cd3e582..59d7e450adee 100644
--- a/vcl/unx/generic/dtrans/X11_service.cxx
+++ b/vcl/unx/generic/dtrans/X11_service.cxx
@@ -61,47 +61,27 @@ Sequence< OUString > SAL_CALL x11::Xdnd_dropTarget_getSupportedServiceNames()
css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
{
- OUString aDisplayName;
- Atom nSelection;
-
- // extract display name from connection argument. An exception is thrown
- // by SelectionManager.initialize() if no display connection is given.
- if( arguments.getLength() > 0 )
- {
- css::uno::Reference< XDisplayConnection > xConn;
- arguments.getConstArray()[0] >>= xConn;
-
- if( xConn.is() )
- {
- Any aIdentifier = xConn->getIdentifier();
- aIdentifier >>= aDisplayName;
- }
+ SelectionManager& rManager = SelectionManager::get();
+ css::uno::Sequence<css::uno::Any> mgrArgs(1);
+ mgrArgs[0] <<= Application::GetDisplayConnection();
+ rManager.initialize(mgrArgs);
+
+ OUString sel;
+ if (arguments.getLength() == 0) {
+ sel = "CLIPBOARD";
+ } else if (arguments.getLength() != 1 || !(arguments[0] >>= sel)) {
+ throw css::lang::IllegalArgumentException(
+ "bad X11SalInstance::CreateClipboard arguments",
+ css::uno::Reference<css::uno::XInterface>(), -1);
}
+ Atom nSelection = rManager.getAtom(sel);
- SelectionManager& rManager = SelectionManager::get( aDisplayName );
- rManager.initialize( arguments );
-
- // check if any other selection than clipboard selection is specified
- if( arguments.getLength() > 1 )
- {
- OUString aSelectionName;
-
- arguments.getConstArray()[1] >>= aSelectionName;
- nSelection = rManager.getAtom( aSelectionName );
- }
- else
- {
- // default atom is clipboard selection
- nSelection = rManager.getAtom( OUString("CLIPBOARD") );
- }
-
- ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >& rMap( m_aInstances[ aDisplayName ] );
- ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = rMap.find( nSelection );
- if( it != rMap.end() )
+ ::boost::unordered_map< Atom, css::uno::Reference< XClipboard > >::iterator it = m_aInstances.find( nSelection );
+ if( it != m_aInstances.end() )
return it->second;
X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection );
- rMap[ nSelection ] = pClipboard;
+ m_aInstances[ nSelection ] = pClipboard;
return static_cast<OWeakObject*>(pClipboard);
}