diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-12-13 10:56:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-12-13 20:35:42 +0000 |
commit | 0084e5e9bb7c64a34ac73698cf35de61bd0c9c7d (patch) | |
tree | 9e64e7883e7bb2eeb1901c2bb7b3509e07908944 | |
parent | d649a11e9e471f44ce24eb28aea69335284553cd (diff) |
check for env variable of headless plugin in desktop detect
-rw-r--r-- | vcl/unx/source/desktopdetect/desktopdetector.cxx | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/vcl/unx/source/desktopdetect/desktopdetector.cxx b/vcl/unx/source/desktopdetect/desktopdetector.cxx index dce25af71ca9..3d2fb95866fc 100644 --- a/vcl/unx/source/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/source/desktopdetect/desktopdetector.cxx @@ -42,6 +42,7 @@ #include "osl/thread.h" #include <unistd.h> +#include <string.h> using namespace rtl; @@ -279,23 +280,31 @@ VCL_DLLPUBLIC rtl::OUString get_desktop_environment() { // get display to connect to const char* pDisplayStr = getenv( "DISPLAY" ); - int nParams = osl_getCommandArgCount(); - OUString aParam; - OString aBParm; - for( int i = 0; i < nParams; i++ ) + + const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" ); + + if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0)) + pDisplayStr = NULL; + else { - osl_getCommandArg( i, &aParam.pData ); - if( aParam.equalsAscii( "-headless" ) ) - { - pDisplayStr = NULL; - break; - } - if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) + int nParams = osl_getCommandArgCount(); + OUString aParam; + OString aBParm; + for( int i = 0; i < nParams; i++ ) { - osl_getCommandArg( i+1, &aParam.pData ); - aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); - pDisplayStr = aBParm.getStr(); - break; + osl_getCommandArg( i, &aParam.pData ); + if( aParam.equalsAscii( "-headless" ) ) + { + pDisplayStr = NULL; + break; + } + if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) ) + { + osl_getCommandArg( i+1, &aParam.pData ); + aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() ); + pDisplayStr = aBParm.getStr(); + break; + } } } |