show the error returned by SmcOpenConnection(); don't call it more than once -- the desktop environment is not going to change while the program is running
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8bd37efca7
commit
dee28fdd4d
@ -332,15 +332,19 @@ static wxString GetSM()
|
|||||||
if ( !dpy )
|
if ( !dpy )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
char smerr[256];
|
||||||
char *client_id;
|
char *client_id;
|
||||||
SmcConn smc_conn = SmcOpenConnection(NULL, NULL,
|
SmcConn smc_conn = SmcOpenConnection(NULL, NULL,
|
||||||
999, 999,
|
999, 999,
|
||||||
0 /* mask */, NULL /* callbacks */,
|
0 /* mask */, NULL /* callbacks */,
|
||||||
NULL, &client_id,
|
NULL, &client_id,
|
||||||
0, NULL);
|
WXSIZEOF(smerr), smerr);
|
||||||
|
|
||||||
if ( !smc_conn )
|
if ( !smc_conn )
|
||||||
|
{
|
||||||
|
wxLogWarning(_("Failed to connect to session manager: %s"), smerr);
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
char *vendor = SmcVendor(smc_conn);
|
char *vendor = SmcVendor(smc_conn);
|
||||||
wxString ret = wxString::FromAscii( vendor );
|
wxString ret = wxString::FromAscii( vendor );
|
||||||
@ -471,7 +475,7 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
|
|||||||
wxString wxGUIAppTraits::GetDesktopEnvironment() const
|
wxString wxGUIAppTraits::GetDesktopEnvironment() const
|
||||||
{
|
{
|
||||||
#if wxUSE_DETECT_SM
|
#if wxUSE_DETECT_SM
|
||||||
const wxString SM = GetSM();
|
static const wxString SM = GetSM();
|
||||||
|
|
||||||
if (SM == wxT("GnomeSM"))
|
if (SM == wxT("GnomeSM"))
|
||||||
return wxT("GNOME");
|
return wxT("GNOME");
|
||||||
|
Loading…
Reference in New Issue
Block a user