summaryrefslogtreecommitdiff
path: root/vcl/unx/source/desktopdetect/desktopdetector.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/source/desktopdetect/desktopdetector.cxx')
-rw-r--r--vcl/unx/source/desktopdetect/desktopdetector.cxx46
1 files changed, 23 insertions, 23 deletions
diff --git a/vcl/unx/source/desktopdetect/desktopdetector.cxx b/vcl/unx/source/desktopdetect/desktopdetector.cxx
index dce25af71ca9..20468e71c36c 100644
--- a/vcl/unx/source/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/source/desktopdetect/desktopdetector.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -59,13 +59,13 @@ static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KD
static bool is_gnome_desktop( Display* pDisplay )
{
bool ret = false;
-
+
// warning: these checks are coincidental, GNOME does not
// explicitly advertise itself
-
+
if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) )
ret = true;
-
+
if( ! ret )
{
Atom nAtom1 = XInternAtom( pDisplay, "GNOME_SM_PROXY", True );
@@ -86,11 +86,11 @@ static bool is_gnome_desktop( Display* pDisplay )
}
}
}
-
+
if( ! ret )
{
- Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True );
- Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True );
+ Atom nUTFAtom = XInternAtom( pDisplay, "UTF8_STRING", True );
+ Atom nNetWMNameAtom = XInternAtom( pDisplay, "_NET_WM_NAME", True );
if( nUTFAtom && nNetWMNameAtom )
{
// another, more expensive check: search for a gnome-panel
@@ -150,7 +150,7 @@ extern "C"
bWasXError = true;
return 0;
}
-
+
typedef int(* XErrorHandler)(Display*,XErrorEvent*);
}
@@ -166,11 +166,11 @@ static int KDEVersion( Display* pDisplay )
if( !nKDEVersion )
return 3;
- Atom aRealType = None;
- int nFormat = 8;
- unsigned long nItems = 0;
- unsigned long nBytesLeft = 0;
- unsigned char* pProperty = NULL;
+ Atom aRealType = None;
+ int nFormat = 8;
+ unsigned long nItems = 0;
+ unsigned long nBytesLeft = 0;
+ unsigned char* pProperty = NULL;
XGetWindowProperty( pDisplay,
DefaultRootWindow( pDisplay ),
nKDEVersion,
@@ -184,7 +184,7 @@ static int KDEVersion( Display* pDisplay )
&pProperty );
if( !WasXError() && nItems != 0 && pProperty )
{
- nRet = *reinterpret_cast< sal_Int32* >( pProperty );
+ nRet = *reinterpret_cast< sal_Int32* >( pProperty );
}
if( pProperty )
{
@@ -246,23 +246,23 @@ static bool is_cde_desktop( Display* pDisplay )
osl_unloadModule( (oslModule)pLibrary );
return true;
}
-
+
return false;
}
extern "C"
{
-
+
VCL_DLLPUBLIC rtl::OUString get_desktop_environment()
{
rtl::OUStringBuffer aRet( 8 );
static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" );
-
+
if ( pOverride && *pOverride )
{
OString aOver( pOverride );
-
+
if ( aOver.equalsIgnoreAsciiCase( "cde" ) )
aRet.appendAscii( desktop_strings[DESKTOP_CDE] );
if ( aOver.equalsIgnoreAsciiCase( "kde4" ) )
@@ -298,7 +298,7 @@ VCL_DLLPUBLIC rtl::OUString get_desktop_environment()
break;
}
}
-
+
// no server at all
if( ! pDisplayStr || !*pDisplayStr )
aRet.appendAscii( desktop_strings[DESKTOP_NONE] );
@@ -313,12 +313,12 @@ VCL_DLLPUBLIC rtl::OUString get_desktop_environment()
*/
if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
XInitThreads();
-
+
Display* pDisplay = XOpenDisplay( pDisplayStr );
if( pDisplay )
{
XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
-
+
if ( is_kde4_desktop( pDisplay ) )
aRet.appendAscii( desktop_strings[DESKTOP_KDE4] );
else if ( is_gnome_desktop( pDisplay ) )
@@ -329,10 +329,10 @@ VCL_DLLPUBLIC rtl::OUString get_desktop_environment()
aRet.appendAscii( desktop_strings[DESKTOP_KDE] );
else
aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] );
-
+
// set the default handler again
XSetErrorHandler( pOldHdl );
-
+
XCloseDisplay( pDisplay );
}
}