summaryrefslogtreecommitdiff
path: root/dtrans
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-08-11 16:42:15 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-08-11 16:42:15 +0000
commit26bdcd04e32867432a382d1ba116203c9896be03 (patch)
tree389b8cfd6d1acc2ab2cbc29e5ece50257982e7fb /dtrans
parent83bfe106d9b993b72c01712120498036103d9f04 (diff)
INTEGRATION: CWS svp01 (1.77.12); FILE MERGED
2006/07/25 10:06:36 pl 1.77.12.3: RESYNC: (1.78-1.79); FILE MERGED 2006/06/27 11:41:34 pl 1.77.12.2: RESYNC: (1.77-1.78); FILE MERGED 2006/06/09 13:52:10 pl 1.77.12.1: #135265# do not open an X connection in headless case
Diffstat (limited to 'dtrans')
-rw-r--r--dtrans/source/X11/X11_selection.cxx32
1 files changed, 26 insertions, 6 deletions
diff --git a/dtrans/source/X11/X11_selection.cxx b/dtrans/source/X11/X11_selection.cxx
index 1b1e882cb73e..a47ba580cd34 100644
--- a/dtrans/source/X11/X11_selection.cxx
+++ b/dtrans/source/X11/X11_selection.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: X11_selection.cxx,v $
*
- * $Revision: 1.79 $
+ * $Revision: 1.80 $
*
- * last change: $Author: obo $ $Date: 2006-07-10 16:31:52 $
+ * last change: $Author: hr $ $Date: 2006-08-11 17:42:15 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -80,6 +80,9 @@
#ifndef _RTL_TENCINFO_H
#include <rtl/tencinfo.h>
#endif
+#ifndef OSL_PROCESS_H
+#include <osl/process.h>
+#endif
#define DRAG_EVENT_MASK ButtonPressMask |\
ButtonReleaseMask |\
@@ -349,7 +352,20 @@ void SelectionManager::initialize( const Sequence< Any >& arguments ) throw (::c
arguments.getConstArray()[2] >>= m_xBitmapConverter;
}
- if( ! m_pDisplay )
+ int nParams = osl_getCommandArgCount();
+ OUString aParam;
+ bool bIsHeadless = false;
+ for( int i = 0; i < nParams; i++ )
+ {
+ osl_getCommandArg( i, &aParam.pData );
+ if( aParam.equalsAscii( "-headless" ) )
+ {
+ bIsHeadless = true;
+ break;
+ }
+ }
+
+ if( ! m_pDisplay && ! bIsHeadless )
{
OUString aUDisplay;
if( m_xDisplayConnection.is() )
@@ -711,7 +727,7 @@ const OUString& SelectionManager::getString( Atom aAtom )
if( ( it = m_aAtomToString.find( aAtom ) ) == m_aAtomToString.end() )
{
static OUString aEmpty;
- char* pAtom = XGetAtomName( m_pDisplay, aAtom );
+ char* pAtom = m_pDisplay ? XGetAtomName( m_pDisplay, aAtom ) : NULL;
if( ! pAtom )
return aEmpty;
OUString aString( OStringToOUString( pAtom, RTL_TEXTENCODING_ISO_8859_1 ) );
@@ -731,7 +747,8 @@ Atom SelectionManager::getAtom( const OUString& rString )
::std::hash_map< OUString, Atom, OUStringHash >::const_iterator it;
if( ( it = m_aStringToAtom.find( rString ) ) == m_aStringToAtom.end() )
{
- Atom aAtom = XInternAtom( m_pDisplay, OUStringToOString( rString, RTL_TEXTENCODING_ISO_8859_1 ), False );
+ static Atom nNoDisplayAtoms = 1;
+ Atom aAtom = m_pDisplay ? XInternAtom( m_pDisplay, OUStringToOString( rString, RTL_TEXTENCODING_ISO_8859_1 ), False ) : nNoDisplayAtoms++;
m_aStringToAtom[ rString ] = aAtom;
m_aAtomToString[ aAtom ] = rString;
}
@@ -900,6 +917,9 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
{
MutexGuard aGuard(m_aMutex);
+ if( ! m_pDisplay )
+ return false;
+
it = m_aSelections.find( selection );
if( it == m_aSelections.end() )
return false;
@@ -3800,7 +3820,7 @@ void SelectionManager::registerDropTarget( Window aWindow, DropTarget* pTarget )
m_aDropTargets.find( aWindow );
if( it != m_aDropTargets.end() )
OSL_ASSERT( "attempt to register window as drop target twice" );
- else if( aWindow )
+ else if( aWindow && m_pDisplay )
{
XSelectInput( m_pDisplay, aWindow, PropertyChangeMask );