summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPader Rezso <rezso@rezso.net>2013-07-02 21:23:56 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-07-02 21:59:31 +0100
commitf31fad32005c6709eaae71b49af31264e585478a (patch)
treef79a2ade16f93f9dd67d44c6b4fe7460127be3bf
parent3887ba5677b1902fcf45f076d7a8e3ac96322dff (diff)
fdo#46990 - detect MATE and XFCE desktops.
Change-Id: Id72860fc2e7d6b40f4fcb96b8f504a4f86a335b1
-rw-r--r--vcl/inc/unx/desktops.hxx2
-rw-r--r--vcl/unx/generic/desktopdetect/desktopdetector.cxx30
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx4
3 files changed, 33 insertions, 3 deletions
diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx
index c97d708a0802..e41add4b588e 100644
--- a/vcl/inc/unx/desktops.hxx
+++ b/vcl/inc/unx/desktops.hxx
@@ -24,6 +24,8 @@ enum DesktopType {
DESKTOP_NONE, // headless, i.e. no X connection at all
DESKTOP_UNKNOWN, // unknown desktop, simple WM, etc.
DESKTOP_GNOME,
+ DESKTOP_XFCE,
+ DESKTOP_MATE,
DESKTOP_KDE,
DESKTOP_KDE4,
DESKTOP_TDE
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index f1d6c2626caf..a133449d21fc 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -43,8 +43,10 @@ static bool is_gnome_desktop( Display* pDisplay )
// warning: these checks are coincidental, GNOME does not
// explicitly advertise itself
- if ( NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) )
+ if ( "gnome" == getenv( "DESKTOP_SESSION" ) || NULL != getenv( "GNOME_DESKTOP_SESSION_ID" ) )
+ {
ret = true;
+ }
if( ! ret )
{
@@ -119,6 +121,24 @@ static bool is_gnome_desktop( Display* pDisplay )
return ret;
}
+static bool is_xfce_desktop( Display* pDisplay )
+{
+ if ( "xfce" == getenv( "DESKTOP_SESSION" ) )
+ {
+ return true;
+ }
+ return false;
+}
+
+static bool is_mate_desktop( Display* pDisplay )
+{
+ if ( "mate" == getenv( "DESKTOP_SESSION" ) )
+ {
+ return true;
+ }
+ return false;
+}
+
static bool bWasXError = false;
static inline bool WasXError()
@@ -291,6 +311,10 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment()
return DESKTOP_KDE4;
if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
return DESKTOP_GNOME;
+ if ( aOver.equalsIgnoreAsciiCase( "xfce" ) )
+ return DESKTOP_XFCE;
+ if ( aOver.equalsIgnoreAsciiCase( "mate" ) )
+ return DESKTOP_MATE;
if ( aOver.equalsIgnoreAsciiCase( "kde" ) )
return DESKTOP_KDE;
if ( aOver.equalsIgnoreAsciiCase( "none" ) )
@@ -351,6 +375,10 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment()
ret = DESKTOP_KDE4;
else if ( is_gnome_desktop( pDisplay ) )
ret = DESKTOP_GNOME;
+ else if ( is_xfce_desktop( pDisplay ) )
+ ret = DESKTOP_XFCE;
+ else if ( is_mate_desktop( pDisplay ) )
+ ret = DESKTOP_MATE;
else if ( is_kde_desktop( pDisplay ) )
ret = DESKTOP_KDE;
else
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 2eec71744955..fba45f1c4a80 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -188,7 +188,7 @@ static SalInstance* autodetect_plugin()
// no server at all: dummy plugin
if ( desktop == DESKTOP_NONE )
pList = pHeadlessFallbackList;
- else if ( desktop == DESKTOP_GNOME )
+ else if ( desktop == DESKTOP_GNOME || desktop == DESKTOP_XFCE || desktop == DESKTOP_MATE )
pList = pStandardFallbackList;
else if( desktop == DESKTOP_TDE )
pList = pTDEFallbackList;
@@ -287,7 +287,7 @@ void SalAbort( const OUString& rErrorText, bool bDumpCore )
_exit(1);
}
-static const char * desktop_strings[] = { "none", "unknown", "GNOME", "TDE", "KDE", "KDE4" };
+static const char * desktop_strings[] = { "none", "unknown", "GNOME", "XFCE", "MATE", "TDE", "KDE", "KDE4" };
const OUString& SalGetDesktopEnvironment()
{