Test for KDE and GNOME using session manager vendor.
Use it in mime types initialization. Add wxUSE_DETECT_SM git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
34
configure.in
34
configure.in
@@ -525,6 +525,7 @@ if test $DEBUG_CONFIGURE = 1; then
|
|||||||
DEFAULT_wxUSE_COMBOCTRL=no
|
DEFAULT_wxUSE_COMBOCTRL=no
|
||||||
DEFAULT_wxUSE_DATEPICKCTRL=no
|
DEFAULT_wxUSE_DATEPICKCTRL=no
|
||||||
DEFAULT_wxUSE_DISPLAY=no
|
DEFAULT_wxUSE_DISPLAY=no
|
||||||
|
DEFAULT_wxUSE_DETECT_SM=no
|
||||||
DEFAULT_wxUSE_DIRPICKERCTRL=no
|
DEFAULT_wxUSE_DIRPICKERCTRL=no
|
||||||
DEFAULT_wxUSE_FILEPICKERCTRL=no
|
DEFAULT_wxUSE_FILEPICKERCTRL=no
|
||||||
DEFAULT_wxUSE_FONTPICKERCTRL=no
|
DEFAULT_wxUSE_FONTPICKERCTRL=no
|
||||||
@@ -742,6 +743,7 @@ else
|
|||||||
DEFAULT_wxUSE_COMBOCTRL=yes
|
DEFAULT_wxUSE_COMBOCTRL=yes
|
||||||
DEFAULT_wxUSE_DATEPICKCTRL=yes
|
DEFAULT_wxUSE_DATEPICKCTRL=yes
|
||||||
DEFAULT_wxUSE_DISPLAY=yes
|
DEFAULT_wxUSE_DISPLAY=yes
|
||||||
|
DEFAULT_wxUSE_DETECT_SM=yes
|
||||||
DEFAULT_wxUSE_DIRPICKERCTRL=yes
|
DEFAULT_wxUSE_DIRPICKERCTRL=yes
|
||||||
DEFAULT_wxUSE_FILEPICKERCTRL=yes
|
DEFAULT_wxUSE_FILEPICKERCTRL=yes
|
||||||
DEFAULT_wxUSE_FONTPICKERCTRL=yes
|
DEFAULT_wxUSE_FONTPICKERCTRL=yes
|
||||||
@@ -1070,6 +1072,7 @@ if test "$wxUSE_CONTROLS" = "yes"; then
|
|||||||
DEFAULT_wxUSE_COMBOBOX=yes
|
DEFAULT_wxUSE_COMBOBOX=yes
|
||||||
DEFAULT_wxUSE_DATEPICKCTRL=yes
|
DEFAULT_wxUSE_DATEPICKCTRL=yes
|
||||||
DEFAULT_wxUSE_DISPLAY=yes
|
DEFAULT_wxUSE_DISPLAY=yes
|
||||||
|
DEFAULT_wxUSE_DETECT_SM=yes
|
||||||
DEFAULT_wxUSE_DIRPICKERCTRL=yes
|
DEFAULT_wxUSE_DIRPICKERCTRL=yes
|
||||||
DEFAULT_wxUSE_FILEPICKERCTRL=yes
|
DEFAULT_wxUSE_FILEPICKERCTRL=yes
|
||||||
DEFAULT_wxUSE_FONTPICKERCTRL=yes
|
DEFAULT_wxUSE_FONTPICKERCTRL=yes
|
||||||
@@ -1120,6 +1123,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
|
|||||||
DEFAULT_wxUSE_COMBOBOX=no
|
DEFAULT_wxUSE_COMBOBOX=no
|
||||||
DEFAULT_wxUSE_DATEPICKCTRL=no
|
DEFAULT_wxUSE_DATEPICKCTRL=no
|
||||||
DEFAULT_wxUSE_DISPLAY=no
|
DEFAULT_wxUSE_DISPLAY=no
|
||||||
|
DEFAULT_wxUSE_DETECT_SM=no
|
||||||
DEFAULT_wxUSE_DIRPICKERCTRL=no
|
DEFAULT_wxUSE_DIRPICKERCTRL=no
|
||||||
DEFAULT_wxUSE_FILEPICKERCTRL=no
|
DEFAULT_wxUSE_FILEPICKERCTRL=no
|
||||||
DEFAULT_wxUSE_FONTPICKERCTRL=no
|
DEFAULT_wxUSE_FONTPICKERCTRL=no
|
||||||
@@ -1173,6 +1177,7 @@ WX_ARG_ENABLE(comboctrl, [ --enable-comboctrl use wxComboCtrl class], wx
|
|||||||
WX_ARG_ENABLE(datepick, [ --enable-datepick use wxDatePickerCtrl class], wxUSE_DATEPICKCTRL)
|
WX_ARG_ENABLE(datepick, [ --enable-datepick use wxDatePickerCtrl class], wxUSE_DATEPICKCTRL)
|
||||||
WX_ARG_ENABLE(dirpicker, [ --enable-dirpicker use wxDirPickerCtrl class], wxUSE_DIRPICKERCTRL)
|
WX_ARG_ENABLE(dirpicker, [ --enable-dirpicker use wxDirPickerCtrl class], wxUSE_DIRPICKERCTRL)
|
||||||
WX_ARG_ENABLE(display, [ --enable-display use wxDisplay class], wxUSE_DISPLAY)
|
WX_ARG_ENABLE(display, [ --enable-display use wxDisplay class], wxUSE_DISPLAY)
|
||||||
|
WX_ARG_ENABLE(detect_sm, [ --enable-detect_sm use code to detect X11 session manager], wxUSE_DETECT_SM)
|
||||||
WX_ARG_ENABLE(filepicker, [ --enable-filepicker use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
|
WX_ARG_ENABLE(filepicker, [ --enable-filepicker use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
|
||||||
WX_ARG_ENABLE(fontpicker, [ --enable-fontpicker use wxFontPickerCtrl class], wxUSE_FONTPICKERCTRL)
|
WX_ARG_ENABLE(fontpicker, [ --enable-fontpicker use wxFontPickerCtrl class], wxUSE_FONTPICKERCTRL)
|
||||||
WX_ARG_ENABLE(gauge, [ --enable-gauge use wxGauge class], wxUSE_GAUGE)
|
WX_ARG_ENABLE(gauge, [ --enable-gauge use wxGauge class], wxUSE_GAUGE)
|
||||||
@@ -3788,6 +3793,31 @@ dnl ---------------------------------------------------------------------------
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl X11 session management
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
if test "$wxUSE_DETECT_SM" = "yes"; then
|
||||||
|
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_COCOA" != 1; then
|
||||||
|
AC_MSG_CHECKING([for -lSM - X11 session management])
|
||||||
|
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],SM)
|
||||||
|
if test "$ac_find_libraries" != "" ; then
|
||||||
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
|
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||||
|
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
||||||
|
fi
|
||||||
|
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lSM"
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
AC_MSG_WARN([libSM not found; disabling session management detection])
|
||||||
|
wxUSE_DETECT_SM="no"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
wxUSE_DETECT_SM="no"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl OpenGL libraries
|
dnl OpenGL libraries
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
@@ -6555,6 +6585,10 @@ if test "$wxUSE_DISPLAY" = "yes"; then
|
|||||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS display multimon"
|
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS display multimon"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$wxUSE_DETECT_SM" = "yes"; then
|
||||||
|
AC_DEFINE(wxUSE_DETECT_SM)
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_GAUGE" = "yes"; then
|
if test "$wxUSE_GAUGE" = "yes"; then
|
||||||
AC_DEFINE(wxUSE_GAUGE)
|
AC_DEFINE(wxUSE_GAUGE)
|
||||||
USES_CONTROLS=1
|
USES_CONTROLS=1
|
||||||
|
@@ -118,6 +118,10 @@ public:
|
|||||||
|
|
||||||
// return true if the port is using wxUniversal for the GUI, false if not
|
// return true if the port is using wxUniversal for the GUI, false if not
|
||||||
virtual bool IsUsingUniversalWidgets() const = 0;
|
virtual bool IsUsingUniversalWidgets() const = 0;
|
||||||
|
|
||||||
|
// return the name of the Desktop Environment such as
|
||||||
|
// "KDE" or "GNOME". May return an empty string.
|
||||||
|
virtual wxString GetDesktopEnvironment() const { return wxEmptyString; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -39,6 +39,10 @@ public:
|
|||||||
virtual wxStandardPathsBase& GetStandardPaths();
|
virtual wxStandardPathsBase& GetStandardPaths();
|
||||||
#endif
|
#endif
|
||||||
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
virtual wxString GetDesktopEnvironment() const;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -375,6 +375,8 @@
|
|||||||
|
|
||||||
#define wxUSE_DISPLAY 0
|
#define wxUSE_DISPLAY 0
|
||||||
|
|
||||||
|
#define wxUSE_DETECT_SM 0
|
||||||
|
|
||||||
#define wxUSE_GEOMETRY 0
|
#define wxUSE_GEOMETRY 0
|
||||||
|
|
||||||
#define wxUSE_IMAGLIST 0
|
#define wxUSE_IMAGLIST 0
|
||||||
|
@@ -47,6 +47,12 @@
|
|||||||
#undef explicit
|
#undef explicit
|
||||||
#endif // HAVE_X11_XKBLIB_H
|
#endif // HAVE_X11_XKBLIB_H
|
||||||
|
|
||||||
|
|
||||||
|
#if wxUSE_DETECT_SM
|
||||||
|
#include "X11/Xlib.h"
|
||||||
|
#include "X11/SM/SMlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// data
|
// data
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -283,3 +289,48 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
|||||||
|
|
||||||
return wxPORT_GTK;
|
return wxPORT_GTK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_DETECT_SM
|
||||||
|
static wxString GetSM()
|
||||||
|
{
|
||||||
|
Display *dpy;
|
||||||
|
SmcConn smc_conn;
|
||||||
|
char *vendor;
|
||||||
|
char *client_id_ret;
|
||||||
|
dpy = XOpenDisplay(NULL);
|
||||||
|
|
||||||
|
smc_conn = SmcOpenConnection(NULL, NULL,
|
||||||
|
999, 999,
|
||||||
|
0 /* mask */, NULL /* callbacks */,
|
||||||
|
NULL, &client_id_ret, 0, NULL);
|
||||||
|
|
||||||
|
vendor = SmcVendor(smc_conn);
|
||||||
|
wxString ret = wxString::FromAscii( vendor );
|
||||||
|
free(vendor);
|
||||||
|
|
||||||
|
SmcCloseConnection(smc_conn, 0, NULL);
|
||||||
|
free(client_id_ret);
|
||||||
|
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxString wxGUIAppTraits::GetDesktopEnvironment() const
|
||||||
|
{
|
||||||
|
#if wxUSE_DETECT_SM
|
||||||
|
wxString SM = GetSM();
|
||||||
|
|
||||||
|
if (SM == wxT("GnomeSM"))
|
||||||
|
return wxT("GNOME");
|
||||||
|
|
||||||
|
if (SM == wxT("KDE"))
|
||||||
|
return wxT("KDE");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -57,6 +57,8 @@
|
|||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/iconloc.h"
|
#include "wx/iconloc.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/apptrait.h"
|
||||||
|
|
||||||
#if wxUSE_LIBGNOMEVFS
|
#if wxUSE_LIBGNOMEVFS
|
||||||
// Not GUI dependent
|
// Not GUI dependent
|
||||||
@@ -1311,11 +1313,11 @@ void wxMimeTypesManagerImpl::InitIfNeeded()
|
|||||||
// set the flag first to prevent recursion
|
// set the flag first to prevent recursion
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
|
|
||||||
const wxString &wm = wxGetenv( wxT("WINDOWMANAGER") );
|
wxString wm = wxTheApp->GetTraits()->GetDesktopEnvironment();
|
||||||
|
|
||||||
if (wm.Find( wxT("kde") ) != wxNOT_FOUND)
|
if (wm == wxT("KDE"))
|
||||||
Initialize( wxMAILCAP_KDE );
|
Initialize( wxMAILCAP_KDE );
|
||||||
else if (wm.Find( wxT("gnome") ) != wxNOT_FOUND)
|
else if (wm == wxT("GNOME"))
|
||||||
Initialize( wxMAILCAP_GNOME );
|
Initialize( wxMAILCAP_GNOME );
|
||||||
else
|
else
|
||||||
Initialize();
|
Initialize();
|
||||||
|
Reference in New Issue
Block a user