[Libreoffice-commits] .: 3 commits - vcl/inc vcl/Library_vclplug_kde.mk vcl/unx
Lubos Lunak
llunak at kemper.freedesktop.org
Tue May 31 09:35:03 PDT 2011
vcl/Library_vclplug_kde.mk | 1
vcl/inc/unx/desktops.hxx | 43 ++++++
vcl/inc/unx/kde/kde_headers.h | 98 ++++++++++++++
vcl/unx/generic/desktopdetect/desktopdetector.cxx | 147 ++++++++++------------
vcl/unx/generic/plugadapt/salplug.cxx | 70 ++++------
vcl/unx/inc/kde_headers.h | 98 --------------
vcl/unx/kde/kdedata.cxx | 2
vcl/unx/kde/salnativewidgets-kde.cxx | 2
8 files changed, 243 insertions(+), 218 deletions(-)
New commits:
commit 259afb3f99eece24b9389b68e95c9ff064cdb830
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue May 31 18:27:15 2011 +0200
proper debug output again, enabled by mistake
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index b7eabc5..399dca5 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -182,10 +182,10 @@ static SalInstance* autodetect_plugin()
{
rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) );
pInst = tryInstance( aTry );
-// #if OSL_DEBUG_LEVEL > 1
+ #if OSL_DEBUG_LEVEL > 1
if( pInst )
std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] );
-// #endif
+ #endif
nListEntry++;
}
commit cf02dc1349376b432f2e4b3316bb6083220bd0fe
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue May 31 18:21:40 2011 +0200
move kde_headers.h to other inc/unx/kde headers
diff --git a/vcl/Library_vclplug_kde.mk b/vcl/Library_vclplug_kde.mk
index 3e382b3..efb134d 100644
--- a/vcl/Library_vclplug_kde.mk
+++ b/vcl/Library_vclplug_kde.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Library_set_include,vclplug_kde,\
-I$(SRCDIR)/vcl/inc \
-I$(SRCDIR)/vcl/inc/pch \
-I$(SRCDIR)/solenv/inc \
- -I$(SRCDIR)/vcl/unx/inc \
-I$(OUTDIR)/inc/offuh \
-I$(OUTDIR)/inc \
))
diff --git a/vcl/inc/unx/kde/kde_headers.h b/vcl/inc/unx/kde/kde_headers.h
new file mode 100644
index 0000000..7ec45fd
--- /dev/null
+++ b/vcl/inc/unx/kde/kde_headers.h
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VCL_KDE_HEADERS_H
+#define INCLUDED_VCL_KDE_HEADERS_H
+
+/* ********* Suppress warnings if needed */
+#include "sal/config.h"
+
+#include <cstddef>
+
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+
+/* ********* Hack, but needed because of conflicting types... */
+#define Region QtXRegion
+
+
+/* ********* Qt headers */
+#include <qaccessible.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qfont.h>
+#include <qframe.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qmainwindow.h>
+#include <qmenudata.h>
+#include <qpaintdevice.h>
+#include <qpainter.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qrangecontrol.h>
+#include <qstring.h>
+#include <qtabbar.h>
+#include <qtabwidget.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qwidget.h>
+#include <qprogressbar.h>
+
+/* ********* See hack on top of this file */
+#undef Region
+
+
+/* ********* KDE base headers */
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kemailsettings.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+#include <kprotocolmanager.h>
+#include <kstartupinfo.h>
+#include <kstyle.h>
+
+
+/* ********* KDE address book connectivity headers */
+#include <kabc/addressbook.h>
+#include <kabc/addressee.h>
+#include <kabc/field.h>
+#include <kabc/stdaddressbook.h>
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h
deleted file mode 100644
index 797a12f..0000000
--- a/vcl/unx/inc/kde_headers.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_VCL_KDE_HEADERS_H
-#define INCLUDED_VCL_KDE_HEADERS_H
-
-/* ********* Suppress warnings if needed */
-#include "sal/config.h"
-
-#include <cstddef>
-
-#if defined __GNUC__
-#pragma GCC system_header
-#endif
-
-
-/* ********* Hack, but needed because of conflicting types... */
-#define Region QtXRegion
-
-
-/* ********* Qt headers */
-#include <qaccessible.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qfont.h>
-#include <qframe.h>
-#include <qlineedit.h>
-#include <qlistview.h>
-#include <qmainwindow.h>
-#include <qmenudata.h>
-#include <qpaintdevice.h>
-#include <qpainter.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qrangecontrol.h>
-#include <qstring.h>
-#include <qtabbar.h>
-#include <qtabwidget.h>
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qwidget.h>
-#include <qprogressbar.h>
-
-/* ********* See hack on top of this file */
-#undef Region
-
-
-/* ********* KDE base headers */
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <kconfig.h>
-#include <kdeversion.h>
-#include <kemailsettings.h>
-#include <kglobal.h>
-#include <kglobalsettings.h>
-#include <klocale.h>
-#include <kmainwindow.h>
-#include <kmenubar.h>
-#include <kprotocolmanager.h>
-#include <kstartupinfo.h>
-#include <kstyle.h>
-
-
-/* ********* KDE address book connectivity headers */
-#include <kabc/addressbook.h>
-#include <kabc/addressee.h>
-#include <kabc/field.h>
-#include <kabc/stdaddressbook.h>
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index 4bd4b95..1bcc039 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -30,7 +30,7 @@
#include "precompiled_vcl.hxx"
#define _SV_SALDATA_CXX
-#include <kde_headers.h>
+#include <unx/kde/kde_headers.h>
#include <unistd.h>
#include <fcntl.h>
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index ddd8f52..8354380 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -30,7 +30,7 @@
#include "precompiled_vcl.hxx"
#define _SV_SALNATIVEWIDGETS_KDE_CXX
-#include <kde_headers.h>
+#include <unx/kde/kde_headers.h>
#include <unx/salunx.h>
#include <unx/saldata.hxx>
commit d93406c72466fdb9113c98640dcc407bd2b1ba7a
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue May 31 18:20:17 2011 +0200
use enum instead of strings for desktop types
welcome to the future! (well, almost)
diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx
new file mode 100644
index 0000000..de4ebb8
--- /dev/null
+++ b/vcl/inc/unx/desktops.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VCL_DESKTOPS_HXX
+#define INCLUDED_VCL_DESKTOPS_HXX
+
+enum DesktopType {
+ DESKTOP_NONE, // headless, i.e. no X connection at all
+ DESKTOP_UNKNOWN, // unknown desktop, simple WM, etc.
+ DESKTOP_GNOME,
+ DESKTOP_KDE,
+ DESKTOP_KDE4,
+ DESKTOP_CDE
+}; // keep in sync with desktop_strings[] in salplug.cxx
+
+#endif // INCLUDED_VCL_DESKTOPS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index 07e6000..ed755fa 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -30,6 +30,7 @@
#include "precompiled_vcl.hxx"
#include <unx/svunx.h>
+#include <unx/desktops.hxx>
#include <tools/prex.h>
#include <X11/Xatom.h>
#include <tools/postx.h>
@@ -46,16 +47,6 @@
using ::rtl::OUString;
using ::rtl::OString;
-enum {
- DESKTOP_NONE = 0,
- DESKTOP_UNKNOWN,
- DESKTOP_GNOME,
- DESKTOP_KDE,
- DESKTOP_KDE4,
- DESKTOP_CDE
-};
-
-static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" };
static bool is_gnome_desktop( Display* pDisplay )
{
@@ -255,9 +246,8 @@ static bool is_cde_desktop( Display* pDisplay )
extern "C"
{
-DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment()
+DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment()
{
- rtl::OUStringBuffer aRet( 8 );
static const char *pOverride = getenv( "OOO_FORCE_DESKTOP" );
if ( pOverride && *pOverride )
@@ -265,90 +255,87 @@ DESKTOP_DETECTOR_PUBLIC rtl::OUString get_desktop_environment()
OString aOver( pOverride );
if ( aOver.equalsIgnoreAsciiCase( "cde" ) )
- aRet.appendAscii( desktop_strings[DESKTOP_CDE] );
+ return DESKTOP_CDE;
if ( aOver.equalsIgnoreAsciiCase( "kde4" ) )
- aRet.appendAscii( desktop_strings[DESKTOP_KDE4] );
+ return DESKTOP_KDE4;
if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
- aRet.appendAscii( desktop_strings[DESKTOP_GNOME] );
+ return DESKTOP_GNOME;
if ( aOver.equalsIgnoreAsciiCase( "kde" ) )
- aRet.appendAscii( desktop_strings[DESKTOP_KDE] );
+ return DESKTOP_KDE;
if ( aOver.equalsIgnoreAsciiCase( "none" ) )
- aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] );
+ return DESKTOP_UNKNOWN;
}
- if( aRet.getLength() == 0 )
- {
- // get display to connect to
- const char* pDisplayStr = getenv( "DISPLAY" );
+ // get display to connect to
+ const char* pDisplayStr = getenv( "DISPLAY" );
- const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
+ const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
- if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0))
- pDisplayStr = NULL;
- else
+ if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0))
+ pDisplayStr = NULL;
+ else
+ {
+ int nParams = osl_getCommandArgCount();
+ OUString aParam;
+ OString aBParm;
+ for( int i = 0; i < nParams; i++ )
{
- int nParams = osl_getCommandArgCount();
- OUString aParam;
- OString aBParm;
- for( int i = 0; i < nParams; i++ )
+ osl_getCommandArg( i, &aParam.pData );
+ if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" ) ) ||
+ aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--headless" ) ) )
{
- osl_getCommandArg( i, &aParam.pData );
- if( aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" ) ) ||
- aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--headless" ) ) )
- {
- pDisplayStr = NULL;
- break;
- }
- if( i < nParams-1 && (aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) )) )
- {
- osl_getCommandArg( i+1, &aParam.pData );
- aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
- pDisplayStr = aBParm.getStr();
- break;
- }
+ pDisplayStr = NULL;
+ break;
}
- }
-
- // no server at all
- if( ! pDisplayStr || !*pDisplayStr )
- aRet.appendAscii( desktop_strings[DESKTOP_NONE] );
- else
- {
- /* #i92121# workaround deadlocks in the X11 implementation
- */
- static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" );
- /* #i90094#
- from now on we know that an X connection will be
- established, so protect X against itself
- */
- if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
- XInitThreads();
-
- Display* pDisplay = XOpenDisplay( pDisplayStr );
- if( pDisplay )
+ if( i < nParams-1 && (aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-display" ) ) || aParam.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "--display" ) )) )
{
- XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
-
- if ( is_kde4_desktop( pDisplay ) )
- aRet.appendAscii( desktop_strings[DESKTOP_KDE4] );
- else if ( is_gnome_desktop( pDisplay ) )
- aRet.appendAscii( desktop_strings[DESKTOP_GNOME] );
- else if ( is_cde_desktop( pDisplay ) )
- aRet.appendAscii( desktop_strings[DESKTOP_CDE] );
- else if ( is_kde_desktop( pDisplay ) )
- aRet.appendAscii( desktop_strings[DESKTOP_KDE] );
- else
- aRet.appendAscii( desktop_strings[DESKTOP_UNKNOWN] );
-
- // set the default handler again
- XSetErrorHandler( pOldHdl );
-
- XCloseDisplay( pDisplay );
+ osl_getCommandArg( i+1, &aParam.pData );
+ aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
+ pDisplayStr = aBParm.getStr();
+ break;
}
}
}
- return aRet.makeStringAndClear();
+ // no server at all
+ if( ! pDisplayStr || !*pDisplayStr )
+ return DESKTOP_NONE;
+
+ /* #i92121# workaround deadlocks in the X11 implementation
+ */
+ static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" );
+ /* #i90094#
+ from now on we know that an X connection will be
+ established, so protect X against itself
+ */
+ if( ! ( pNoXInitThreads && *pNoXInitThreads ) )
+ XInitThreads();
+
+ Display* pDisplay = XOpenDisplay( pDisplayStr );
+ if( pDisplay == NULL )
+ return DESKTOP_NONE;
+
+ DesktopType ret;
+
+ XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
+
+ if ( is_kde4_desktop( pDisplay ) )
+ ret = DESKTOP_KDE4;
+ else if ( is_gnome_desktop( pDisplay ) )
+ ret = DESKTOP_GNOME;
+ else if ( is_cde_desktop( pDisplay ) )
+ ret = DESKTOP_CDE;
+ else if ( is_kde_desktop( pDisplay ) )
+ ret = DESKTOP_KDE;
+ else
+ ret = DESKTOP_UNKNOWN;
+
+ // set the default handler again
+ XSetErrorHandler( pOldHdl );
+
+ XCloseDisplay( pDisplay );
+
+ return ret;
}
}
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 47062a0..b7eabc5 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -36,6 +36,7 @@
#include "salinst.hxx"
#include "unx/saldata.hxx"
+#include "unx/desktops.hxx"
#include "vcl/printerinfomanager.hxx"
#include <cstdio>
@@ -49,17 +50,6 @@ typedef SalInstance*(*salFactoryProc)( oslModule pModule);
static oslModule pCloseModule = NULL;
-enum {
- DESKTOP_NONE = 0,
- DESKTOP_UNKNOWN,
- DESKTOP_GNOME,
- DESKTOP_KDE,
- DESKTOP_KDE4,
- DESKTOP_CDE
-};
-
-static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" };
-
static SalInstance* tryInstance( const OUString& rModuleBase )
{
SalInstance* pInst = NULL;
@@ -131,29 +121,26 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
return pInst;
}
-static const rtl::OUString& get_desktop_environment()
+static DesktopType get_desktop_environment()
{
- static rtl::OUString aRet;
- if( ! aRet.getLength() )
+ OUStringBuffer aModName( 128 );
+ aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" );
+ aModName.appendAscii( SAL_DLLPOSTFIX );
+ OUString aModule = aModName.makeStringAndClear();
+
+ oslModule aMod = osl_loadModuleRelative(
+ reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData,
+ SAL_LOADMODULE_DEFAULT );
+ DesktopType ret = DESKTOP_UNKNOWN;
+ if( aMod )
{
- OUStringBuffer aModName( 128 );
- aModName.appendAscii( SAL_DLLPREFIX"desktop_detector" );
- aModName.appendAscii( SAL_DLLPOSTFIX );
- OUString aModule = aModName.makeStringAndClear();
-
- oslModule aMod = osl_loadModuleRelative(
- reinterpret_cast< oslGenericFunction >( &tryInstance ), aModule.pData,
- SAL_LOADMODULE_DEFAULT );
- if( aMod )
- {
- rtl::OUString (*pSym)() = (rtl::OUString(*)())
- osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" );
- if( pSym )
- aRet = pSym();
- }
- osl_unloadModule( aMod );
+ DesktopType (*pSym)() = (DesktopType(*)())
+ osl_getAsciiFunctionSymbol( aMod, "get_desktop_environment" );
+ if( pSym )
+ ret = pSym();
}
- return aRet;
+ osl_unloadModule( aMod );
+ return ret;
}
static SalInstance* autodetect_plugin()
@@ -173,21 +160,21 @@ static SalInstance* autodetect_plugin()
"svp", 0
};
- const rtl::OUString& desktop( get_desktop_environment() );
+ DesktopType desktop = get_desktop_environment();
const char ** pList = pStandardFallbackList;
int nListEntry = 0;
// no server at all: dummy plugin
- if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) )
+ if ( desktop == DESKTOP_NONE )
pList = pHeadlessFallbackList;
- else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) )
+ else if ( desktop == DESKTOP_GNOME )
pList = pStandardFallbackList;
- else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) )
+ else if( desktop == DESKTOP_KDE )
{
pList = pKDEFallbackList;
nListEntry = 1;
}
- else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) )
+ else if( desktop == DESKTOP_KDE4 )
pList = pKDEFallbackList;
SalInstance* pInst = NULL;
@@ -195,10 +182,10 @@ static SalInstance* autodetect_plugin()
{
rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) );
pInst = tryInstance( aTry );
- #if OSL_DEBUG_LEVEL > 1
+// #if OSL_DEBUG_LEVEL > 1
if( pInst )
std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] );
- #endif
+// #endif
nListEntry++;
}
@@ -288,9 +275,18 @@ void SalAbort( const XubString& rErrorText )
exit(-1);
}
+static const char * desktop_strings[] = { "none", "unknown", "GNOME", "KDE", "KDE4", "CDE" };
+
const OUString& SalGetDesktopEnvironment()
{
- return get_desktop_environment();
+ static rtl::OUString aRet;
+ if( aRet.isEmpty())
+ {
+ rtl::OUStringBuffer buf( 8 );
+ buf.appendAscii( desktop_strings[ get_desktop_environment() ] );
+ aRet = buf.makeStringAndClear();
+ }
+ return aRet;
}
SalData::SalData() :
More information about the Libreoffice-commits
mailing list