diff options
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/desktopdetect/desktopdetector.cxx | 60 | ||||
-rw-r--r-- | vcl/unx/generic/plugadapt/salplug.cxx | 16 |
2 files changed, 72 insertions, 4 deletions
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index f69f2dee6491..68b3b711dd82 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -145,6 +145,47 @@ extern "C" typedef int(* XErrorHandler)(Display*,XErrorEvent*); } +static int TDEVersion( Display* pDisplay ) +{ + int nRet = 0; + + Atom nFullSession = XInternAtom( pDisplay, "TDE_FULL_SESSION", True ); + Atom nTDEVersion = XInternAtom( pDisplay, "TDE_SESSION_VERSION", True ); + + if( nFullSession ) + { + if( !nTDEVersion ) + return 14; + + Atom aRealType = None; + int nFormat = 8; + unsigned long nItems = 0; + unsigned long nBytesLeft = 0; + unsigned char* pProperty = NULL; + XGetWindowProperty( pDisplay, + DefaultRootWindow( pDisplay ), + nTDEVersion, + 0, 1, + False, + AnyPropertyType, + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ); + if( !WasXError() && nItems != 0 && pProperty ) + { + nRet = *reinterpret_cast< sal_Int32* >( pProperty ); + } + if( pProperty ) + { + XFree( pProperty ); + pProperty = NULL; + } + } + return nRet; +} + static int KDEVersion( Display* pDisplay ) { int nRet = 0; @@ -186,6 +227,19 @@ static int KDEVersion( Display* pDisplay ) return nRet; } +static bool is_tde_desktop( Display* pDisplay ) +{ + if ( NULL != getenv( "TDE_FULL_SESSION" ) ) + { + return true; // TDE + } + + if ( TDEVersion( pDisplay ) >= 14 ) + return true; + + return false; +} + static bool is_kde_desktop( Display* pDisplay ) { if ( NULL != getenv( "KDE_FULL_SESSION" ) ) @@ -237,6 +291,8 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() { OString aOver( pOverride ); + if ( aOver.equalsIgnoreAsciiCase( "tde" ) ) + return DESKTOP_TDE; if ( aOver.equalsIgnoreAsciiCase( "kde4" ) ) return DESKTOP_KDE4; if ( aOver.equalsIgnoreAsciiCase( "gnome" ) ) @@ -295,7 +351,9 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler ); - if ( is_kde4_desktop( pDisplay ) ) + if ( is_tde_desktop( pDisplay ) ) + ret = DESKTOP_TDE; + else if ( is_kde4_desktop( pDisplay ) ) ret = DESKTOP_KDE4; else if ( is_gnome_desktop( pDisplay ) ) ret = DESKTOP_GNOME; diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index d2400d7f857b..ab19d345251f 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -98,7 +98,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals * #i109007# KDE3 seems to have the same problem. * And same applies for KDE4. */ - if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "kde" || rModuleBase == "kde4" ) + if( rModuleBase == "gtk" || rModuleBase == "gtk3" || rModuleBase == "tde" || rModuleBase == "kde" || rModuleBase == "kde4" ) { pCloseModule = NULL; } @@ -159,6 +159,11 @@ static DesktopType get_desktop_environment() static SalInstance* autodetect_plugin() { + static const char* pTDEFallbackList[] = + { + "tde", "kde4", "kde", "gtk3", "gtk", "gen", 0 + }; + static const char* pKDEFallbackList[] = { "kde4", "kde", "gtk3", "gtk", "gen", 0 @@ -183,6 +188,11 @@ static SalInstance* autodetect_plugin() pList = pHeadlessFallbackList; else if ( desktop == DESKTOP_GNOME ) pList = pStandardFallbackList; + else if( desktop == DESKTOP_TDE ) + { + pList = pTDEFallbackList; + nListEntry = 1; + } else if( desktop == DESKTOP_KDE ) { pList = pKDEFallbackList; @@ -236,7 +246,7 @@ SalInstance *CreateSalInstance() pInst = autodetect_plugin(); // fallback, try everything - const char* pPlugin[] = { "gtk3", "gtk", "kde4", "kde", "gen", 0 }; + const char* pPlugin[] = { "gtk3", "gtk", "tde", "kde4", "kde", "gen", 0 }; for ( int i = 0; !pInst && pPlugin[ i ]; ++i ) pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) ); @@ -291,7 +301,7 @@ void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore ) _exit(1); } -static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4" }; +static const char * desktop_strings[] = { "none", "unknown", "GNOME", "TDE", "KDE", "KDE4" }; const OUString& SalGetDesktopEnvironment() { |