make it possible to override desktop detection using gtk.desktop system option

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-03 13:46:33 +00:00
parent dee28fdd4d
commit 9d0e03774e
2 changed files with 13 additions and 7 deletions

View File

@@ -44,6 +44,8 @@ level windows is currently supported, however this may sometimes fail and this
option allows to override the automatic detection. Setting it to $1$ makes the option allows to override the automatic detection. Setting it to $1$ makes the
transparency be always available (setting it can still fail, of course) and transparency be always available (setting it can still fail, of course) and
setting it to $0$ makes it always unavailable.} setting it to $0$ makes it always unavailable.}
\twocolitem{gtk.desktop}{This option can be set to override the default desktop
environment determination. Supported values are \texttt{GNOME} and \texttt{KDE}.}
\end{twocollist} \end{twocollist}
\wxheading{Mac} \wxheading{Mac}

View File

@@ -21,6 +21,7 @@
#include "wx/apptrait.h" #include "wx/apptrait.h"
#include "wx/process.h" #include "wx/process.h"
#include "wx/sysopt.h"
#include "wx/unix/execute.h" #include "wx/unix/execute.h"
@@ -474,17 +475,20 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
wxString wxGUIAppTraits::GetDesktopEnvironment() const wxString wxGUIAppTraits::GetDesktopEnvironment() const
{ {
wxString de = wxSystemOptions::GetOption(_T("gtk.desktop"));
if ( de.empty() )
{
#if wxUSE_DETECT_SM #if wxUSE_DETECT_SM
static const wxString SM = GetSM(); static const wxString s_SM = GetSM();
if (SM == wxT("GnomeSM")) if (s_SM == wxT("GnomeSM"))
return wxT("GNOME"); de = wxT("GNOME");
else if (s_SM == wxT("KDE"))
if (SM == wxT("KDE")) de = wxT("KDE");
return wxT("KDE"); }
#endif // wxUSE_DETECT_SM #endif // wxUSE_DETECT_SM
return wxEmptyString; return de;
} }
#ifdef __WXGTK26__ #ifdef __WXGTK26__