summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/app/saldisp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/generic/app/saldisp.cxx')
-rw-r--r--vcl/unx/generic/app/saldisp.cxx120
1 files changed, 0 insertions, 120 deletions
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 75882cc21b31..aec8b53920d6 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -227,122 +227,6 @@ static sal_Bool sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI
}
// ---------------------------------------------------------------------------
-
-// check wether displaystring is in format N.M or N. or just N
-// with N and M beeing natural numbers
-static sal_Bool
-sal_IsDisplayNumber( const char *pDisplayString )
-{
- if ( ! isdigit(*pDisplayString) )
- return sal_False;
- while ( isdigit(*(++pDisplayString)) )
- ; /* do nothing */
-
- if ( *pDisplayString == '.' )
- {
- while ( isdigit(*(++pDisplayString)) )
- ; /* do nothing */
- }
-
- return (*pDisplayString == '\0');
-}
-
-// check whether host1 and host2 point to the same ip address
-static sal_Bool
-sal_EqualHosts( const OUString& Host1, const OUString& Host2)
-{
- oslSocketAddr pHostAddr1;
- oslSocketAddr pHostAddr2;
- sal_Bool bEqualAddress = sal_False;
-
- if ( Host1.toChar() >= '0' && Host1.toChar() <= '9' )
- pHostAddr1 = osl_createInetSocketAddr( Host1.pData, 0 );
- else
- pHostAddr1 = osl_resolveHostname( Host1.pData );
-
- if ( Host2.toChar() >= '0' && Host2.toChar() <= '9' )
- pHostAddr2 = osl_createInetSocketAddr( Host2.pData, 0 );
- else
- pHostAddr2 = osl_resolveHostname( Host2.pData );
-
- if( pHostAddr1 && pHostAddr2 )
- bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? sal_True : sal_False;
-
- if( pHostAddr1 )
- osl_destroySocketAddr( pHostAddr1 );
- if( pHostAddr2 )
- osl_destroySocketAddr( pHostAddr2 );
-
- return bEqualAddress;
-}
-
-static sal_Bool
-sal_IsLocalDisplay( Display *pDisplay )
-{
- const char *pDisplayString = DisplayString( pDisplay );
-
- // no string, no idea
- if ( pDisplayString == NULL || pDisplayString[ 0 ] == '\0')
- return sal_False;
-
- // check for ":x.y"
- if ( pDisplayString[ 0 ] == ':' )
- return sal_IsDisplayNumber( pDisplayString + 1 );
-
- // check for fixed token which all mean localhost:x.y
- const char pLocal[] = "localhost:";
- const int nLocalLen = sizeof(pLocal) - 1;
- if ( strncmp(pDisplayString, pLocal, nLocalLen) == 0 )
- return sal_IsDisplayNumber( pDisplayString + nLocalLen );
-
- const char pUnix[] = "unix:";
- const int nUnixLen = sizeof(pUnix) - 1;
- if ( strncmp(pDisplayString, pUnix, nUnixLen) == 0 )
- return sal_IsDisplayNumber( pDisplayString + nUnixLen );
-
- const char pLoopback[] = "127.0.0.1:";
- const int nLoopbackLen= sizeof(pLoopback) - 1;
- if ( strncmp(pDisplayString, pLoopback, nLoopbackLen) == 0 )
- return sal_IsDisplayNumber( pDisplayString + nLoopbackLen );
-
- // compare local hostname to displaystring, both may be ip address or
- // hostname
- sal_Bool bEqual = sal_False;
- char *pDisplayHost = strdup( pDisplayString );
- char *pPtr = strrchr( pDisplayHost, ':' );
-
- if( pPtr != NULL )
- {
- const OUString& rLocalHostname( GetGenericData()->GetHostname() );
- if( rLocalHostname.getLength() )
- {
- *pPtr = '\0';
- OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() );
- bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname );
- bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 );
- }
- }
- free( pDisplayHost );
-
- return bEqual;
-}
-
-// ---------------------------------------------------------------------------
-// IsLocal means soffice is running on the same host as the xserver
-// since it is not called very often and sal_IsLocalDisplay() is relative
-// expensive bLocal_ is initialized on first call
-
-sal_Bool SalDisplay::IsLocal()
-{
- if ( ! mbLocalIsValid )
- {
- bLocal_ = sal_IsLocalDisplay( pDisp_ );
- mbLocalIsValid = sal_True;
- }
- return (sal_Bool)bLocal_;
-}
-
-// ---------------------------------------------------------------------------
extern "C" srv_vendor_t
sal_GetServerVendor( Display *p_display )
{
@@ -812,10 +696,6 @@ void SalDisplay::Init()
SetServerVendor();
X11SalBitmap::ImplCreateCache();
- bLocal_ = sal_False; /* dont care, initialize later by
- calling SalDisplay::IsLocal() */
- mbLocalIsValid = sal_False; /* bLocal_ is not yet initialized */
-
// - - - - - - - - - - Synchronize - - - - - - - - - - - - -
if( getenv( "SAL_SYNCHRONIZE" ) )
XSynchronize( pDisp_, True );